Title: [202583] trunk
Revision
202583
Author
[email protected]
Date
2016-06-28 13:19:01 -0700 (Tue, 28 Jun 2016)

Log 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 <[email protected]> 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 <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202582 => 202583)


--- trunk/LayoutTests/ChangeLog	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/LayoutTests/ChangeLog	2016-06-28 20:19:01 UTC (rev 202583)
@@ -1,3 +1,13 @@
+2016-06-28  Youenn Fablet  <[email protected]>
+
+        Iterable interfaces should have their related prototype @@iterator property writable
+        https://bugs.webkit.org/show_bug.cgi?id=159211
+
+        Reviewed by Chris Dumez.
+
+        * fast/dom/nodeListIterator-expected.txt:
+        * fast/dom/nodeListIterator.html: Overriding NodeList @@iterator by Array one and checking everything is fine.
+
 2016-06-28  Jer Noble  <[email protected]>
 
         Cross-domain video loads do not prompt for authorization.

Modified: trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt (202582 => 202583)


--- trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt	2016-06-28 20:19:01 UTC (rev 202583)
@@ -38,6 +38,15 @@
 PASS end.value is undefined
 PASS end.done is true
 PASS end.value is undefined
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is false
+PASS NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; did not throw exception.
+PASS a instanceof Node is true
+PASS a instanceof Node is true
+PASS a instanceof Node is true
+PASS a instanceof Node is true
+PASS counter is 4
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/nodeListIterator.html (202582 => 202583)


--- trunk/LayoutTests/fast/dom/nodeListIterator.html	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/LayoutTests/fast/dom/nodeListIterator.html	2016-06-28 20:19:01 UTC (rev 202583)
@@ -87,6 +87,18 @@
             testingGround.appendChild(document.createElement('p'));
             checkEndIterator(iterator.next());
 
+            var descriptor = Object.getOwnPropertyDescriptor(NodeList.prototype, Symbol.iterator);
+            shouldBeTrue('descriptor.configurable');
+            shouldBeTrue('descriptor.writable');
+            shouldBeFalse('descriptor.enumerable');
+
+            shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');
+            var counter = 0;
+            for (var a of nodeList) {
+                shouldBeTrue('a instanceof Node');
+                counter++;
+            }
+            shouldBe('counter', '4');
         </script>
         <script src=""
     </body>

Modified: trunk/Source/WebCore/ChangeLog (202582 => 202583)


--- trunk/Source/WebCore/ChangeLog	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/Source/WebCore/ChangeLog	2016-06-28 20:19:01 UTC (rev 202583)
@@ -1,3 +1,22 @@
+2016-06-28  Youenn Fablet  <[email protected]>
+
+        Iterable interfaces should have their related prototype @@iterator property writable
+        https://bugs.webkit.org/show_bug.cgi?id=159211
+        <rdar://problem/26950766>
+
+        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.
+
 2016-06-28  Anders Carlsson  <[email protected]>
 
         "Total amount is too big" error message is displaying on clicking Pay button

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (202582 => 202583)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-28 20:19:01 UTC (rev 202583)
@@ -2310,7 +2310,7 @@
 
         if ($interface->iterable) {
             my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]);
-            push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), ReadOnly | DontEnum);\n");
+            push(@implContent, "    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), DontEnum);\n");
         }
 
         push(@implContent, "}\n\n");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (202582 => 202583)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2016-06-28 20:19:01 UTC (rev 202583)
@@ -115,7 +115,7 @@
 {
     Base::finishCreation(vm);
     reifyStaticProperties(vm, JSTestNodePrototypeTableValues, *this);
-    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
 }
 
 const ClassInfo JSTestNode::s_info = { "TestNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (202582 => 202583)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-06-28 19:50:01 UTC (rev 202582)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-06-28 20:19:01 UTC (rev 202583)
@@ -1327,7 +1327,7 @@
     JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);
     putDirect(vm, clientData.builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
     putDirect(vm, clientData.builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
 }
 
 const ClassInfo JSTestObj::s_info = { "TestObject", &Base::s_info, &JSTestObjTable, CREATE_METHOD_TABLE(JSTestObj) };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to