<!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>[211024] 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/211024">211024</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-01-21 21:48:28 -0800 (Sat, 21 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection)
https://bugs.webkit.org/show_bug.cgi?id=167091

Reviewed by Darin Adler.

Source/JavaScriptCore:

Update Array methods to throw a TypeError when (this === null || this === undefined)
instead of when (this == null). This is because (this == null) returns true for types
that masquerades as undefined (such as document.all) and this prevented use of the
Array API on such types. The specification only stays to use ToObject(), which throws
when the input is undefined or null.

The corresponding specification is at:
- https://www.ecma-international.org/ecma-262/7.0/index.html#sec-array.prototype.values
- https://www.ecma-international.org/ecma-262/7.0/index.html#sec-toobject

* builtins/ArrayPrototype.js:
(values):
(keys):
(entries):
(reduce):
(reduceRight):
(every):
(forEach):
(filter):
(map):
(some):
(fill):
(find):
(findIndex):
(includes):
(sort):
(concatSlowPath):
(copyWithin):

Source/WebCore:

As per the Web IDL specification [1], https://heycam.github.io/webidl/#es-iterator
an interface should get an iterator if it has:
- an indexed property getter and an integer-typed attribute named &quot;length&quot;.

We now comply with this part of the Web IDL specification. This adds an iterator
to the following interfaces:
- AudioTrackList, ClientRectList, CSSRuleList, CSSStyleDeclaration, CSSValueList,
  MimeTypeArray, WebKitNamedFlowCollection, Plugin, PluginArray, DOMStringList,
  FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLOptionsCollection,
  HTMLSelectElement, MediaList, NamedNodeMap, SourceBufferList, StyleSheetList,
  TextTrackCueList, TextTrackList, TouchList, VideoTrackList, VTTRegionList.

As a result, it is now possible to use `for ... of` for those types.

Tests: fast/dom/FileList-iterator.html
       fast/dom/collection-iterators.html
       fast/dom/document-all-undefined.html
       fast/events/touch/ios/touchlist-iterator.html

* bindings/scripts/CodeGeneratorJS.pm:
(GetAttributeWithName):
(InterfaceNeedsIterator):
(GenerateImplementation):
(addIterableProperties):

LayoutTests:

* fast/dom/FileList-iterator-expected.txt: Added.
* fast/dom/FileList-iterator.html: Added.
* fast/dom/collection-iterators-expected.txt: Added.
* fast/dom/collection-iterators.html: Added.
* fast/events/touch/ios/touchlist-iterator-expected.txt: Added.
* fast/events/touch/ios/touchlist-iterator.html: Added.
Add layout test coverage for all types that gained an iterator.

* fast/dom/document-all-undefined-expected.txt: Added.
* fast/dom/document-all-undefined.html: Added.
Add layout test to cover the fact that HTMLAllCollection masquerades as
undefined, as per:
- https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-all

* inspector/model/remote-object-get-properties-expected.txt:
Rebaseline now that there is an extra Symbol.iterator property.

* platform/wk2/TestExpectations:
Skip that requires beginDragWithFiles() as this is unimplemented in
WebKitTestRunner.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectgetpropertiesexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsArrayPrototypejs">trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomFileListiteratorexpectedtxt">trunk/LayoutTests/fast/dom/FileList-iterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomFileListiteratorhtml">trunk/LayoutTests/fast/dom/FileList-iterator.html</a></li>
<li><a href="#trunkLayoutTestsfastdomcollectioniteratorsexpectedtxt">trunk/LayoutTests/fast/dom/collection-iterators-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomcollectioniteratorshtml">trunk/LayoutTests/fast/dom/collection-iterators.html</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentallundefinedexpectedtxt">trunk/LayoutTests/fast/dom/document-all-undefined-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentallundefinedhtml">trunk/LayoutTests/fast/dom/document-all-undefined.html</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiostouchlistiteratorexpectedtxt">trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchiostouchlistiteratorhtml">trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator.html</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorfastdomcollectioniteratorsexpectedtxt">trunk/LayoutTests/platform/ios-simulator/fast/dom/collection-iterators-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/LayoutTests/ChangeLog        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2017-01-21  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection)
+        https://bugs.webkit.org/show_bug.cgi?id=167091
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/FileList-iterator-expected.txt: Added.
+        * fast/dom/FileList-iterator.html: Added.
+        * fast/dom/collection-iterators-expected.txt: Added.
+        * fast/dom/collection-iterators.html: Added.
+        * fast/events/touch/ios/touchlist-iterator-expected.txt: Added.
+        * fast/events/touch/ios/touchlist-iterator.html: Added.
+        Add layout test coverage for all types that gained an iterator.
+
+        * fast/dom/document-all-undefined-expected.txt: Added.
+        * fast/dom/document-all-undefined.html: Added.
+        Add layout test to cover the fact that HTMLAllCollection masquerades as
+        undefined, as per:
+        - https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-all
+
+        * inspector/model/remote-object-get-properties-expected.txt:
+        Rebaseline now that there is an extra Symbol.iterator property.
+
+        * platform/wk2/TestExpectations:
+        Skip that requires beginDragWithFiles() as this is unimplemented in
+        WebKitTestRunner.
+
+2017-01-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         innerText should replace existing text node
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=167116
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomFileListiteratorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/FileList-iterator-expected.txt (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/FileList-iterator-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/FileList-iterator-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+
+Tests that FileList objects have an iterator.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS fileList.__proto__ is FileList.prototype
+PASS Symbol.iterator in fileList is true
+PASS forOfSucceeded is true
+PASS 'entries' in fileList is false
+PASS 'keys' in fileList is false
+PASS 'forEach' in fileList is false
+PASS 'values' in fileList is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomFileListiteratorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/FileList-iterator.html (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/FileList-iterator.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/FileList-iterator.html        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;input type=&quot;file&quot; ondrop=&quot;dropped(event)&quot;&gt;&lt;/input&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Tests that FileList objects have an iterator.&quot;);
+jsTestIsAsync = true;
+
+function runTest()
+{
+    var inputElement = document.getElementsByTagName('input')[0];
+    eventSender.beginDragWithFiles(['test.txt']);
+    eventSender.mouseMoveTo(inputElement.offsetLeft + inputElement.offsetWidth / 2,
+                            inputElement.offsetTop + inputElement.offsetHeight / 2);
+    eventSender.mouseUp();
+}
+
+function dropped(event)
+{
+    fileList = event.dataTransfer.files;
+    shouldBe(&quot;fileList.__proto__&quot;, &quot;FileList.prototype&quot;);
+    shouldBeTrue(&quot;Symbol.iterator in fileList&quot;);
+    forOfSucceeded = false;
+    try {
+        for (var file of fileList) { }
+        forOfSucceeded = true;
+    } catch (e) {
+        forOfSucceeded = false;
+    }
+    shouldBeTrue(&quot;forOfSucceeded&quot;);
+
+    shouldBeFalse(&quot;'entries' in fileList&quot;);
+    shouldBeFalse(&quot;'keys' in fileList&quot;);
+    shouldBeFalse(&quot;'forEach' in fileList&quot;);
+    shouldBeFalse(&quot;'values' in fileList&quot;);
+
+    finishJSTest();
+}
+
+runTest();
+
+&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="trunkLayoutTestsfastdomcollectioniteratorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/collection-iterators-expected.txt (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/collection-iterators-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/collection-iterators-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,214 @@
</span><ins>+Tests that interfaces with an indexed getter and an integer-type length attribute get an iterator.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+* AudioTrackList
+PASS obj.__proto__ is AudioTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* ClientRectList
+PASS obj.__proto__ is ClientRectList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSRuleList
+PASS obj.__proto__ is CSSRuleList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSStyleDeclaration
+PASS obj.__proto__ is CSSStyleDeclaration.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSValueList
+PASS obj.__proto__ is CSSValueList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* MimeTypeArray
+PASS obj.__proto__ is MimeTypeArray.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* WebKitNamedFlowCollection
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* Plugin
+PASS obj.__proto__ is Plugin.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* PluginArray
+PASS obj.__proto__ is PluginArray.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* DOMStringList
+PASS obj.__proto__ is DOMStringList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLAllCollection
+PASS obj.__proto__ is HTMLAllCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLCollection
+PASS obj.__proto__ is HTMLCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLFormElement
+PASS obj.__proto__ is HTMLFormElement.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLOptionsCollection
+PASS obj.__proto__ is HTMLOptionsCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLSelectElement
+PASS obj.__proto__ is HTMLSelectElement.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* MediaList
+PASS obj.__proto__ is MediaList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* NamedNodeMap
+PASS obj.__proto__ is NamedNodeMap.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* SourceBufferList
+PASS obj.__proto__ is SourceBufferList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* StyleSheetList
+PASS obj.__proto__ is StyleSheetList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* TextTrackCueList
+PASS obj.__proto__ is TextTrackCueList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* TextTrackList
+PASS obj.__proto__ is TextTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* VideoTrackList
+PASS obj.__proto__ is VideoTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* VTTRegionList
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomcollectioniteratorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/collection-iterators.html (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/collection-iterators.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/collection-iterators.html        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style media=&quot;screen and (min-width: 480px)&quot;&gt;
+body {
+    background-position: 10px 20px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that interfaces with an indexed getter and an integer-type length attribute get an iterator.&quot;);
+
+function checkHasIterator(interfaceName, _obj)
+{
+    obj = _obj;
+    debug(&quot;* &quot; + interfaceName);
+    if (interfaceName in window)
+        shouldBe(&quot;obj.__proto__&quot;, &quot;&quot; + interfaceName + &quot;.prototype&quot;);
+    shouldBeTrue(&quot;Symbol.iterator in obj&quot;);
+    forOfSuccess = true;
+    try {
+        for (var p of obj) { }
+    } catch (e) {
+        debug(&quot;Exception: &quot; + e);
+        forOfSuccess = false;
+    }
+    if (forOfSuccess)
+        testPassed(&quot;for..of did not throw an exception&quot;);
+    else
+        testFailed(&quot;for..of threw an exception&quot;);
+
+    shouldBeFalse(&quot;'entries' in obj&quot;);
+    shouldBeFalse(&quot;'keys' in obj&quot;);
+    shouldBeFalse(&quot;'forEach' in obj&quot;);
+    shouldBeFalse(&quot;'values' in obj&quot;);
+
+    debug(&quot;&quot;);
+}
+
+var media = document.createElement(&quot;video&quot;);
+checkHasIterator(&quot;AudioTrackList&quot;, media.audioTracks);
+checkHasIterator(&quot;ClientRectList&quot;, document.body.getClientRects());
+checkHasIterator(&quot;CSSRuleList&quot;, window.getMatchedCSSRules(document.body));
+checkHasIterator(&quot;CSSStyleDeclaration&quot;, window.getComputedStyle(document.body));
+checkHasIterator(&quot;CSSValueList&quot;, window.getComputedStyle(document.body).getPropertyCSSValue('background-position'));
+checkHasIterator(&quot;MimeTypeArray&quot;, navigator.mimeTypes);
+checkHasIterator(&quot;WebKitNamedFlowCollection&quot;, document.webkitGetNamedFlows());
+if (navigator.plugins.length)
+    checkHasIterator(&quot;Plugin&quot;, navigator.plugins[0]);
+checkHasIterator(&quot;PluginArray&quot;, navigator.plugins);
+checkHasIterator(&quot;DOMStringList&quot;, location.ancestorOrigins);
+checkHasIterator(&quot;HTMLAllCollection&quot;, document.all);
+checkHasIterator(&quot;HTMLCollection&quot;, document.getElementsByTagName(&quot;body&quot;));
+checkHasIterator(&quot;HTMLFormElement&quot;, document.createElement(&quot;form&quot;));
+checkHasIterator(&quot;HTMLOptionsCollection&quot;, document.createElement(&quot;select&quot;).options);
+checkHasIterator(&quot;HTMLSelectElement&quot;, document.createElement(&quot;select&quot;));
+checkHasIterator(&quot;MediaList&quot;, document.getElementsByTagName(&quot;style&quot;)[0].sheet.media);
+checkHasIterator(&quot;NamedNodeMap&quot;, document.body.attributes);
+if ('SourceBufferList' in window)
+    checkHasIterator(&quot;SourceBufferList&quot;, (new MediaSource()).sourceBuffers);
+checkHasIterator(&quot;StyleSheetList&quot;, document.styleSheets);
+checkHasIterator(&quot;TextTrackCueList&quot;, document.createElement(&quot;video&quot;).addTextTrack(&quot;subtitles&quot;).cues);
+checkHasIterator(&quot;TextTrackList&quot;, media.textTracks);
+checkHasIterator(&quot;VideoTrackList&quot;, media.videoTracks);
+checkHasIterator(&quot;VTTRegionList&quot;, document.createElement(&quot;video&quot;).addTextTrack(&quot;subtitles&quot;).regions);
+&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="trunkLayoutTestsfastdomdocumentallundefinedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-all-undefined-expected.txt (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-all-undefined-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-all-undefined-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Tests that document.all masquerades as undefined.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS ToBoolean() returned false for document.all
+PASS document.all == undefined is true
+PASS document.all === undefined is false
+PASS document.all == null is true
+PASS document.all === null is false
+PASS typeof document.all is &quot;undefined&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentallundefinedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-all-undefined.html (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-all-undefined.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-all-undefined.html        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that document.all masquerades as undefined.&quot;);
+
+if (document.all)
+    testFailed(&quot;ToBoolean() should return false for document.all&quot;);
+else
+    testPassed(&quot;ToBoolean() returned false for document.all&quot;);
+
+shouldBeTrue(&quot;document.all == undefined&quot;);
+shouldBeFalse(&quot;document.all === undefined&quot;);
+shouldBeTrue(&quot;document.all == null&quot;);
+shouldBeFalse(&quot;document.all === null&quot;);
+shouldBeEqualToString(&quot;typeof document.all&quot;, &quot;undefined&quot;);
+&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="trunkLayoutTestsfasteventstouchiostouchlistiteratorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator-expected.txt (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Tests that TouchList objects have an iterator
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Symbol.iterator in touchList is true
+PASS touch is touch1
+PASS 'entries' in touchList is false
+PASS 'keys' in touchList is false
+PASS 'forEach' in touchList is false
+PASS 'values' in touchList is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchiostouchlistiteratorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator.html (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touchlist-iterator.html        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that TouchList objects have an iterator&quot;);
+
+var touch1 = new Touch(window, document.body, 1, 2, 3, 4);
+var touchList = new TouchList(touch1);
+shouldBeTrue(&quot;Symbol.iterator in touchList&quot;);
+for (var touch of touchList) {
+    shouldBe(&quot;touch&quot;, &quot;touch1&quot;);
+}
+
+shouldBeFalse(&quot;'entries' in touchList&quot;);
+shouldBeFalse(&quot;'keys' in touchList&quot;);
+shouldBeFalse(&quot;'forEach' in touchList&quot;);
+shouldBeFalse(&quot;'values' in touchList&quot;);
+&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="trunkLayoutTestsinspectormodelremoteobjectgetpropertiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -529,6 +529,7 @@
</span><span class="cx">     remove
</span><span class="cx">     item
</span><span class="cx">     namedItem
</span><ins>+    Symbol(Symbol.iterator)
</ins><span class="cx">     toString
</span><span class="cx">     toLocaleString
</span><span class="cx">     valueOf
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfastdomcollectioniteratorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator/fast/dom/collection-iterators-expected.txt (0 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/dom/collection-iterators-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/dom/collection-iterators-expected.txt        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+Tests that interfaces with an indexed getter and an integer-type length attribute get an iterator.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+* AudioTrackList
+PASS obj.__proto__ is AudioTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* ClientRectList
+PASS obj.__proto__ is ClientRectList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSRuleList
+PASS obj.__proto__ is CSSRuleList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSStyleDeclaration
+PASS obj.__proto__ is CSSStyleDeclaration.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* CSSValueList
+PASS obj.__proto__ is CSSValueList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* MimeTypeArray
+PASS obj.__proto__ is MimeTypeArray.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* WebKitNamedFlowCollection
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* PluginArray
+PASS obj.__proto__ is PluginArray.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* DOMStringList
+PASS obj.__proto__ is DOMStringList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLAllCollection
+PASS obj.__proto__ is HTMLAllCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLCollection
+PASS obj.__proto__ is HTMLCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLFormElement
+PASS obj.__proto__ is HTMLFormElement.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLOptionsCollection
+PASS obj.__proto__ is HTMLOptionsCollection.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* HTMLSelectElement
+PASS obj.__proto__ is HTMLSelectElement.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* MediaList
+PASS obj.__proto__ is MediaList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* NamedNodeMap
+PASS obj.__proto__ is NamedNodeMap.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* StyleSheetList
+PASS obj.__proto__ is StyleSheetList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* TextTrackCueList
+PASS obj.__proto__ is TextTrackCueList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* TextTrackList
+PASS obj.__proto__ is TextTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* VideoTrackList
+PASS obj.__proto__ is VideoTrackList.prototype
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+* VTTRegionList
+PASS Symbol.iterator in obj is true
+PASS for..of did not throw an exception
+PASS 'entries' in obj is false
+PASS 'keys' in obj is false
+PASS 'forEach' in obj is false
+PASS 'values' in obj is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -599,6 +599,7 @@
</span><span class="cx"> # https://bugs.webkit.org/show_bug.cgi?id=64285
</span><span class="cx"> editing/pasteboard/file-drag-to-editable.html
</span><span class="cx"> editing/pasteboard/file-input-files-access.html
</span><ins>+fast/dom/FileList-iterator.html
</ins><span class="cx"> fast/dom/Window/window-postmessage-clone-frames.html
</span><span class="cx"> fast/dom/Window/window-postmessage-clone.html
</span><span class="cx"> fast/events/data-transfer-files-attribute-identity.html
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2017-01-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection)
+        https://bugs.webkit.org/show_bug.cgi?id=167091
+
+        Reviewed by Darin Adler.
+
+        Update Array methods to throw a TypeError when (this === null || this === undefined)
+        instead of when (this == null). This is because (this == null) returns true for types
+        that masquerades as undefined (such as document.all) and this prevented use of the
+        Array API on such types. The specification only stays to use ToObject(), which throws
+        when the input is undefined or null.
+
+        The corresponding specification is at:
+        - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-array.prototype.values
+        - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-toobject
+
+        * builtins/ArrayPrototype.js:
+        (values):
+        (keys):
+        (entries):
+        (reduce):
+        (reduceRight):
+        (every):
+        (forEach):
+        (filter):
+        (map):
+        (some):
+        (fill):
+        (find):
+        (findIndex):
+        (includes):
+        (sort):
+        (concatSlowPath):
+        (copyWithin):
+
</ins><span class="cx"> 2017-01-21  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] export JSC::importModule API for WebCore dynamic import
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsArrayPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.values requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     return new @createArrayIterator(@Object(this), &quot;value&quot;, @arrayIteratorValueNext);
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.keys requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     return new @createArrayIterator(@Object(this), &quot;key&quot;, @arrayIteratorKeyNext);
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.entries requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     return new @createArrayIterator(@Object(this), &quot;key+value&quot;, @arrayIteratorKeyValueNext);
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.reduce requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.reduceRight requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.every requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.forEach requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.filter requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.map requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -282,7 +282,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.some requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -305,7 +305,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.fill requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.find requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.findIndex requires that |this| not be null or undefined&quot;);
</span><span class="cx">     
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -388,7 +388,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.includes requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -625,7 +625,7 @@
</span><span class="cx">         bucketSort(array, 0, strings, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.sort requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span><span class="lines">@@ -651,7 +651,7 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.prototype.concat requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var currentElement = @Object(this);
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx">         return (maybeNegativeZero &lt; positive) ? maybeNegativeZero : positive;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (this == null)
</del><ins>+    if (this === null || this === @undefined)
</ins><span class="cx">         @throwTypeError(&quot;Array.copyWithin requires that |this| not be null or undefined&quot;);
</span><span class="cx"> 
</span><span class="cx">     var array = @Object(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/WebCore/ChangeLog        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2017-01-21  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection)
+        https://bugs.webkit.org/show_bug.cgi?id=167091
+
+        Reviewed by Darin Adler.
+
+        As per the Web IDL specification [1], https://heycam.github.io/webidl/#es-iterator
+        an interface should get an iterator if it has:
+        - an indexed property getter and an integer-typed attribute named &quot;length&quot;.
+
+        We now comply with this part of the Web IDL specification. This adds an iterator
+        to the following interfaces:
+        - AudioTrackList, ClientRectList, CSSRuleList, CSSStyleDeclaration, CSSValueList,
+          MimeTypeArray, WebKitNamedFlowCollection, Plugin, PluginArray, DOMStringList,
+          FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLOptionsCollection,
+          HTMLSelectElement, MediaList, NamedNodeMap, SourceBufferList, StyleSheetList,
+          TextTrackCueList, TextTrackList, TouchList, VideoTrackList, VTTRegionList.
+
+        As a result, it is now possible to use `for ... of` for those types.
+
+        Tests: fast/dom/FileList-iterator.html
+               fast/dom/collection-iterators.html
+               fast/dom/document-all-undefined.html
+               fast/events/touch/ios/touchlist-iterator.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetAttributeWithName):
+        (InterfaceNeedsIterator):
+        (GenerateImplementation):
+        (addIterableProperties):
+
+2017-01-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         innerText should replace existing text node
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=167116
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -2967,6 +2967,29 @@
</span><span class="cx">     return &quot;DOMJIT::IDLResultTypeFilter&lt;${IDLType}&gt;::value&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub GetAttributeWithName
+{
+    my ($interface, $attributeName) = @_;
+    
+    foreach my $attribute (@{$interface-&gt;attributes}) {
+        return $attribute if $attribute-&gt;name eq $attributeName;
+    }
+}
+
+# https://heycam.github.io/webidl/#es-iterator
+sub InterfaceNeedsIterator
+{
+    my ($interface) = @_;
+    
+    return 1 if $interface-&gt;iterable;
+    if (GetIndexedGetterFunction($interface)) {
+        my $lengthAttribute = GetAttributeWithName($interface, &quot;length&quot;);
+        return 1 if $lengthAttribute and $codeGenerator-&gt;IsIntegerType($lengthAttribute-&gt;type);
+    }
+    # FIXME: This should return 1 for maplike and setlike once we support them.
+    return 0;
+}
+
</ins><span class="cx"> sub GenerateImplementation
</span><span class="cx"> {
</span><span class="cx">     my ($object, $interface, $enumerations, $dictionaries) = @_;
</span><span class="lines">@@ -3320,9 +3343,16 @@
</span><span class="cx">             push(@implContent, &quot;#endif\n&quot;) if $conditionalString;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ($interface-&gt;iterable) {
-            addIterableProperties($interface, $className);
</del><ins>+        if (InterfaceNeedsIterator($interface)) {
+            if (IsKeyValueIterableInterface($interface)) {
+                my $functionName = GetFunctionName($interface, $className, @{$interface-&gt;iterable-&gt;functions}[0]);
+                push(@implContent, &quot;    putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\&quot;[Symbol.Iterator]\&quot;), $functionName), DontEnum);\n&quot;);
+            } else {
+                AddToImplIncludes(&quot;&lt;builtins/BuiltinNames.h&gt;&quot;);
+                push(@implContent, &quot;    putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, globalObject()-&gt;arrayPrototype()-&gt;getDirect(vm, vm.propertyNames-&gt;builtinNames().valuesPrivateName()), DontEnum);\n&quot;);
+            }
</ins><span class="cx">         }
</span><ins>+        push(@implContent, &quot;    addValueIterableMethods(*globalObject(), *this);\n&quot;) if $interface-&gt;iterable and !IsKeyValueIterableInterface($interface);
</ins><span class="cx"> 
</span><span class="cx">         addUnscopableProperties($interface);
</span><span class="cx"> 
</span><span class="lines">@@ -5158,24 +5188,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub addIterableProperties()
-{
-    my $interface = shift;
-    my $className = shift;
-
-    if (NeedsRuntimeCheck($interface-&gt;iterable)) {
-        my $enable_function = GetRuntimeEnableFunctionName($interface-&gt;iterable);
-        push(@implContent, &quot;    if (${enable_function}())\n    &quot;);
-    }
-
-    if (IsKeyValueIterableInterface($interface)) {
-        my $functionName = GetFunctionName($interface, $className, @{$interface-&gt;iterable-&gt;functions}[0]);
-        push(@implContent, &quot;    putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\&quot;[Symbol.Iterator]\&quot;), $functionName), DontEnum);\n&quot;);
-    } else {
-        push(@implContent, &quot;    addValueIterableMethods(*globalObject(), *this);\n&quot;);
-    }
-}
-
</del><span class="cx"> my %nativeType = (
</span><span class="cx">     &quot;ByteString&quot; =&gt; &quot;String&quot;,
</span><span class="cx">     &quot;DOMString&quot; =&gt; &quot;String&quot;,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -144,8 +144,7 @@
</span><span class="cx">         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
</span><span class="cx">         JSObject::deleteProperty(this, globalObject()-&gt;globalExec(), propertyName);
</span><span class="cx">     }
</span><del>-    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled())
-        putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(&quot;[Symbol.Iterator]&quot;), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
</del><ins>+    putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(&quot;[Symbol.Iterator]&quot;), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSTestNode::s_info = { &quot;TestNode&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (211023 => 211024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-01-22 05:19:17 UTC (rev 211023)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-01-22 05:48:28 UTC (rev 211024)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &quot;WebCoreJSClientData.h&quot;
</span><ins>+#include &lt;builtins/BuiltinNames.h&gt;
</ins><span class="cx"> #include &lt;inspector/ScriptArguments.h&gt;
</span><span class="cx"> #include &lt;inspector/ScriptCallStackFactory.h&gt;
</span><span class="cx"> #include &lt;runtime/Error.h&gt;
</span><span class="lines">@@ -1897,6 +1898,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     putDirect(vm, static_cast&lt;JSVMClientData*&gt;(vm.clientData)-&gt;builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
</span><span class="cx">     putDirect(vm, static_cast&lt;JSVMClientData*&gt;(vm.clientData)-&gt;builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
</span><ins>+    putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, globalObject()-&gt;arrayPrototype()-&gt;getDirect(vm, vm.propertyNames-&gt;builtinNames().valuesPrivateName()), DontEnum);
</ins><span class="cx">     addValueIterableMethods(*globalObject(), *this);
</span><span class="cx">     JSObject&amp; unscopables = *constructEmptyObject(globalObject()-&gt;globalExec(), globalObject()-&gt;nullPrototypeObjectStructure());
</span><span class="cx">     unscopables.putDirect(vm, Identifier::fromString(&amp;vm, &quot;voidMethod&quot;), jsBoolean(true));
</span></span></pre>
</div>
</div>

</body>
</html>