Changeset 202583 in webkit


Ignore:
Timestamp:
Jun 28, 2016 1:19:01 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Iterable interfaces should have their related prototype @@iterator property writable
https://bugs.webkit.org/show_bug.cgi?id=159211
Source/WebCore:

<rdar://problem/26950766>

Patch by Youenn Fablet <youenn@apple.com> on 2016-06-28
Reviewed by Chris Dumez.

Updating @@iterator property according http://heycam.github.io/webidl/#es-iterator.

Covered by updated test.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation): Removing ReadOnly flag from @@iterator property of iterable interfaces.

  • bindings/scripts/test/JS/JSTestNode.cpp:

(WebCore::JSTestNodePrototype::finishCreation): Rebasing expectation.

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObjPrototype::finishCreation): Ditto.

LayoutTests:

Patch by Youenn Fablet <youenn@apple.com> on 2016-06-28
Reviewed by Chris Dumez.

  • fast/dom/nodeListIterator-expected.txt:
  • fast/dom/nodeListIterator.html: Overriding NodeList @@iterator by Array one and checking everything is fine.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202579 r202583  
     12016-06-28  Youenn Fablet  <youenn@apple.com>
     2
     3        Iterable interfaces should have their related prototype @@iterator property writable
     4        https://bugs.webkit.org/show_bug.cgi?id=159211
     5
     6        Reviewed by Chris Dumez.
     7
     8        * fast/dom/nodeListIterator-expected.txt:
     9        * fast/dom/nodeListIterator.html: Overriding NodeList @@iterator by Array one and checking everything is fine.
     10
    1112016-06-28  Jer Noble  <jer.noble@apple.com>
    212
  • trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt

    r202334 r202583  
    3939PASS end.done is true
    4040PASS end.value is undefined
     41PASS descriptor.configurable is true
     42PASS descriptor.writable is true
     43PASS descriptor.enumerable is false
     44PASS NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; did not throw exception.
     45PASS a instanceof Node is true
     46PASS a instanceof Node is true
     47PASS a instanceof Node is true
     48PASS a instanceof Node is true
     49PASS counter is 4
    4150PASS successfullyParsed is true
    4251
  • trunk/LayoutTests/fast/dom/nodeListIterator.html

    r202334 r202583  
    8888            checkEndIterator(iterator.next());
    8989
     90            var descriptor = Object.getOwnPropertyDescriptor(NodeList.prototype, Symbol.iterator);
     91            shouldBeTrue('descriptor.configurable');
     92            shouldBeTrue('descriptor.writable');
     93            shouldBeFalse('descriptor.enumerable');
     94
     95            shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');
     96            var counter = 0;
     97            for (var a of nodeList) {
     98                shouldBeTrue('a instanceof Node');
     99                counter++;
     100            }
     101            shouldBe('counter', '4');
    90102        </script>
    91103        <script src="../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r202582 r202583  
     12016-06-28  Youenn Fablet  <youenn@apple.com>
     2
     3        Iterable interfaces should have their related prototype @@iterator property writable
     4        https://bugs.webkit.org/show_bug.cgi?id=159211
     5        <rdar://problem/26950766>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Updating @@iterator property according  http://heycam.github.io/webidl/#es-iterator.
     10
     11        Covered by updated test.
     12
     13        * bindings/scripts/CodeGeneratorJS.pm:
     14        (GenerateImplementation): Removing ReadOnly flag from @@iterator property of iterable interfaces.
     15        * bindings/scripts/test/JS/JSTestNode.cpp:
     16        (WebCore::JSTestNodePrototype::finishCreation): Rebasing expectation.
     17        * bindings/scripts/test/JS/JSTestObj.cpp:
     18        (WebCore::JSTestObjPrototype::finishCreation): Ditto.
     19
    1202016-06-28  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r202551 r202583  
    23112311        if ($interface->iterable) {
    23122312            my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]);
    2313             push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), ReadOnly | DontEnum);\n");
     2313            push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), DontEnum);\n");
    23142314        }
    23152315
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r202307 r202583  
    116116    Base::finishCreation(vm);
    117117    reifyStaticProperties(vm, JSTestNodePrototypeTableValues, *this);
    118     putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
     118    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
    119119}
    120120
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r202307 r202583  
    13281328    putDirect(vm, clientData.builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
    13291329    putDirect(vm, clientData.builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
    1330     putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
     1330    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
    13311331}
    13321332
Note: See TracChangeset for help on using the changeset viewer.