<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203728] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203728">203728</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-26 11:00:57 -0700 (Tue, 26 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>DOMTokenList should be iterable
https://bugs.webkit.org/show_bug.cgi?id=160183

Patch by Youenn Fablet &lt;youenn@apple.com&gt; on 2016-07-26
Reviewed by Chris Dumez.

Source/WebCore:

DOMTokenList should be iterable as per https://dom.spec.whatwg.org/#interface-domtokenlist

Test: fast/dom/domTokenListIterator.html

* html/DOMTokenList.idl: Added iterable to the interface description.

LayoutTests:

* fast/dom/domTokenListIterator-expected.txt: Added.
* fast/dom/domTokenListIterator.html: Added.
* fast/dom/iterable-tests.js: Added.
* fast/dom/nodeListIterator-expected.txt:
* fast/dom/nodeListIterator.html: Making use of iterable-tests.js</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomnodeListIteratorexpectedtxt">trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomnodeListIteratorhtml">trunk/LayoutTests/fast/dom/nodeListIterator.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListidl">trunk/Source/WebCore/html/DOMTokenList.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomdomTokenListIteratorexpectedtxt">trunk/LayoutTests/fast/dom/domTokenListIterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdomTokenListIteratorhtml">trunk/LayoutTests/fast/dom/domTokenListIterator.html</a></li>
<li><a href="#trunkLayoutTestsfastdomiterabletestsjs">trunk/LayoutTests/fast/dom/iterable-tests.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203727 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-26 17:26:28 UTC (rev 203727)
+++ trunk/LayoutTests/ChangeLog        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-07-26  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        DOMTokenList should be iterable
+        https://bugs.webkit.org/show_bug.cgi?id=160183
+
+        Reviewed by Chris Dumez.
+
+        * fast/dom/domTokenListIterator-expected.txt: Added.
+        * fast/dom/domTokenListIterator.html: Added.
+        * fast/dom/iterable-tests.js: Added.
+        * fast/dom/nodeListIterator-expected.txt:
+        * fast/dom/nodeListIterator.html: Making use of iterable-tests.js
+
</ins><span class="cx"> 2016-07-26  John Wilander  &lt;wilander@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Stop supporting compressed character sets BOCU-1 and SCSU
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdomTokenListIteratorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/domTokenListIterator-expected.txt (0 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/domTokenListIterator-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/domTokenListIterator-expected.txt        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+Testing of DOMTokenList iterable capacities.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS testedIterable.entries is entriesFunction
+PASS testedIterable.forEach is forEachFunction
+PASS testedIterable.keys is keysFunction
+PASS testedIterable.values is valuesFunction
+PASS testedIterable.length is 2
+PASS item is children[index++]
+PASS item is children[index++]
+PASS pair[0] is children[0]
+PASS pair[1] is children[1]
+PASS forEachContainer is testedIterable
+PASS forEachIndex is index
+PASS node is children[index++]
+PASS thisValue is window
+PASS forEachContainer is testedIterable
+PASS forEachIndex is index
+PASS node is children[index++]
+PASS thisValue is window
+PASS thisValue is window
+PASS thisValue is window
+PASS thisValue is givenThisValue
+PASS thisValue is givenThisValue
+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]
+PASS iterator.next().value is children[1]
+PASS end.done is true
+PASS end.value is undefined.
+PASS pair.length is 2
+PASS pair[0] is 0
+PASS pair[1] is children[0]
+PASS pair.length is 2
+PASS pair[0] is 1
+PASS pair[1] is children[1]
+PASS end.done is true
+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 testedIterablePrototype[Symbol.iterator] = valuesFunction; did not throw exception.
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
+PASS counter is 4
+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS counter is 4
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS counter is 4
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS counter is 4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdomTokenListIteratorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/domTokenListIterator.html (0 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/domTokenListIterator.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/domTokenListIterator.html        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;title class=&quot;a b&quot;&gt;Testing of DOMTokenList iterable capacities&lt;/title&gt;
+        &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script&gt;
+            description('Testing of DOMTokenList iterable capacities.');
+
+            var testingGround = document.getElementsByTagName('title')[0];
+            var classList = testingGround.classList;
+
+            function checkItemType(item) {
+                return typeof item === 'string';
+            }
+            function createIterable(items) {
+                items.push(classList[0]);
+                items.push(classList[1]);
+                return classList;
+            }
+            function updateIterable() {
+                testingGround.setAttribute(&quot;class&quot;, &quot;a b c d&quot;);
+            }
+          &lt;/script&gt;
+        &lt;script src=&quot;iterable-tests.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomiterabletestsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/iterable-tests.js (0 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/iterable-tests.js                                (rev 0)
+++ trunk/LayoutTests/fast/dom/iterable-tests.js        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -0,0 +1,136 @@
</span><ins>+// Modifying Array prototype to ensure this does not impact iterable methods.
+var entriesFunction = Array.prototype.entries;
+Array.prototype.entries = function() {
+    console.log(&quot;Array.prototype.entries called&quot;);
+  return entriesFunction.apply(this, arguments);
+}
+var forEachFunction = Array.prototype.forEach;
+Array.prototype.forEach = function() {
+    console.log(&quot;Array.prototype.forEach called&quot;);
+  return forEachFunction.apply(this, arguments);
+}
+var keysFunction = Array.prototype.keys;
+Array.prototype.keys = function() {
+    console.log(&quot;Array.prototype.keys called&quot;);
+  return keysFunction.apply(this, arguments);
+}
+var valuesFunction = Array.prototype.values;
+Array.prototype.values = function() {
+    console.log(&quot;Array.prototype.values called&quot;);
+  return valuesFunction.apply(this, arguments);
+}
+
+var end;
+function checkEndIterator(iteratorValue) {
+  end = iteratorValue;
+  shouldBeTrue('end.done');
+  shouldBeUndefined('end.value');
+}
+
+// Should create an iterable with two items, put in children array
+var children = [];
+var testedIterable = createIterable(children);
+
+shouldBe('testedIterable.entries', 'entriesFunction');
+shouldBe('testedIterable.forEach', 'forEachFunction');
+shouldBe('testedIterable.keys', 'keysFunction');
+shouldBe('testedIterable.values', 'valuesFunction');
+
+shouldBe(&quot;testedIterable.length&quot;, &quot;2&quot;);
+
+var index = 0;
+for (var item of testedIterable)
+    shouldBe('item', 'children[index++]');
+
+pair = Array.from(testedIterable);
+shouldBe('pair[0]', 'children[0]');
+shouldBe('pair[1]', 'children[1]');
+
+index = 0;
+var node;
+var forEachIndex;
+var forEachContainer;
+var thisValue;
+testedIterable.forEach(function(n, i, c) {
+    node = n;
+    forEachIndex = i;
+    forEachContainer = c;
+    thisValue = this;
+    shouldBe('forEachContainer', 'testedIterable');
+    shouldBe('forEachIndex', 'index');
+    shouldBe('node', 'children[index++]');
+    shouldBe('thisValue', 'window');
+});
+
+testedIterable.forEach(function() {
+    thisValue = this;
+    shouldBe('thisValue', 'window');
+}, undefined);
+
+var givenThisValue = testedIterable;
+testedIterable.forEach(function() {
+    thisValue = this;
+    shouldBe('thisValue', 'givenThisValue');
+}, givenThisValue);
+
+var iterator = testedIterable.keys();
+shouldBe('iterator.next().value', '0');
+shouldBe('iterator.next().value', '1');
+checkEndIterator(iterator.next());
+
+var iterator = testedIterable.values();
+shouldBe('iterator.next().value', 'children[0]');
+shouldBe('iterator.next().value', 'children[1]');
+checkEndIterator(iterator.next());
+
+var iterator = testedIterable.entries();
+var pair = iterator.next().value;
+shouldBe('pair.length', '2');
+shouldBe('pair[0]', '0');
+shouldBe('pair[1]', 'children[0]');
+pair = iterator.next().value;
+shouldBe('pair.length', '2');
+shouldBe('pair[0]', '1');
+shouldBe('pair[1]', 'children[1]');
+checkEndIterator(iterator.next());
+
+// Should add 2 new items.
+updateIterable();
+
+checkEndIterator(iterator.next());
+
+var testedIterablePrototype = Object.getPrototypeOf(testedIterable)
+var descriptor = Object.getOwnPropertyDescriptor(testedIterablePrototype, Symbol.iterator);
+shouldBeTrue('descriptor.configurable');
+shouldBeTrue('descriptor.writable');
+shouldBeFalse('descriptor.enumerable');
+
+shouldNotThrow('testedIterablePrototype[Symbol.iterator] = valuesFunction;');
+var counter = 0;
+for (var a of testedIterable) {
+    shouldBeTrue('checkItemType(a)');
+    counter++;
+}
+shouldBe('counter', '4');
+counter = 0;
+for (var v of testedIterable.values()) {
+    shouldBeTrue('checkItemType(v)');
+    counter++;
+}
+shouldBe('counter', '4');
+
+counter = 0;
+for (var k of testedIterable.keys()) {
+    shouldBe('typeof k', '&quot;number&quot;');
+    counter++;
+}
+shouldBe('counter', '4');
+
+counter = 0;
+for (var e of testedIterable.entries()) {
+    shouldBe('typeof e[0]', '&quot;number&quot;');
+    shouldBe('e[1]', 'testedIterable[e[0]]');
+    counter++;
+}
+
+shouldBe('counter', '4');
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomnodeListIteratorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt (203727 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt        2016-07-26 17:26:28 UTC (rev 203727)
+++ trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -3,20 +3,20 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-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
</del><ins>+PASS testedIterable.entries is entriesFunction
+PASS testedIterable.forEach is forEachFunction
+PASS testedIterable.keys is keysFunction
+PASS testedIterable.values is valuesFunction
+PASS testedIterable.length is 2
</ins><span class="cx"> PASS item is children[index++]
</span><span class="cx"> PASS item is children[index++]
</span><span class="cx"> PASS pair[0] is children[0]
</span><span class="cx"> PASS pair[1] is children[1]
</span><del>-PASS forEachContainer is nodeList
</del><ins>+PASS forEachContainer is testedIterable
</ins><span class="cx"> PASS forEachIndex is index
</span><span class="cx"> PASS node is children[index++]
</span><span class="cx"> PASS thisValue is window
</span><del>-PASS forEachContainer is nodeList
</del><ins>+PASS forEachContainer is testedIterable
</ins><span class="cx"> PASS forEachIndex is index
</span><span class="cx"> PASS node is children[index++]
</span><span class="cx"> PASS thisValue is window
</span><span class="lines">@@ -27,11 +27,11 @@
</span><span class="cx"> PASS iterator.next().value is 0
</span><span class="cx"> PASS iterator.next().value is 1
</span><span class="cx"> PASS end.done is true
</span><del>-PASS end.value is undefined
</del><ins>+PASS end.value is undefined.
</ins><span class="cx"> PASS iterator.next().value is children[0]
</span><span class="cx"> PASS iterator.next().value is children[1]
</span><span class="cx"> PASS end.done is true
</span><del>-PASS end.value is undefined
</del><ins>+PASS end.value is undefined.
</ins><span class="cx"> PASS pair.length is 2
</span><span class="cx"> PASS pair[0] is 0
</span><span class="cx"> PASS pair[1] is children[0]
</span><span class="lines">@@ -39,18 +39,37 @@
</span><span class="cx"> PASS pair[0] is 1
</span><span class="cx"> PASS pair[1] is children[1]
</span><span class="cx"> PASS end.done is true
</span><del>-PASS end.value is undefined
</del><ins>+PASS end.value is undefined.
</ins><span class="cx"> PASS end.done is true
</span><del>-PASS end.value is undefined
</del><ins>+PASS end.value is undefined.
</ins><span class="cx"> PASS descriptor.configurable is true
</span><span class="cx"> PASS descriptor.writable is true
</span><span class="cx"> PASS descriptor.enumerable is false
</span><del>-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
-PASS a instanceof Node is true
</del><ins>+PASS testedIterablePrototype[Symbol.iterator] = valuesFunction; did not throw exception.
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
+PASS checkItemType(a) is true
</ins><span class="cx"> PASS counter is 4
</span><ins>+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS checkItemType(v) is true
+PASS counter is 4
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS typeof k is &quot;number&quot;
+PASS counter is 4
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS typeof e[0] is &quot;number&quot;
+PASS e[1] is testedIterable[e[0]]
+PASS counter is 4
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomnodeListIteratorhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/nodeListIterator.html (203727 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/nodeListIterator.html        2016-07-26 17:26:28 UTC (rev 203727)
+++ trunk/LayoutTests/fast/dom/nodeListIterator.html        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
</del><ins>+&lt;!DOCTYPE html&gt;
</ins><span class="cx"> &lt;html&gt;
</span><span class="cx">     &lt;head&gt;
</span><span class="cx">         &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</span><span class="lines">@@ -7,126 +7,28 @@
</span><span class="cx">         &lt;script&gt;
</span><span class="cx">             description('Testing of NodeList iterable capacities.');
</span><span class="cx"> 
</span><del>-            // Modifying Array prototype to ensure this does not impact NodeList iterable methods.
-            var entriesFunction = Array.prototype.entries;
-            Array.prototype.entries = function() {
-                console.log(&quot;Array.prototype.entries called&quot;);
-              return entriesFunction.apply(this, arguments);
-            }
-            var forEachFunction = Array.prototype.forEach;
-            Array.prototype.forEach = function() {
-                console.log(&quot;Array.prototype.forEach called&quot;);
-              return forEachFunction.apply(this, arguments);
-            }
-            var keysFunction = Array.prototype.keys;
-            Array.prototype.keys = function() {
-                console.log(&quot;Array.prototype.keys called&quot;);
-              return keysFunction.apply(this, arguments);
-            }
-            var valuesFunction = Array.prototype.values;
-            Array.prototype.values = function() {
-                console.log(&quot;Array.prototype.values called&quot;);
-              return valuesFunction.apply(this, arguments);
-            }
-
-            if (window.testRunner)
-                testRunner.dumpAsText();
-
-            var end;
-            function checkEndIterator(iteratorValue) {
-              end = iteratorValue;
-              shouldBe('end.done', 'true');
-              shouldBe('end.value', 'undefined');
-            }
-
</del><span class="cx">             var testingGround = document.createElement('div');
</span><del>-            var children = [document.createElement('div'), document.createElement('ol')];
-            testingGround.appendChild(children[0]);
-            testingGround.appendChild(children[1]);
</del><ins>+            var nodes = [document.createElement('div'), document.createElement('ol')];
+            testingGround.appendChild(nodes[0]);
+            testingGround.appendChild(nodes[1]);
</ins><span class="cx">             document.body.appendChild(testingGround);
</span><span class="cx"> 
</span><span class="cx">             var nodeList = testingGround.childNodes;
</span><span class="cx"> 
</span><del>-            shouldBeTrue('nodeList.entries === entriesFunction');
-            shouldBeTrue('nodeList.forEach === forEachFunction');
-            shouldBeTrue('nodeList.keys === keysFunction');
-            shouldBeTrue('nodeList.values === valuesFunction');
-
-            shouldBe(&quot;nodeList.length&quot;, &quot;2&quot;);
-
-            var index = 0;
-            for (var item of nodeList)
-                shouldBe('item', 'children[index++]');
-
-            pair = Array.from(nodeList);
-            shouldBe('pair[0]', 'children[0]');
-            shouldBe('pair[1]', 'children[1]');
-
-            index = 0;
-            var node;
-            var forEachIndex;
-            var forEachContainer;
-            var thisValue;
-            nodeList.forEach(function(n, i, c) {
-                node = n;
-                forEachIndex = i;
-                forEachContainer = c;
-                thisValue = this;
-                shouldBe('forEachContainer', 'nodeList');
-                shouldBe('forEachIndex', 'index');
-                shouldBe('node', 'children[index++]');
-                shouldBe('thisValue', 'window');
-            });
-
-            nodeList.forEach(function() {
-                thisValue = this;
-                shouldBe('thisValue', 'window');
-            }, undefined);
-
-            var givenThisValue = nodeList;
-            nodeList.forEach(function() {
-                thisValue = this;
-                shouldBe('thisValue', 'givenThisValue');
-            }, givenThisValue);
-
-            var iterator = nodeList.keys();
-            shouldBe('iterator.next().value', '0');
-            shouldBe('iterator.next().value', '1');
-            checkEndIterator(iterator.next());
-
-            var iterator = nodeList.values();
-            shouldBe('iterator.next().value', 'children[0]');
-            shouldBe('iterator.next().value', 'children[1]');
-            checkEndIterator(iterator.next());
-
-            var iterator = nodeList.entries();
-            var pair = iterator.next().value;
-            shouldBe('pair.length', '2');
-            shouldBe('pair[0]', '0');
-            shouldBe('pair[1]', 'children[0]');
-            pair = iterator.next().value;
-            shouldBe('pair.length', '2');
-            shouldBe('pair[0]', '1');
-            shouldBe('pair[1]', 'children[1]');
-            checkEndIterator(iterator.next());
-
-            testingGround.appendChild(document.createElement('ul'));
-            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] = valuesFunction;');
-            var counter = 0;
-            for (var a of nodeList) {
-                shouldBeTrue('a instanceof Node');
-                counter++;
</del><ins>+            function checkItemType(item) {
+                return item instanceof Node;
</ins><span class="cx">             }
</span><del>-            shouldBe('counter', '4');
</del><ins>+            function createIterable(items) {
+                items.push(nodes[0]);
+                items.push(nodes[1]);
+                return nodeList;
+            }
+            function updateIterable() {
+                testingGround.appendChild(document.createElement('ul'));
+                testingGround.appendChild(document.createElement('p'));
+            }
</ins><span class="cx">         &lt;/script&gt;
</span><ins>+        &lt;script src=&quot;iterable-tests.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">         &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203727 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-26 17:26:28 UTC (rev 203727)
+++ trunk/Source/WebCore/ChangeLog        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-07-26  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        DOMTokenList should be iterable
+        https://bugs.webkit.org/show_bug.cgi?id=160183
+
+        Reviewed by Chris Dumez.
+
+        DOMTokenList should be iterable as per https://dom.spec.whatwg.org/#interface-domtokenlist
+
+        Test: fast/dom/domTokenListIterator.html
+
+        * html/DOMTokenList.idl: Added iterable to the interface description.
+
</ins><span class="cx"> 2016-07-26  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r203719.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.idl (203727 => 203728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.idl        2016-07-26 17:26:28 UTC (rev 203727)
+++ trunk/Source/WebCore/html/DOMTokenList.idl        2016-07-26 18:00:57 UTC (rev 203728)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx">     [RaisesException] void remove(DOMString... tokens);
</span><span class="cx">     [RaisesException] boolean toggle(DOMString token, optional boolean force);
</span><span class="cx"> 
</span><ins>+    iterable&lt;DOMString&gt;;
+
</ins><span class="cx">     attribute DOMString value;
</span><span class="cx"> 
</span><span class="cx"> #if defined(LANGUAGE_JAVASCRIPT) &amp;&amp; LANGUAGE_JAVASCRIPT
</span></span></pre>
</div>
</div>

</body>
</html>