<!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>[196128] 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/196128">196128</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-02-04 09:43:05 -0800 (Thu, 04 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Add support for iterating over Headers
https://bugs.webkit.org/show_bug.cgi?id=153787

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Relanding.

* web-platform-tests/fetch/api/headers/headers-basic-expected.txt:
* web-platform-tests/fetch/api/headers/headers-basic.html:
* web-platform-tests/fetch/api/headers/headers-structure-expected.txt:
* web-platform-tests/fetch/api/request/request-clone.sub-expected.txt:
* web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt:
* web-platform-tests/fetch/api/resources/utils.js:
(checkRequest):
(readTextStream):

Source/WebCore:

Relanding, updating bindings/js/JSKeyValueIterator.h for Windows bots.

Covered by updated tests.
Introducing template class (JSKeyValueIterator) to support key-value iterators in DOM classes.
Using JSKeyValueIterator to implement Headers entries(), keys() and values() as custom methods.
Binding generator should be updated to generate directly these custom methods and handle iterator Symbol.

* CMakeLists.txt:
* Modules/fetch/FetchHeaders.cpp:
(WebCore::FetchHeaders::Iterator::next):
(WebCore::FetchHeaders::Iterator::Iterator):
* Modules/fetch/FetchHeaders.h:
(WebCore::FetchHeaders::createIterator):
* Modules/fetch/FetchHeaders.idl:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMBinding.h:
(WebCore::jsPair):
* bindings/js/JSFetchHeadersCustom.cpp: Added.
(WebCore::JSFetchHeaders::entries):
(WebCore::JSFetchHeaders::keys):
(WebCore::JSFetchHeaders::values):
* bindings/js/JSKeyValueIterator.h: Added.
(WebCore::JSKeyValueIteratorPrototype::create):
(WebCore::JSKeyValueIteratorPrototype::createStructure):
(WebCore::JSKeyValueIteratorPrototype::JSKeyValueIteratorPrototype):
(WebCore::createIterator):
(WebCore::DOMWrapped&gt;::destroy):
(WebCore::DOMWrapped&gt;::next):
(WebCore::DOMWrapped&gt;::finishCreation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasicexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasichtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersstructureexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestclonesubexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit003subexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresourcesutilsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchHeaderscpp">trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchHeadersh">trunk/Source/WebCore/Modules/fetch/FetchHeaders.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchHeadersidl">trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSFetchHeadersCustomcpp">trunk/Source/WebCore/bindings/js/JSFetchHeadersCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSKeyValueIteratorh">trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-02-04  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Add support for iterating over Headers
+        https://bugs.webkit.org/show_bug.cgi?id=153787
+
+        Reviewed by Darin Adler.
+
+        Relanding.
+
+        * web-platform-tests/fetch/api/headers/headers-basic-expected.txt:
+        * web-platform-tests/fetch/api/headers/headers-basic.html:
+        * web-platform-tests/fetch/api/headers/headers-structure-expected.txt:
+        * web-platform-tests/fetch/api/request/request-clone.sub-expected.txt:
+        * web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt:
+        * web-platform-tests/fetch/api/resources/utils.js:
+        (checkRequest):
+        (readTextStream):
+
</ins><span class="cx"> 2016-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge DOMTokenList and DOMSettableTokenList
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasicexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic-expected.txt        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -12,4 +12,7 @@
</span><span class="cx"> PASS Check has method 
</span><span class="cx"> PASS Check delete method 
</span><span class="cx"> PASS Check get method 
</span><ins>+PASS Check keys method 
+PASS Check values method 
+PASS Check entries method 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -111,6 +111,58 @@
</span><span class="cx"> 
</span><span class="cx">         assert_equals(headers.get(&quot;nameNotInHeaders&quot;), null, &quot;header: nameNotInHeaders has no value&quot;);
</span><span class="cx">       }, &quot;Check get method&quot;);
</span><del>-    &lt;/script&gt;
</del><ins>+
+      var headerEntriesDict = {&quot;name1&quot;: &quot;value1&quot;,
+                               &quot;Name2&quot;: &quot;value2&quot;,
+                               &quot;name&quot;: &quot;value3&quot;,
+                               &quot;content-Type&quot;: &quot;value4&quot;,
+                               &quot;Content-Typ&quot;: &quot;value5&quot;,
+                               &quot;Content-Types&quot;: &quot;value6&quot;
+      };
+      var sortedHeaderDict = {};
+      var sortedHeaderKeys = Object.keys(headerEntriesDict).map(function(value) {
+        sortedHeaderDict[value.toLowerCase()] = headerEntriesDict[value];
+        return value.toLowerCase();
+      }).sort();
+
+      test(function() {
+        var headers = new Headers(headerEntriesDict);
+        var actual = headers.keys();
+        sortedHeaderKeys.forEach(function(key) {
+            entry = actual.next();
+            assert_false(entry.done);
+            assert_equals(entry.value, key);
+        });
+        assert_true(actual.next().done);
+        assert_true(actual.next().done);
+      }, &quot;Check keys method&quot;);
+
+      test(function() {
+        var headers = new Headers(headerEntriesDict);
+        var actual = headers.values();
+
+        sortedHeaderKeys.forEach(function(key) {
+            entry = actual.next();
+            assert_false(entry.done);
+            assert_equals(entry.value, sortedHeaderDict[key]);
+        });
+        assert_true(actual.next().done);
+        assert_true(actual.next().done);
+      }, &quot;Check values method&quot;);
+
+      test(function() {
+        var headers = new Headers(headerEntriesDict);
+        var actual = headers.entries();
+
+        sortedHeaderKeys.forEach(function(key) {
+            entry = actual.next();
+            assert_false(entry.done);
+            assert_equals(entry.value[0], key);
+            assert_equals(entry.value[1], sortedHeaderDict[key]);
+        });
+        assert_true(actual.next().done);
+        assert_true(actual.next().done);
+      }, &quot;Check entries method&quot;);
+   &lt;/script&gt;
</ins><span class="cx">   &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersstructureexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure-expected.txt        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> PASS Headers has get method 
</span><span class="cx"> PASS Headers has has method 
</span><span class="cx"> PASS Headers has set method 
</span><del>-FAIL Headers has entries method assert_true: headers has entries method expected true got false
-FAIL Headers has keys method assert_true: headers has keys method expected true got false
-FAIL Headers has values method assert_true: headers has values method expected true got false
</del><ins>+PASS Headers has entries method 
+PASS Headers has keys method 
+PASS Headers has values method 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestclonesubexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub-expected.txt (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub-expected.txt        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub-expected.txt        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> 
</span><del>-FAIL Check cloning a request ExpectedValuesDict[&quot;headers&quot;].keys is not a function. (In 'ExpectedValuesDict[&quot;headers&quot;].keys()', 'ExpectedValuesDict[&quot;headers&quot;].keys' is undefined)
</del><ins>+PASS Check cloning a request 
</ins><span class="cx"> PASS Check cloning a request copies the headers 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit003subexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> 
</span><del>-FAIL Check request values when initialized from Request ExpectedValuesDict[&quot;headers&quot;].keys is not a function. (In 'ExpectedValuesDict[&quot;headers&quot;].keys()', 'ExpectedValuesDict[&quot;headers&quot;].keys' is undefined)
-FAIL Check request values when initialized from Request and init values ExpectedValuesDict[&quot;headers&quot;].keys is not a function. (In 'ExpectedValuesDict[&quot;headers&quot;].keys()', 'ExpectedValuesDict[&quot;headers&quot;].keys' is undefined)
</del><ins>+PASS Check request values when initialized from Request 
+PASS Check request values when initialized from Request and init values 
</ins><span class="cx"> FAIL Check request values when initialized from url string assert_equals: Check url attribute expected &quot;http://url.test:1234/path/subpath?query=true&quot; but got &quot;http://url.test:1234/path/subpath?query=true#fragment&quot;
</span><del>-FAIL Check request values when initialized from url and init values ExpectedValuesDict[&quot;headers&quot;].keys is not a function. (In 'ExpectedValuesDict[&quot;headers&quot;].keys()', 'ExpectedValuesDict[&quot;headers&quot;].keys' is undefined)
</del><ins>+FAIL Check request values when initialized from url and init values assert_equals: Check url attribute expected &quot;http://url.test:1234/path/subpath?query=true&quot; but got &quot;http://url.test:1234/path/subpath?query=true#fragment&quot;
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresourcesutilsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx">   for (var attribute in ExpectedValuesDict) {
</span><span class="cx">     switch(attribute) {
</span><span class="cx">       case &quot;headers&quot;:
</span><del>-          for (var key of ExpectedValuesDict[&quot;headers&quot;].keys())
</del><ins>+          for (var key in ExpectedValuesDict[&quot;headers&quot;].keys())
</ins><span class="cx">             assert_equals(request[&quot;headers&quot;].get(key), ExpectedValuesDict[&quot;headers&quot;].get(key),
</span><span class="cx">               &quot;Check headers attribute has &quot; + key + &quot;:&quot; + ExpectedValuesDict[&quot;headers&quot;].get(key));
</span><span class="cx">         break;
</span><span class="lines">@@ -63,4 +63,4 @@
</span><span class="cx">       asyncTest.done();
</span><span class="cx">     });
</span><span class="cx">   });
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1164,6 +1164,7 @@
</span><span class="cx">     bindings/js/JSEventListener.cpp
</span><span class="cx">     bindings/js/JSEventTargetCustom.cpp
</span><span class="cx">     bindings/js/JSExceptionBase.cpp
</span><ins>+    bindings/js/JSFetchHeadersCustom.cpp
</ins><span class="cx">     bindings/js/JSFileReaderCustom.cpp
</span><span class="cx">     bindings/js/JSGeolocationCustom.cpp
</span><span class="cx">     bindings/js/JSHTMLAllCollectionCustom.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/ChangeLog        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-02-04  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Add support for iterating over Headers
+        https://bugs.webkit.org/show_bug.cgi?id=153787
+
+        Reviewed by Darin Adler.
+
+        Relanding, updating bindings/js/JSKeyValueIterator.h for Windows bots.
+
+        Covered by updated tests.
+        Introducing template class (JSKeyValueIterator) to support key-value iterators in DOM classes.
+        Using JSKeyValueIterator to implement Headers entries(), keys() and values() as custom methods.
+        Binding generator should be updated to generate directly these custom methods and handle iterator Symbol.
+
+        * CMakeLists.txt:
+        * Modules/fetch/FetchHeaders.cpp:
+        (WebCore::FetchHeaders::Iterator::next):
+        (WebCore::FetchHeaders::Iterator::Iterator):
+        * Modules/fetch/FetchHeaders.h:
+        (WebCore::FetchHeaders::createIterator):
+        * Modules/fetch/FetchHeaders.idl:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::jsPair):
+        * bindings/js/JSFetchHeadersCustom.cpp: Added.
+        (WebCore::JSFetchHeaders::entries):
+        (WebCore::JSFetchHeaders::keys):
+        (WebCore::JSFetchHeaders::values):
+        * bindings/js/JSKeyValueIterator.h: Added.
+        (WebCore::JSKeyValueIteratorPrototype::create):
+        (WebCore::JSKeyValueIteratorPrototype::createStructure):
+        (WebCore::JSKeyValueIteratorPrototype::JSKeyValueIteratorPrototype):
+        (WebCore::createIterator):
+        (WebCore::DOMWrapped&gt;::destroy):
+        (WebCore::DOMWrapped&gt;::next):
+        (WebCore::DOMWrapped&gt;::finishCreation):
+
</ins><span class="cx"> 2016-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge DOMTokenList and DOMSettableTokenList
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchHeaderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.cpp        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -179,6 +179,31 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool FetchHeaders::Iterator::next(String&amp; nextKey, String&amp; nextValue)
+{
+    while (m_currentIndex &lt; m_keys.size()) {
+        auto&amp; key = m_keys[m_currentIndex++];
+        String value = m_headers-&gt;m_headers.get(key);
+        if (!value.isNull()) {
+            nextKey = key;
+            nextValue = WTFMove(value);
+            return false;
+        }
+    }
+    m_keys.clear();
+    return true;
+}
+
+FetchHeaders::Iterator::Iterator(FetchHeaders&amp; headers)
+    : m_headers(headers)
+{
+    m_keys.reserveInitialCapacity(headers.m_headers.size());
+    for (auto&amp; header : headers.m_headers)
+        m_keys.uncheckedAppend(header.key.convertToASCIILowercase());
+
+    std::sort(m_keys.begin(), m_keys.end(), WTF::codePointCompareLessThan);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FETCH_API)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.h (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.h        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.h        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -62,6 +62,23 @@
</span><span class="cx">     String fastGet(HTTPHeaderName name) const { return m_headers.get(name); }
</span><span class="cx">     void fastSet(HTTPHeaderName name, const String&amp; value) { m_headers.set(name, value); }
</span><span class="cx"> 
</span><ins>+    class Iterator {
+    public:
+        explicit Iterator(FetchHeaders&amp;);
+
+        // FIXME: Binding generator should be able to generate iterator key and value types.
+        using Key = String;
+        using Value = String;
+
+        bool next(String&amp; nextKey, String&amp; nextValue);
+
+    private:
+        Ref&lt;FetchHeaders&gt; m_headers;
+        size_t m_currentIndex = 0;
+        Vector&lt;String&gt; m_keys;
+    };
+    Iterator createIterator() { return Iterator(*this); }
+
</ins><span class="cx"> private:
</span><span class="cx">     FetchHeaders(Guard guard) : m_guard(guard) { }
</span><span class="cx">     FetchHeaders(Guard guard, const HTTPHeaderMap&amp; headers) : m_guard(guard), m_headers(headers) { }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchHeadersidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -40,8 +40,11 @@
</span><span class="cx">     [RaisesException] boolean has(DOMString name);
</span><span class="cx">     [RaisesException] void set(DOMString name, DOMString value);
</span><span class="cx"> 
</span><del>-    // FIXME: Support iterable.
</del><ins>+    // FIXME: Support iterable within binding generator.
</ins><span class="cx">     //iterable&lt;DOMString, DOMString&gt;;
</span><ins>+    [Custom] any entries();
+    [Custom] any keys();
+    [Custom] any values();
</ins><span class="cx"> 
</span><span class="cx">     [Private, RaisesException, ImplementedAs=append] void appendFromJS(DOMString name, DOMString value);
</span><span class="cx">     [Private, RaisesException] void initializeWith(FetchHeaders headers);
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -1541,6 +1541,7 @@
</span><span class="cx">                 41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D015C90F4B5C71004A662F /* ContentType.cpp */; };
</span><span class="cx">                 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41E1B1CA0FF5986900576B3B /* AbstractWorker.cpp */; };
</span><span class="cx">                 41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 41E1B1CB0FF5986900576B3B /* AbstractWorker.h */; };
</span><ins>+                41E910A71C60FD6C007A453F /* JSFetchHeadersCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41E910A61C60FD6C007A453F /* JSFetchHeadersCustom.cpp */; };
</ins><span class="cx">                 41F062140F5F192600A07EAC /* InspectorDatabaseResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */; };
</span><span class="cx">                 41F062150F5F192600A07EAC /* InspectorDatabaseResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F062130F5F192600A07EAC /* InspectorDatabaseResource.cpp */; };
</span><span class="cx">                 41F066E40F64BCF600A07EAC /* ScriptGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F066E20F64BCF600A07EAC /* ScriptGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -8964,6 +8965,7 @@
</span><span class="cx">                 41E1B1CA0FF5986900576B3B /* AbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractWorker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41E1B1CB0FF5986900576B3B /* AbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractWorker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41E1B1CC0FF5986900576B3B /* AbstractWorker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AbstractWorker.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                41E910A61C60FD6C007A453F /* JSFetchHeadersCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchHeadersCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseResource.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F062130F5F192600A07EAC /* InspectorDatabaseResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseResource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F066E20F64BCF600A07EAC /* ScriptGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptGlobalObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22291,6 +22293,7 @@
</span><span class="cx">                                 BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */,
</span><span class="cx">                                 ADEC78F718EE5308001315C2 /* JSElementCustom.h */,
</span><span class="cx">                                 BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */,
</span><ins>+                                41E910A61C60FD6C007A453F /* JSFetchHeadersCustom.cpp */,
</ins><span class="cx">                                 2E7582ED12764F260062628B /* JSFileReaderCustom.cpp */,
</span><span class="cx">                                 FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */,
</span><span class="cx">                                 BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
</span><span class="lines">@@ -29372,6 +29375,7 @@
</span><span class="cx">                                 97B38E28151C4273004622E9 /* DOMWindowNotifications.cpp in Sources */,
</span><span class="cx">                                 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */,
</span><span class="cx">                                 AA2A5AD716A4861A00975A25 /* DOMWindowSpeechSynthesis.cpp in Sources */,
</span><ins>+                                41E910A71C60FD6C007A453F /* JSFetchHeadersCustom.cpp in Sources */,
</ins><span class="cx">                                 A8CCBB48151F831600AB7CE9 /* DOMWindowWebDatabase.cpp in Sources */,
</span><span class="cx">                                 BC53DA481143134D000D817E /* DOMWrapperWorld.cpp in Sources */,
</span><span class="cx">                                 1A1D13810A5325520064BF5F /* DOMXPath.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx"> #include &quot;JSEventListener.cpp&quot;
</span><span class="cx"> #include &quot;JSEventTargetCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSExceptionBase.cpp&quot;
</span><ins>+#include &quot;JSFetchHeadersCustom.cpp&quot;
</ins><span class="cx"> #include &quot;JSFileReaderCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSGeolocationCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSHTMLAllCollectionCustom.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (196127 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-02-04 17:39:11 UTC (rev 196127)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -514,6 +514,14 @@
</span><span class="cx">     return jsArray(exec, globalObject, *vector);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename Value1, typename Value2&gt; inline JSC::JSValue jsPair(JSC::ExecState&amp; state, JSDOMGlobalObject* globalObject, const Value1&amp; value1, const Value2&amp; value2)
+{
+    JSC::MarkedArgumentBuffer args;
+    args.append(toJS(&amp;state, globalObject, value1));
+    args.append(toJS(&amp;state, globalObject, value2));
+    return constructArray(&amp;state, 0, globalObject, args);
+}
+
</ins><span class="cx"> WEBCORE_EXPORT JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr&lt;DOMStringList&gt;);
</span><span class="cx"> 
</span><span class="cx"> inline PassRefPtr&lt;JSC::ArrayBufferView&gt; toArrayBufferView(JSC::JSValue value)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSFetchHeadersCustomcppfromrev196126trunkSourceWebCoreModulesfetchFetchHeadersidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/bindings/js/JSFetchHeadersCustom.cpp (from rev 196126, trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl) (0 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSFetchHeadersCustom.cpp                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSFetchHeadersCustom.cpp        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be 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.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 CANON INC. AND ITS 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 &quot;config.h&quot;
+#include &quot;JSFetchHeaders.h&quot;
+
+#if ENABLE(FETCH_API)
+
+#include &quot;JSKeyValueIterator.h&quot;
+
+namespace WebCore {
+
+// FIXME: Move this code to JSFetchHeaders.
+using FetchHeadersIterator = JSKeyValueIterator&lt;JSFetchHeaders, FetchHeaders&gt;;
+using FetchHeadersIteratorPrototype = JSKeyValueIteratorPrototype&lt;JSFetchHeaders, FetchHeaders&gt;;
+
+template&lt;&gt;
+const JSC::ClassInfo FetchHeadersIterator::s_info = { &quot;Headers Iterator&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(FetchHeadersIterator) };
+
+template&lt;&gt;
+const JSC::ClassInfo FetchHeadersIteratorPrototype::s_info = { &quot;Headers Iterator&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(FetchHeadersIteratorPrototype) };
+
+JSC::JSValue JSFetchHeaders::entries(JSC::ExecState&amp;)
+{
+    return createIterator&lt;JSFetchHeaders, FetchHeaders&gt;(*globalObject(), *this, IterationKind::KeyValue);
+}
+
+JSC::JSValue JSFetchHeaders::keys(JSC::ExecState&amp;)
+{
+    return createIterator&lt;JSFetchHeaders, FetchHeaders&gt;(*globalObject(), *this, IterationKind::Key);
+}
+
+JSC::JSValue JSFetchHeaders::values(JSC::ExecState&amp;)
+{
+    return createIterator&lt;JSFetchHeaders, FetchHeaders&gt;(*globalObject(), *this, IterationKind::Value);
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSKeyValueIteratorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h (0 => 196128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h        2016-02-04 17:43:05 UTC (rev 196128)
</span><span class="lines">@@ -0,0 +1,159 @@
</span><ins>+/*
+ * Copyright (C) 2016 Canon, 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 CANON 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 CANON 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.
+ */
+
+#ifndef JSKeyValueIterator_h
+#define JSKeyValueIterator_h
+
+#include &quot;JSDOMBinding.h&quot;
+#include &lt;runtime/JSDestructibleObject.h&gt;
+
+namespace WebCore {
+
+// FIXME: Update binding generator to allow getting DOMWrapped from JSWrapper.
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+class JSKeyValueIteratorPrototype : public JSC::JSNonFinalObject {
+public:
+    typedef JSC::JSNonFinalObject Base;
+
+    static JSKeyValueIteratorPrototype* create(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSKeyValueIteratorPrototype* prototype = new (NotNull, JSC::allocateCell&lt;JSKeyValueIteratorPrototype&gt;(vm.heap)) JSKeyValueIteratorPrototype(vm, structure);
+        prototype-&gt;finishCreation(vm, globalObject);
+        return prototype;
+    }
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+    static JSC::EncodedJSValue JSC_HOST_CALL next(JSC::ExecState*);
+
+private:
+    JSKeyValueIteratorPrototype(JSC::VM&amp; vm, JSC::Structure* structure) : Base(vm, structure) { }
+
+    void finishCreation(JSC::VM&amp;, JSC::JSGlobalObject*);
+};
+
+enum class IterationKind { Key, Value, KeyValue };
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+class JSKeyValueIterator: public JSDOMObject {
+public:
+    typedef JSDOMObject Base;
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+    static JSKeyValueIterator* create(JSC::VM&amp; vm, JSC::Structure* structure, JSWrapper&amp; iteratedObject, IterationKind kind)
+    {
+        JSKeyValueIterator* instance = new (NotNull, JSC::allocateCell&lt;JSKeyValueIterator&gt;(vm.heap)) JSKeyValueIterator(structure, iteratedObject, kind);
+        instance-&gt;finishCreation(vm);
+        return instance;
+    }
+
+    static JSKeyValueIteratorPrototype&lt;JSWrapper, DOMWrapped&gt;* createPrototype(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject)
+    {
+        return JSKeyValueIteratorPrototype&lt;JSWrapper, DOMWrapped&gt;::create(vm, globalObject,
+            JSKeyValueIteratorPrototype&lt;JSWrapper, DOMWrapped&gt;::createStructure(vm, globalObject, globalObject-&gt;objectPrototype()));
+    }
+
+    bool next(JSC::ExecState&amp;, JSC::JSValue&amp;);
+
+private:
+    JSKeyValueIterator(JSC::Structure* structure, JSWrapper&amp; iteratedObject, IterationKind kind)
+        : Base(structure, *iteratedObject.globalObject())
+        , m_iterator(iteratedObject.wrapped().createIterator())
+        , m_kind(kind)
+    {
+    }
+
+    static void destroy(JSC::JSCell*);
+
+    typename DOMWrapped::Iterator m_iterator;
+    IterationKind m_kind;
+};
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;* createIterator(JSDOMGlobalObject&amp; globalObject, JSWrapper&amp; wrapper, IterationKind kind)
+{
+    return JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;::create(globalObject.vm(), getDOMStructure&lt;JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;&gt;(globalObject.vm(), globalObject), wrapper, kind);
+}
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+void JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;::destroy(JSCell* cell)
+{
+    JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;* thisObject = JSC::jsCast&lt;JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;*&gt;(cell);
+    thisObject-&gt;JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;::~JSKeyValueIterator();
+}
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+bool JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;::next(JSC::ExecState&amp; state, JSC::JSValue&amp; value)
+{
+    typename DOMWrapped::Iterator::Key nextKey;
+    typename DOMWrapped::Iterator::Value nextValue;
+    if (m_iterator.next(nextKey, nextValue)) {
+        value = JSC::jsUndefined();
+        return true;
+    }
+    if (m_kind == IterationKind::Value)
+        value = toJS(&amp;state, globalObject(), nextValue);
+    else if (m_kind == IterationKind::Key)
+        value = toJS(&amp;state, globalObject(), nextKey);
+    else
+        value = jsPair(state, globalObject(), nextKey, nextValue);
+    return false;
+}
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+JSC::EncodedJSValue JSC_HOST_CALL JSKeyValueIteratorPrototype&lt;JSWrapper, DOMWrapped&gt;::next(JSC::ExecState* state)
+{
+    JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;* iterator = JSC::jsDynamicCast&lt;JSKeyValueIterator&lt;JSWrapper, DOMWrapped&gt;*&gt;(state-&gt;thisValue());
+    if (!iterator)
+        return JSC::JSValue::encode(throwTypeError(state, ASCIILiteral(&quot;Cannot call next() on a non-Iterator object&quot;)));
+
+    JSC::JSValue result;
+    bool isDone = iterator-&gt;next(*state, result);
+    return JSC::JSValue::encode(createIteratorResultObject(state, result, isDone));
+}
+
+template&lt;typename JSWrapper, typename DOMWrapped&gt;
+void JSKeyValueIteratorPrototype&lt;JSWrapper, DOMWrapped&gt;::finishCreation(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(info()));
+
+    JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames-&gt;next, next, JSC::DontEnum, 0, JSC::NoIntrinsic);
+}
+
+}
+
+#endif // !defined(JSKeyValueIterator_h)
</ins></span></pre>
</div>
</div>

</body>
</html>