Title: [203222] trunk
Revision
203222
Author
[email protected]
Date
2016-07-14 04:16:17 -0700 (Thu, 14 Jul 2016)

Log Message

DOM value iterable interfaces should use Array prototype methods
https://bugs.webkit.org/show_bug.cgi?id=159296

Patch by Youenn Fablet <[email protected]> on 2016-07-14
Reviewed by Chris Dumez and Mark Lam.

Source/_javascript_Core:

* _javascript_Core.xcodeproj/project.pbxproj: Marking some header files as private so that they can be included in
WebCore.
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation): copying iterable methods (entries, forEach, keys and values) to private slots.

Source/WebCore:

Test: fast/dom/NodeList/nodelist-iterable.html
Also covered by updated layout test and binding tests.

For value iterators, copy the iterator methods from Array prototype: as per https://heycam.github.io/webidl/#es-iterable,
[re: entries] If the interface has a value iterator, then the Function object is the initial value of the "entries" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
[re: keys] If the interface has a value iterator, then the Function object is the initial value of the "keys" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
[re: forEach] If the interface defines an indexed property getter, then the Function object is the initial value of the "forEach" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
[re: Symbol.iterator] If the interface defines an indexed property getter, then the Function object is %ArrayProto_values% ([ECMA-262], section 6.1.7.4).
[re: values] If the interface has a value iterator, then the Function object is the value of the @@iterator property.

This change applies only to NodeList at the moment.
Copy of Array prototype iterator methods is disabled if the interface has no indexed getter.

* CMakeLists.txt:
* ForwardingHeaders/builtins/BuiltinNames.h: Added.
* ForwardingHeaders/builtins/JSCBuiltins.h: Added.
* ForwardingHeaders/runtime/CommonIdentifiers.h: Added.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMIterator.cpp: Added.
(WebCore::addValueIterableMethods): Copy iterator methods from array prototype.
* bindings/js/JSDOMIterator.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePropertiesHashTable):
(GenerateImplementation):
(IsValueIterableInterface): Introduced to only copy iterator methods if the interface has an indexed getter.
(IsKeyValueIterableInterface): Introduced to detect whether generating iterator methods.
(GenerateImplementationIterableFunctions):
* bindings/scripts/test/GObject/WebKitDOMTestIterable.cpp: Added.
* bindings/scripts/test/GObject/WebKitDOMTestIterable.h: Added.
* bindings/scripts/test/GObject/WebKitDOMTestIterablePrivate.h: Added.
* bindings/scripts/test/JS/JSTestIterable.cpp: Added.
* bindings/scripts/test/JS/JSTestIterable.h: Added.
* bindings/scripts/test/JS/JSTestObj.cpp: Updated as TestObj defines both iterable<> and indexed getter.
* bindings/scripts/test/ObjC/DOMTestIterable.h: Added.
* bindings/scripts/test/ObjC/DOMTestIterable.mm: Added.
* bindings/scripts/test/ObjC/DOMTestIterableInternal.h: Added.
* bindings/scripts/test/TestIterable.idl: Added to handle the case of value iterator without indexed getter defined.
Array prototype methods should not be copied.
* bindings/scripts/test/TestObj.idl: Changing to be a value iterator (with indexed getter already defined).
Array prototype methods should be copied.

LayoutTests:

* fast/dom/nodeListIterator-expected.txt:
* fast/dom/nodeListIterator.html:
* fast/dom/NodeList/nodelist-iterable-expected.txt: Added.
* fast/dom/NodeList/nodelist-iterable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203221 => 203222)


--- trunk/LayoutTests/ChangeLog	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/LayoutTests/ChangeLog	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1,5 +1,17 @@
 2016-07-14  Youenn Fablet  <[email protected]>
 
+        DOM value iterable interfaces should use Array prototype methods
+        https://bugs.webkit.org/show_bug.cgi?id=159296
+
+        Reviewed by Chris Dumez and Mark Lam.
+
+        * fast/dom/nodeListIterator-expected.txt:
+        * fast/dom/nodeListIterator.html:
+        * fast/dom/NodeList/nodelist-iterable-expected.txt: Added.
+        * fast/dom/NodeList/nodelist-iterable.html: Added.
+
+2016-07-14  Youenn Fablet  <[email protected]>
+
         [Fetch API] Request and Response url getter should use URL serialization
         https://bugs.webkit.org/show_bug.cgi?id=159705
 

Added: trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable-expected.txt (0 => 203222)


--- trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable-expected.txt	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,14 @@
+
+
+
+
+    
+
+PASS for (node of NodeList) 
+PASS for ([index, node] of NodeList.entries()) 
+PASS for (index of NodeList.keys()) 
+PASS for (node of NodeList.values()) 
+PASS NodeList.prototype.forEach() 
+PASS Delete earlier element in live NodeList 
+PASS Delete later element in live NodeList 
+

Added: trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable.html (0 => 203222)


--- trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/NodeList/nodelist-iterable.html	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<!-- Copied directly from https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/LayoutTests/fast/dom/NodeList/nodelist-iterable.html -->
+<meta charset="utf-8">
+<title>Ensure NodeList semantically matches WebIDL iterable</title>
+<script src=""
+<script src=""
+<div id="container">
+    <div id="div1"></div>
+    <div id="div2"></div><br>
+    <div id="div3"></div><br>
+    <div id="div4"></div><br>
+    <div id="div5"></div><br>
+    <form id="form">
+        <input id="rad1" type="radio" name="radio" value="a">
+        <input id="rad2" type="radio" name="radio" value="b">
+        <input id="rad3" type="radio" name="radio" value="c">
+        <input id="rad4" type="radio" name="radio" value="d">
+    </form>
+</div>
+<script>
+"use strict";
+test(function() {
+    let nodeList = container.querySelectorAll("div");
+    let ids = [];
+    for (let node of nodeList) {
+        assert_true(node instanceof HTMLDivElement, "elements should be expected types");
+        ids.push(node.id);
+
+    }
+    assert_array_equals(ids, ["div1", "div2", "div3", "div4", "div5"], "elements should be the expected values");
+
+}, "for (node of NodeList)");
+test(function() {
+    let nodeList = container.querySelectorAll("div");
+    for (let entry of nodeList.entries()) {
+        assert_equals(typeof entry[0], "number", "value-iterable keys should be integers");
+        let id = entry[0] + 1;
+        let node = entry[1];
+        assert_true(node instanceof HTMLDivElement, "elements should be expected types");
+        assert_equals(node.id, "div" + id, "elements should be the expected values");
+
+    }
+
+}, "for ([index, node] of NodeList.entries())");
+test(function() {
+    let nodeList = container.querySelectorAll("div");
+    for (let id of nodeList.keys()) {
+        assert_equals(typeof id, "number", "value-iterable keys should be integers");
+        let node = nodeList[id];
+        assert_true(node instanceof HTMLDivElement, "elements should be expected types");
+        assert_equals(node.id, "div" + (id + 1), "elements should be the expected values");
+
+    }
+
+}, "for (index of NodeList.keys())");
+test(function() {
+    let nodeList = container.querySelectorAll("div");
+    let ids = [];
+    for (let node of nodeList.values()) {
+        assert_true(node instanceof HTMLDivElement, "elements should be expected types");
+        ids.push(node.id);
+
+    }
+    assert_array_equals(ids, ["div1", "div2", "div3", "div4", "div5"], "elements should be the expected values");
+
+}, "for (node of NodeList.values())");
+test(function() {
+    let nodeList = container.querySelectorAll("div");
+    nodeList.forEach(function(node, id) {
+        assert_true(node instanceof HTMLDivElement, "elements should be expected types");
+        assert_equals(node.id, "div" + (id + 1), "elements should be the expected values");
+
+    });
+
+}, "NodeList.prototype.forEach()");
+test(function() {
+    let nodeList = form.radio;
+    let rad = rad1;
+    let ids = [];
+    for (let node of nodeList) {
+        assert_true(node instanceof HTMLInputElement, "elements should be expected types");
+        ids.push(node.id);
+        if (node === rad2) rad1.remove();
+
+    }
+    assert_array_equals(ids, ["rad1", "rad2", "rad4"], "elements should be the expected values");
+    form.insertBefore(rad, rad2);
+
+}, "Delete earlier element in live NodeList");
+test(function() {
+    let nodeList = form.radio;
+    let rad = rad2;
+    let ids = [];
+    for (let node of nodeList) {
+        assert_true(node instanceof HTMLInputElement, "elements should be expected types");
+        ids.push(node.id);
+        if (node === rad1) rad.remove();
+
+    }
+    assert_array_equals(ids, ["rad1", "rad3", "rad4"], "elements should be the expected values");
+    form.insertBefore(rad, rad3);
+
+}, "Delete later element in live NodeList");
+</script>
+</script>
+</form>
+</div></title>

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


--- trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt	2016-07-14 11:16:17 UTC (rev 203222)
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS nodeList.entries === entriesFunction is true
+PASS nodeList.forEach === forEachFunction is true
+PASS nodeList.keys === keysFunction is true
+PASS nodeList.values === valuesFunction is true
 PASS nodeList.length is 2
 PASS item is children[index++]
 PASS item is children[index++]
@@ -20,8 +24,8 @@
 PASS thisValue is window
 PASS thisValue is givenThisValue
 PASS thisValue is givenThisValue
-PASS iterator.next().value is children[0]
-PASS iterator.next().value is children[1]
+PASS iterator.next().value is 0
+PASS iterator.next().value is 1
 PASS end.done is true
 PASS end.value is undefined
 PASS iterator.next().value is children[0]
@@ -41,7 +45,7 @@
 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 NodeList.prototype[Symbol.iterator] = valuesFunction; did not throw exception.
 PASS a instanceof Node is true
 PASS a instanceof Node is true
 PASS a instanceof Node is true

Modified: trunk/LayoutTests/fast/dom/nodeListIterator.html (203221 => 203222)


--- trunk/LayoutTests/fast/dom/nodeListIterator.html	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/LayoutTests/fast/dom/nodeListIterator.html	2016-07-14 11:16:17 UTC (rev 203222)
@@ -7,6 +7,28 @@
         <script>
             description('Testing of NodeList iterable capacities.');
 
+            // Modifying Array prototype to ensure this does not impact NodeList iterable methods.
+            var entriesFunction = Array.prototype.entries;
+            Array.prototype.entries = function() {
+                console.log("Array.prototype.entries called");
+              return entriesFunction.apply(this, arguments);
+            }
+            var forEachFunction = Array.prototype.forEach;
+            Array.prototype.forEach = function() {
+                console.log("Array.prototype.forEach called");
+              return forEachFunction.apply(this, arguments);
+            }
+            var keysFunction = Array.prototype.keys;
+            Array.prototype.keys = function() {
+                console.log("Array.prototype.keys called");
+              return keysFunction.apply(this, arguments);
+            }
+            var valuesFunction = Array.prototype.values;
+            Array.prototype.values = function() {
+                console.log("Array.prototype.values called");
+              return valuesFunction.apply(this, arguments);
+            }
+
             if (window.testRunner)
                 testRunner.dumpAsText();
 
@@ -25,6 +47,11 @@
 
             var nodeList = testingGround.childNodes;
 
+            shouldBeTrue('nodeList.entries === entriesFunction');
+            shouldBeTrue('nodeList.forEach === forEachFunction');
+            shouldBeTrue('nodeList.keys === keysFunction');
+            shouldBeTrue('nodeList.values === valuesFunction');
+
             shouldBe("nodeList.length", "2");
 
             var index = 0;
@@ -63,8 +90,8 @@
             }, givenThisValue);
 
             var iterator = nodeList.keys();
-            shouldBe('iterator.next().value', 'children[0]');
-            shouldBe('iterator.next().value', 'children[1]');
+            shouldBe('iterator.next().value', '0');
+            shouldBe('iterator.next().value', '1');
             checkEndIterator(iterator.next());
 
             var iterator = nodeList.values();
@@ -92,7 +119,7 @@
             shouldBeTrue('descriptor.writable');
             shouldBeFalse('descriptor.enumerable');
 
-            shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');
+            shouldNotThrow('NodeList.prototype[Symbol.iterator] = valuesFunction;');
             var counter = 0;
             for (var a of nodeList) {
                 shouldBeTrue('a instanceof Node');

Modified: trunk/Source/_javascript_Core/ChangeLog (203221 => 203222)


--- trunk/Source/_javascript_Core/ChangeLog	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1,3 +1,15 @@
+2016-07-14  Youenn Fablet  <[email protected]>
+
+        DOM value iterable interfaces should use Array prototype methods
+        https://bugs.webkit.org/show_bug.cgi?id=159296
+
+        Reviewed by Chris Dumez and Mark Lam.
+
+        * _javascript_Core.xcodeproj/project.pbxproj: Marking some header files as private so that they can be included in
+        WebCore.
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation): copying iterable methods (entries, forEach, keys and values) to private slots.
+
 2016-07-13  Csaba Osztrogonác  <[email protected]>
 
         Fix the magic numbers for ARM traditional in InlineAccess.h

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (203221 => 203222)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1716,7 +1716,7 @@
 		A74DEF95182D991400522C22 /* JSMapIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74DEF8F182D991400522C22 /* JSMapIterator.cpp */; };
 		A74DEF96182D991400522C22 /* JSMapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = A74DEF90182D991400522C22 /* JSMapIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */; };
-		A75EE9B218AAB7E200AAD043 /* BuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A75EE9B018AAB7E200AAD043 /* BuiltinNames.h */; };
+		A75EE9B218AAB7E200AAD043 /* BuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A75EE9B018AAB7E200AAD043 /* BuiltinNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A767B5B517A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A767B5B317A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.cpp */; };
 		A767B5B617A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = A767B5B417A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h */; };
@@ -1790,7 +1790,7 @@
 		A7D801A41880D66E0026C39B /* BuiltinExecutables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D801A11880D66E0026C39B /* BuiltinExecutables.cpp */; };
 		A7D801A51880D66E0026C39B /* BuiltinExecutables.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D801A21880D66E0026C39B /* BuiltinExecutables.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A7D801A81880D6A80026C39B /* JSCBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
-		A7D801A91880D6A80026C39B /* JSCBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D801A71880D6A80026C39B /* JSCBuiltins.h */; };
+		A7D801A91880D6A80026C39B /* JSCBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D801A71880D6A80026C39B /* JSCBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A7D89CF217A0B8CC00773AD8 /* DFGBasicBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE317A0B8CC00773AD8 /* DFGBasicBlock.cpp */; };
 		A7D89CF317A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE417A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp */; };
 		A7D89CF417A0B8CC00773AD8 /* DFGBlockInsertionSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D89CE517A0B8CC00773AD8 /* DFGBlockInsertionSet.h */; };

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (203221 => 203222)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2016-07-14 11:16:17 UTC (rev 203222)
@@ -118,7 +118,12 @@
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("findIndex", arrayPrototypeFindIndexCodeGenerator, DontEnum);
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("includes", arrayPrototypeIncludesCodeGenerator, DontEnum);
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("copyWithin", arrayPrototypeCopyWithinCodeGenerator, DontEnum);
-    
+
+    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), ReadOnly);
+    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().forEachPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().forEachPublicName()), ReadOnly);
+    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().keysPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().keysPublicName()), ReadOnly);
+    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().valuesPrivateName(), globalObject->arrayProtoValuesFunction(), ReadOnly);
+
     JSObject* unscopables = constructEmptyObject(globalObject->globalExec(), globalObject->nullPrototypeObjectStructure());
     const char* unscopableNames[] = {
         "copyWithin",

Modified: trunk/Source/WebCore/CMakeLists.txt (203221 => 203222)


--- trunk/Source/WebCore/CMakeLists.txt	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1096,6 +1096,7 @@
     bindings/js/JSCSSRuleCustom.cpp
     bindings/js/JSCSSRuleListCustom.cpp
     bindings/js/JSCSSStyleDeclarationCustom.cpp
+    bindings/js/JSDOMIterator.cpp
     bindings/js/JSFontFaceCustom.cpp
     bindings/js/JSFontFaceSetCustom.cpp
     bindings/js/JSCSSValueCustom.cpp

Modified: trunk/Source/WebCore/ChangeLog (203221 => 203222)


--- trunk/Source/WebCore/ChangeLog	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/ChangeLog	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1,5 +1,53 @@
 2016-07-14  Youenn Fablet  <[email protected]>
 
+        DOM value iterable interfaces should use Array prototype methods
+        https://bugs.webkit.org/show_bug.cgi?id=159296
+
+        Reviewed by Chris Dumez and Mark Lam.
+
+        Test: fast/dom/NodeList/nodelist-iterable.html
+        Also covered by updated layout test and binding tests.
+
+        For value iterators, copy the iterator methods from Array prototype: as per https://heycam.github.io/webidl/#es-iterable,
+        [re: entries] If the interface has a value iterator, then the Function object is the initial value of the "entries" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
+        [re: keys] If the interface has a value iterator, then the Function object is the initial value of the "keys" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
+        [re: forEach] If the interface defines an indexed property getter, then the Function object is the initial value of the "forEach" data property of %ArrayPrototype% ([ECMA-262], section 6.1.7.4).
+        [re: Symbol.iterator] If the interface defines an indexed property getter, then the Function object is %ArrayProto_values% ([ECMA-262], section 6.1.7.4).
+        [re: values] If the interface has a value iterator, then the Function object is the value of the @@iterator property.
+
+        This change applies only to NodeList at the moment.
+        Copy of Array prototype iterator methods is disabled if the interface has no indexed getter.
+
+        * CMakeLists.txt:
+        * ForwardingHeaders/builtins/BuiltinNames.h: Added.
+        * ForwardingHeaders/builtins/JSCBuiltins.h: Added.
+        * ForwardingHeaders/runtime/CommonIdentifiers.h: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMIterator.cpp: Added.
+        (WebCore::addValueIterableMethods): Copy iterator methods from array prototype.
+        * bindings/js/JSDOMIterator.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GeneratePropertiesHashTable):
+        (GenerateImplementation):
+        (IsValueIterableInterface): Introduced to only copy iterator methods if the interface has an indexed getter.
+        (IsKeyValueIterableInterface): Introduced to detect whether generating iterator methods.
+        (GenerateImplementationIterableFunctions):
+        * bindings/scripts/test/GObject/WebKitDOMTestIterable.cpp: Added.
+        * bindings/scripts/test/GObject/WebKitDOMTestIterable.h: Added.
+        * bindings/scripts/test/GObject/WebKitDOMTestIterablePrivate.h: Added.
+        * bindings/scripts/test/JS/JSTestIterable.cpp: Added.
+        * bindings/scripts/test/JS/JSTestIterable.h: Added.
+        * bindings/scripts/test/JS/JSTestObj.cpp: Updated as TestObj defines both iterable<> and indexed getter.
+        * bindings/scripts/test/ObjC/DOMTestIterable.h: Added.
+        * bindings/scripts/test/ObjC/DOMTestIterable.mm: Added.
+        * bindings/scripts/test/ObjC/DOMTestIterableInternal.h: Added.
+        * bindings/scripts/test/TestIterable.idl: Added to handle the case of value iterator without indexed getter defined.
+        Array prototype methods should not be copied.
+        * bindings/scripts/test/TestObj.idl: Changing to be a value iterator (with indexed getter already defined).
+        Array prototype methods should be copied.
+
+2016-07-14  Youenn Fablet  <[email protected]>
+
         [Fetch API] Request and Response url getter should use URL serialization
         https://bugs.webkit.org/show_bug.cgi?id=159705
 

Added: trunk/Source/WebCore/ForwardingHeaders/builtins/BuiltinNames.h (0 => 203222)


--- trunk/Source/WebCore/ForwardingHeaders/builtins/BuiltinNames.h	                        (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/builtins/BuiltinNames.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,2 @@
+#pragma once
+#include <_javascript_Core/BuiltinNames.h>

Added: trunk/Source/WebCore/ForwardingHeaders/builtins/JSCBuiltins.h (0 => 203222)


--- trunk/Source/WebCore/ForwardingHeaders/builtins/JSCBuiltins.h	                        (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/builtins/JSCBuiltins.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,2 @@
+#pragma once
+#include <_javascript_Core/JSCBuiltins.h>

Added: trunk/Source/WebCore/ForwardingHeaders/runtime/CommonIdentifiers.h (0 => 203222)


--- trunk/Source/WebCore/ForwardingHeaders/runtime/CommonIdentifiers.h	                        (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/CommonIdentifiers.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,2 @@
+#pragma once
+#include <_javascript_Core/CommonIdentifiers.h>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203221 => 203222)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1573,6 +1573,8 @@
 		413015D91C7B571400091C6F /* FetchResponseSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413015D51C7B570400091C6F /* FetchResponseSource.cpp */; };
 		4138D3351244054800323D33 /* EventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138D3331244054800323D33 /* EventContext.h */; };
 		4138D3361244054800323D33 /* EventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138D3341244054800323D33 /* EventContext.cpp */; };
+		4138F8571D253F08001CB61E /* JSDOMIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138F8551D253EEE001CB61E /* JSDOMIterator.cpp */; };
+		4138F8581D253F0E001CB61E /* JSDOMIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138F8561D253EEE001CB61E /* JSDOMIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C2C331BC29A7B0075204C /* JSDOMConstructor.h */; };
 		4147E2B71C89912C00A7E715 /* FetchLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4147E2B41C89912600A7E715 /* FetchLoader.cpp */; };
 		4147E2B81C89912F00A7E715 /* FetchBodyOwner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4147E2B31C89912600A7E715 /* FetchBodyOwner.cpp */; };
@@ -9133,6 +9135,8 @@
 		413015D81C7B570400091C6E /* FetchResponse.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = FetchResponse.js; sourceTree = "<group>"; };
 		4138D3331244054800323D33 /* EventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventContext.h; sourceTree = "<group>"; };
 		4138D3341244054800323D33 /* EventContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventContext.cpp; sourceTree = "<group>"; };
+		4138F8551D253EEE001CB61E /* JSDOMIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMIterator.cpp; sourceTree = "<group>"; };
+		4138F8561D253EEE001CB61E /* JSDOMIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMIterator.h; sourceTree = "<group>"; };
 		413C2C331BC29A7B0075204C /* JSDOMConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConstructor.h; sourceTree = "<group>"; };
 		4147E2B21C88337F00A7E715 /* FetchBodyOwner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodyOwner.h; sourceTree = "<group>"; };
 		4147E2B31C89912600A7E715 /* FetchBodyOwner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBodyOwner.cpp; sourceTree = "<group>"; };
@@ -22513,6 +22517,8 @@
 				E1C36C020EB076D6007410BC /* JSDOMGlobalObject.h */,
 				7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */,
 				7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */,
+				4138F8551D253EEE001CB61E /* JSDOMIterator.cpp */,
+				4138F8561D253EEE001CB61E /* JSDOMIterator.h */,
 				46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */,
 				E172AF8D1811BC3700FBADB9 /* JSDOMPromise.cpp */,
 				E172AF8E1811BC3700FBADB9 /* JSDOMPromise.h */,
@@ -26903,6 +26909,7 @@
 				938E65F109F09840008A48EC /* JSHTMLElementWrapperFactory.h in Headers */,
 				BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */,
 				1AE2AA270A1CDAB400B42B25 /* JSHTMLFieldSetElement.h in Headers */,
+				4138F8581D253F0E001CB61E /* JSDOMIterator.h in Headers */,
 				1AE2AA290A1CDAB400B42B25 /* JSHTMLFontElement.h in Headers */,
 				9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */,
 				A8D064FC0A23C0CC005E7203 /* JSHTMLFormElement.h in Headers */,
@@ -30810,6 +30817,7 @@
 				BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */,
 				7C91A38F1B498ABE003F9EFA /* JSNodeOrString.cpp in Sources */,
 				33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */,
+				4138F8571D253F08001CB61E /* JSDOMIterator.cpp in Sources */,
 				33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */,
 				31EC1E2814FF60EE00C94662 /* JSNotificationPermissionCallback.cpp in Sources */,
 				7E46F6FA1627A2CA00062223 /* JSOESElementIndexUint.cpp in Sources */,

Added: trunk/Source/WebCore/bindings/js/JSDOMIterator.cpp (0 => 203222)


--- trunk/Source/WebCore/bindings/js/JSDOMIterator.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMIterator.cpp	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 Apple, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSDOMIterator.h"
+
+#include <builtins/BuiltinNames.h>
+#include <runtime/ArrayPrototype.h>
+
+namespace WebCore {
+
+void addValueIterableMethods(JSC::JSGlobalObject& globalObject, JSC::JSObject& prototype)
+{
+    JSC::ArrayPrototype* arrayPrototype = globalObject.arrayPrototype();
+    ASSERT(arrayPrototype);
+
+    JSC::ExecState* state = globalObject.globalExec();
+    ASSERT(state);
+    JSC::VM& vm = state->vm();
+
+    auto copyProperty = [&] (const JSC::Identifier& arrayIdentifier, const JSC::Identifier& otherIdentifier, unsigned attributes = 0) {
+        JSC::JSValue value = arrayPrototype->getDirect(vm, arrayIdentifier);
+        ASSERT(value);
+        prototype.putDirect(vm, otherIdentifier, value, attributes);
+    };
+
+    copyProperty(vm.propertyNames->builtinNames().entriesPrivateName(), vm.propertyNames->builtinNames().entriesPublicName());
+    copyProperty(vm.propertyNames->builtinNames().forEachPrivateName(), vm.propertyNames->builtinNames().forEachPublicName());
+    copyProperty(vm.propertyNames->builtinNames().keysPrivateName(), vm.propertyNames->builtinNames().keysPublicName());
+    copyProperty(vm.propertyNames->builtinNames().valuesPrivateName(), vm.propertyNames->builtinNames().valuesPublicName());
+    copyProperty(vm.propertyNames->builtinNames().valuesPrivateName(), vm.propertyNames->builtinNames().iteratorSymbol(), JSC::DontEnum);
+}
+
+}

Modified: trunk/Source/WebCore/bindings/js/JSDOMIterator.h (203221 => 203222)


--- trunk/Source/WebCore/bindings/js/JSDOMIterator.h	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/bindings/js/JSDOMIterator.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -32,6 +32,8 @@
 
 namespace WebCore {
 
+void addValueIterableMethods(JSC::JSGlobalObject&, JSC::JSObject&);
+
 template<typename JSWrapper>
 class JSDOMIteratorPrototype : public JSC::JSNonFinalObject {
 public:

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (203221 => 203222)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-07-14 11:16:17 UTC (rev 203222)
@@ -1616,7 +1616,7 @@
     }
 
     my @functions = @{$interface->functions};
-    push(@functions, @{$interface->iterable->functions}) if $interface->iterable;
+    push(@functions, @{$interface->iterable->functions}) if IsKeyValueIterableInterface($interface);
     foreach my $function (@functions) {
         next if ($function->signature->extendedAttributes->{"PrivateIdentifier"} and not $function->signature->extendedAttributes->{"PublicIdentifier"});
         next if ($function->isStatic);
@@ -2043,7 +2043,7 @@
     push(@implContent, GenerateDictionaryImplementationContent($interface, $dictionaries));
 
     my @functions = @{$interface->functions};
-    push(@functions, @{$interface->iterable->functions}) if $interface->iterable;
+    push(@functions, @{$interface->iterable->functions}) if IsKeyValueIterableInterface($interface);
 
     my $numConstants = @{$interface->constants};
     my $numFunctions = @functions;
@@ -4205,6 +4205,24 @@
     }
 }
 
+sub IsValueIterableInterface
+{
+    my $interface = shift;
+    return 0 unless $interface->iterable;
+    return 0 if length $interface->iterable->keyType;
+    # FIXME: See https://webkit.org/b/159140, we should die if the next check is false.
+    return 0 unless GetIndexedGetterFunction($interface);
+    return 1;
+}
+
+sub IsKeyValueIterableInterface
+{
+    my $interface = shift;
+    return 0 unless $interface->iterable;
+    return 0 if IsValueIterableInterface($interface);
+    return 1;
+}
+
 sub GenerateImplementationIterableFunctions
 {
     my $interface = shift;
@@ -4215,6 +4233,8 @@
 
     AddToImplIncludes("JSDOMIterator.h");
 
+    return unless IsKeyValueIterableInterface($interface);
+
     push(@implContent,  <<END);
 using ${interfaceName}Iterator = JSDOMIterator<${className}>;
 using ${interfaceName}IteratorPrototype = JSDOMIteratorPrototype<${className}>;
@@ -4266,8 +4286,12 @@
         push(@implContent, "    if (${enable_function}()) {\n    ");
     }
 
-    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), DontEnum);\n");
+    if (IsKeyValueIterableInterface($interface)) {
+        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), DontEnum);\n");
+    } else {
+        push(@implContent, "    addValueIterableMethods(*globalObject(), *this);\n");
+    }
 
     if ($interface->iterable->extendedAttributes->{"EnabledAtRuntime"}) {
         push(@implContent, "    }\n");

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.cpp (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.cpp	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,104 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDOMTestIterable.h"
+
+#include "CSSImportRule.h"
+#include "DOMObjectCache.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "ExceptionCodeDescription.h"
+#include "JSMainThreadExecState.h"
+#include "WebKitDOMPrivate.h"
+#include "WebKitDOMTestIterablePrivate.h"
+#include "gobject/ConvertToUTF8String.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_TEST_ITERABLE_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_ITERABLE, WebKitDOMTestIterablePrivate)
+
+typedef struct _WebKitDOMTestIterablePrivate {
+    RefPtr<WebCore::TestIterable> coreObject;
+} WebKitDOMTestIterablePrivate;
+
+namespace WebKit {
+
+WebKitDOMTestIterable* kit(WebCore::TestIterable* obj)
+{
+    if (!obj)
+        return 0;
+
+    if (gpointer ret = DOMObjectCache::get(obj))
+        return WEBKIT_DOM_TEST_ITERABLE(ret);
+
+    return wrapTestIterable(obj);
+}
+
+WebCore::TestIterable* core(WebKitDOMTestIterable* request)
+{
+    return request ? static_cast<WebCore::TestIterable*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
+}
+
+WebKitDOMTestIterable* wrapTestIterable(WebCore::TestIterable* coreObject)
+{
+    ASSERT(coreObject);
+    return WEBKIT_DOM_TEST_ITERABLE(g_object_new(WEBKIT_DOM_TYPE_TEST_ITERABLE, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+G_DEFINE_TYPE(WebKitDOMTestIterable, webkit_dom_test_iterable, WEBKIT_DOM_TYPE_OBJECT)
+
+static void webkit_dom_test_iterable_finalize(GObject* object)
+{
+    WebKitDOMTestIterablePrivate* priv = WEBKIT_DOM_TEST_ITERABLE_GET_PRIVATE(object);
+
+    WebKit::DOMObjectCache::forget(priv->coreObject.get());
+
+    priv->~WebKitDOMTestIterablePrivate();
+    G_OBJECT_CLASS(webkit_dom_test_iterable_parent_class)->finalize(object);
+}
+
+static GObject* webkit_dom_test_iterable_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
+{
+    GObject* object = G_OBJECT_CLASS(webkit_dom_test_iterable_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
+
+    WebKitDOMTestIterablePrivate* priv = WEBKIT_DOM_TEST_ITERABLE_GET_PRIVATE(object);
+    priv->coreObject = static_cast<WebCore::TestIterable*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+    WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+
+    return object;
+}
+
+static void webkit_dom_test_iterable_class_init(WebKitDOMTestIterableClass* requestClass)
+{
+    GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+    g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestIterablePrivate));
+    gobjectClass->constructor = webkit_dom_test_iterable_constructor;
+    gobjectClass->finalize = webkit_dom_test_iterable_finalize;
+}
+
+static void webkit_dom_test_iterable_init(WebKitDOMTestIterable* request)
+{
+    WebKitDOMTestIterablePrivate* priv = WEBKIT_DOM_TEST_ITERABLE_GET_PRIVATE(request);
+    new (priv) WebKitDOMTestIterablePrivate();
+}
+

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.h (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterable.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,53 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestIterable_h
+#define WebKitDOMTestIterable_h
+
+#ifdef WEBKIT_DOM_USE_UNSTABLE_API
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines-unstable.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_TEST_ITERABLE            (webkit_dom_test_iterable_get_type())
+#define WEBKIT_DOM_TEST_ITERABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_TEST_ITERABLE, WebKitDOMTestIterable))
+#define WEBKIT_DOM_TEST_ITERABLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_DOM_TYPE_TEST_ITERABLE, WebKitDOMTestIterableClass)
+#define WEBKIT_DOM_IS_TEST_ITERABLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_TEST_ITERABLE))
+#define WEBKIT_DOM_IS_TEST_ITERABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_DOM_TYPE_TEST_ITERABLE))
+#define WEBKIT_DOM_TEST_ITERABLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_DOM_TYPE_TEST_ITERABLE, WebKitDOMTestIterableClass))
+
+struct _WebKitDOMTestIterable {
+    WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMTestIterableClass {
+    WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_test_iterable_get_type(void);
+
+G_END_DECLS
+
+#endif /* WEBKIT_DOM_USE_UNSTABLE_API */
+#endif /* WebKitDOMTestIterable_h */

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterablePrivate.h (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterablePrivate.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestIterablePrivate.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,33 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestIterablePrivate_h
+#define WebKitDOMTestIterablePrivate_h
+
+#include "TestIterable.h"
+#include <webkitdom/WebKitDOMTestIterable.h>
+
+namespace WebKit {
+WebKitDOMTestIterable* wrapTestIterable(WebCore::TestIterable*);
+WebKitDOMTestIterable* kit(WebCore::TestIterable*);
+WebCore::TestIterable* core(WebKitDOMTestIterable*);
+} // namespace WebKit
+
+#endif /* WebKitDOMTestIterablePrivate_h */

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,250 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestIterable.h"
+
+#include "JSDOMBinding.h"
+#include "JSDOMConstructor.h"
+#include "JSDOMIterator.h"
+#include <runtime/FunctionPrototype.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Functions
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionSymbolIterator(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionEntries(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionKeys(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionValues(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionForEach(JSC::ExecState*);
+
+// Attributes
+
+JSC::EncodedJSValue jsTestIterableConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestIterableConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSTestIterablePrototype : public JSC::JSNonFinalObject {
+public:
+    typedef JSC::JSNonFinalObject Base;
+    static JSTestIterablePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestIterablePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestIterablePrototype>(vm.heap)) JSTestIterablePrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSTestIterablePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+
+typedef JSDOMConstructorNotConstructable<JSTestIterable> JSTestIterableConstructor;
+
+template<> JSValue JSTestIterableConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestIterableConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestIterable::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestIterable"))), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestIterableConstructor::s_info = { "TestIterable", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestIterableConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestIterablePrototypeTableValues[] =
+{
+    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestIterableConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestIterableConstructor) } },
+    { "entries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestIterablePrototypeFunctionEntries), (intptr_t) (0) } },
+    { "keys", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestIterablePrototypeFunctionKeys), (intptr_t) (0) } },
+    { "values", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestIterablePrototypeFunctionValues), (intptr_t) (0) } },
+    { "forEach", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestIterablePrototypeFunctionForEach), (intptr_t) (1) } },
+};
+
+const ClassInfo JSTestIterablePrototype::s_info = { "TestIterablePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestIterablePrototype) };
+
+void JSTestIterablePrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestIterablePrototypeTableValues, *this);
+    putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestIterablePrototypeFunctionSymbolIterator), DontEnum);
+}
+
+const ClassInfo JSTestIterable::s_info = { "TestIterable", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestIterable) };
+
+JSTestIterable::JSTestIterable(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestIterable>&& impl)
+    : JSDOMWrapper<TestIterable>(structure, globalObject, WTFMove(impl))
+{
+}
+
+JSObject* JSTestIterable::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return JSTestIterablePrototype::create(vm, globalObject, JSTestIterablePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+JSObject* JSTestIterable::prototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return getDOMPrototype<JSTestIterable>(vm, globalObject);
+}
+
+void JSTestIterable::destroy(JSC::JSCell* cell)
+{
+    JSTestIterable* thisObject = static_cast<JSTestIterable*>(cell);
+    thisObject->JSTestIterable::~JSTestIterable();
+}
+
+EncodedJSValue jsTestIterableConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    JSTestIterablePrototype* domObject = jsDynamicCast<JSTestIterablePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject))
+        return throwVMTypeError(state);
+    return JSValue::encode(JSTestIterable::getConstructor(state->vm(), domObject->globalObject()));
+}
+
+bool setJSTestIterableConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    JSValue value = JSValue::decode(encodedValue);
+    JSTestIterablePrototype* domObject = jsDynamicCast<JSTestIterablePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    // Shadowing a built-in constructor
+    return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
+}
+
+JSValue JSTestIterable::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestIterableConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+using TestIterableIterator = JSDOMIterator<JSTestIterable>;
+using TestIterableIteratorPrototype = JSDOMIteratorPrototype<JSTestIterable>;
+
+template<>
+const JSC::ClassInfo TestIterableIterator::s_info = { "TestIterable Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestIterableIterator) };
+
+template<>
+const JSC::ClassInfo TestIterableIteratorPrototype::s_info = { "TestIterable Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestIterableIteratorPrototype) };
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionSymbolIterator(JSC::ExecState* state)
+{
+    return iteratorCreate<JSTestIterable>(*state, IterationKind::Value, "[Symbol.Iterator]");
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionEntries(JSC::ExecState* state)
+{
+    return iteratorCreate<JSTestIterable>(*state, IterationKind::KeyValue, "entries");
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionKeys(JSC::ExecState* state)
+{
+    return iteratorCreate<JSTestIterable>(*state, IterationKind::Key, "keys");
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionValues(JSC::ExecState* state)
+{
+    return iteratorCreate<JSTestIterable>(*state, IterationKind::Value, "values");
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestIterablePrototypeFunctionForEach(JSC::ExecState* state)
+{
+    return iteratorForEach<JSTestIterable>(*state, "forEach");
+}
+
+bool JSTestIterableOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    return false;
+}
+
+void JSTestIterableOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestIterable = jsCast<JSTestIterable*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestIterable->wrapped(), jsTestIterable);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestIterable@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore12TestIterableE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestIterable>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestIterable@WebCore@@6B@"));
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore12TestIterableE[2];
+#if COMPILER(CLANG)
+    // If this fails TestIterable does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(__is_polymorphic(TestIterable), "TestIterable is not polymorphic");
+#endif
+#endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestIterable has subclasses. If TestIterable has subclasses that get passed
+    // to toJS() we currently require TestIterable you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    return createWrapper<JSTestIterable, TestIterable>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIterable& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
+TestIterable* JSTestIterable::toWrapped(JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicCast<JSTestIterable*>(value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.h (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,86 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "JSDOMWrapper.h"
+#include "TestIterable.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestIterable : public JSDOMWrapper<TestIterable> {
+public:
+    typedef JSDOMWrapper<TestIterable> Base;
+    static JSTestIterable* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestIterable>&& impl)
+    {
+        JSTestIterable* ptr = new (NotNull, JSC::allocateCell<JSTestIterable>(globalObject->vm().heap)) JSTestIterable(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+    static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
+    static TestIterable* toWrapped(JSC::JSValue);
+    static void destroy(JSC::JSCell*);
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+protected:
+    JSTestIterable(JSC::Structure*, JSDOMGlobalObject&, Ref<TestIterable>&&);
+
+    void finishCreation(JSC::VM& vm)
+    {
+        Base::finishCreation(vm);
+        ASSERT(inherits(info()));
+    }
+
+};
+
+class JSTestIterableOwner : public JSC::WeakHandleOwner {
+public:
+    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
+    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestIterable*)
+{
+    static NeverDestroyed<JSTestIterableOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(TestIterable* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestIterable&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIterable* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestIterable>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestIterable>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+
+} // namespace WebCore

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-07-14 11:16:17 UTC (rev 203222)
@@ -707,11 +707,6 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSymbolIterator(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEntries(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionKeys(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionValues(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionForEach(JSC::ExecState*);
 
 // Attributes
 
@@ -1285,10 +1280,6 @@
     { "testPromiseOverloadedFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
     { "methodWithNeedsLifecycleProcessingStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack), (intptr_t) (0) } },
     { "attachShadowRoot", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
-    { "entries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionEntries), (intptr_t) (0) } },
-    { "keys", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionKeys), (intptr_t) (0) } },
-    { "values", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionValues), (intptr_t) (0) } },
-    { "forEach", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionForEach), (intptr_t) (1) } },
 #if ENABLE(Condition1)
     { "CONDITIONAL_CONST", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
 #else
@@ -1321,26 +1312,6 @@
         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
     }
 #endif
-    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
-        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("entries"), strlen("entries"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
-    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
-        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("keys"), strlen("keys"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
-    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
-        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("values"), strlen("values"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
-    if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
-        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("forEach"), strlen("forEach"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
 #if ENABLE(TEST_FEATURE)
     if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
         Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttribute"), strlen("enabledAtRuntimeAttribute"));
@@ -1352,7 +1323,7 @@
     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);
     if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
-        putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral("[Symbol.Iterator]"), jsTestObjPrototypeFunctionSymbolIterator), DontEnum);
+        addValueIterableMethods(*globalObject(), *this);
     }
 }
 
@@ -6259,40 +6230,6 @@
     return JSValue::encode(jsUndefined());
 }
 
-using TestObjIterator = JSDOMIterator<JSTestObj>;
-using TestObjIteratorPrototype = JSDOMIteratorPrototype<JSTestObj>;
-
-template<>
-const JSC::ClassInfo TestObjIterator::s_info = { "TestObject Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestObjIterator) };
-
-template<>
-const JSC::ClassInfo TestObjIteratorPrototype::s_info = { "TestObject Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestObjIteratorPrototype) };
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSymbolIterator(JSC::ExecState* state)
-{
-    return iteratorCreate<JSTestObj>(*state, IterationKind::KeyValue, "[Symbol.Iterator]");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEntries(JSC::ExecState* state)
-{
-    return iteratorCreate<JSTestObj>(*state, IterationKind::KeyValue, "entries");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionKeys(JSC::ExecState* state)
-{
-    return iteratorCreate<JSTestObj>(*state, IterationKind::Key, "keys");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionValues(JSC::ExecState* state)
-{
-    return iteratorCreate<JSTestObj>(*state, IterationKind::Value, "values");
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionForEach(JSC::ExecState* state)
-{
-    return iteratorForEach<JSTestObj>(*state, "forEach");
-}
-
 void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     auto* thisObject = jsCast<JSTestObj*>(cell);

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.h (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <[email protected]>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <WebCore/DOMObject.h>
+
+WEBKIT_CLASS_AVAILABLE_MAC(9876_5)
+WEBCORE_EXPORT @interface DOMTestIterable : DOMObject
+@end

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.mm (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.mm	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterable.mm	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "config.h"
+#import "DOMInternal.h"
+
+#import "DOMTestIterable.h"
+
+#import "DOMNodeInternal.h"
+#import "DOMTestIterableInternal.h"
+#import "ExceptionHandlers.h"
+#import "JSMainThreadExecState.h"
+#import "TestIterable.h"
+#import "ThreadCheck.h"
+#import "WebCoreObjCExtras.h"
+#import "WebScriptObjectPrivate.h"
+#import <wtf/GetPtr.h>
+
+#define IMPL reinterpret_cast<WebCore::TestIterable*>(_internal)
+
+@implementation DOMTestIterable
+
+- (void)dealloc
+{
+    if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestIterable class], self))
+        return;
+
+    if (_internal)
+        IMPL->deref();
+    [super dealloc];
+}
+
+@end
+
+WebCore::TestIterable* core(DOMTestIterable *wrapper)
+{
+    return wrapper ? reinterpret_cast<WebCore::TestIterable*>(wrapper->_internal) : 0;
+}
+
+DOMTestIterable *kit(WebCore::TestIterable* value)
+{
+    WebCoreThreadViolationCheckRoundOne();
+    if (!value)
+        return nil;
+    if (DOMTestIterable *wrapper = getDOMWrapper(value))
+        return [[wrapper retain] autorelease];
+    DOMTestIterable *wrapper = [[DOMTestIterable alloc] _init];
+    wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value);
+    value->ref();
+    addDOMWrapper(wrapper, value);
+    return [wrapper autorelease];
+}

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterableInternal.h (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterableInternal.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestIterableInternal.h	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <WebCore/DOMTestIterable.h>
+
+namespace WebCore {
+class TestIterable;
+}
+
+WEBCORE_EXPORT WebCore::TestIterable* core(DOMTestIterable *);
+WEBCORE_EXPORT DOMTestIterable *kit(WebCore::TestIterable*);

Added: trunk/Source/WebCore/bindings/scripts/test/TestIterable.idl (0 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/TestIterable.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestIterable.idl	2016-07-14 11:16:17 UTC (rev 203222)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Apple, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+interface TestIterable {
+    iterable<TestNode>;
+};
+

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (203221 => 203222)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-07-14 10:14:53 UTC (rev 203221)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-07-14 11:16:17 UTC (rev 203222)
@@ -95,7 +95,7 @@
     // TypedArray attribute
     attribute Float32Array typedArrayAttr;
 
-    [EnabledAtRuntime=DOMIterator] iterable<DOMString, TestObj>;
+    [EnabledAtRuntime=DOMIterator] iterable<DOMString>;
 
     // Methods
     void    voidMethod();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to