<!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>[203235] 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/203235">203235</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-14 12:32:24 -0700 (Thu, 14 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>DOMIterators should be assigned a correct prototype
https://bugs.webkit.org/show_bug.cgi?id=159115
Patch by Youenn Fablet <youenn@apple.com> on 2016-07-14
Reviewed by Chris Dumez.
LayoutTests/imported/w3c:
* web-platform-tests/fetch/api/headers/headers-basic.html: Updating test (changes to be upstreamed to w3c wpt repo)
Source/WebCore:
Default iterator object internal prototype property is the Iterator prototype as defined in
http://heycam.github.io/webidl/#dfn-iterator-prototype-object.
Linking DOMIterator prototype to IteratorPrototype.
This allows adding @@iterator property to the result of entries, keys and values methods.
This in turns allow doing for-of loops on them.
Covered by updated test.
* ForwardingHeaders/runtime/IteratorPrototype.h: Added.
* bindings/js/JSDOMIterator.h: Setting correct prototype and marking next prototype property as enumerable.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasichtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMIteratorh">trunk/Source/WebCore/bindings/js/JSDOMIterator.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreForwardingHeadersruntimeIteratorPrototypeh">trunk/Source/WebCore/ForwardingHeaders/runtime/IteratorPrototype.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 (203234 => 203235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-14 19:30:09 UTC (rev 203234)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-14 19:32:24 UTC (rev 203235)
</span><span class="lines">@@ -1,5 +1,14 @@
</span><span class="cx"> 2016-07-14 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><ins>+ DOMIterators should be assigned a correct prototype
+ https://bugs.webkit.org/show_bug.cgi?id=159115
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/fetch/api/headers/headers-basic.html: Updating test (changes to be upstreamed to w3c wpt repo)
+
+2016-07-14 Youenn Fablet <youenn@apple.com>
+
</ins><span class="cx"> [Fetch API] Request and Response url getter should use URL serialization
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=159705
</span><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 (203234 => 203235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-07-14 19:30:09 UTC (rev 203234)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-07-14 19:32:24 UTC (rev 203235)
</span><span class="lines">@@ -120,14 +120,29 @@
</span><span class="cx"> "Content-Types": "value6"
</span><span class="cx"> };
</span><span class="cx"> var sortedHeaderDict = {};
</span><ins>+ var headerValues = [];
</ins><span class="cx"> var sortedHeaderKeys = Object.keys(headerEntriesDict).map(function(value) {
</span><span class="cx"> sortedHeaderDict[value.toLowerCase()] = headerEntriesDict[value];
</span><ins>+ headerValues.push(headerEntriesDict[value]);
</ins><span class="cx"> return value.toLowerCase();
</span><span class="cx"> }).sort();
</span><span class="cx">
</span><ins>+ var iteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([].values()));
+ function checkIteratorProperties(iterator) {
+ var prototype = Object.getPrototypeOf(iterator);
+ assert_equals(Object.getPrototypeOf(prototype), iteratorPrototype);
+
+ var descriptor = Object.getOwnPropertyDescriptor(prototype, "next");
+ assert_true(descriptor.configurable, "configurable");
+ assert_true(descriptor.enumerable, "enumerable");
+ assert_true(descriptor.writable, "writable");
+ }
+
</ins><span class="cx"> test(function() {
</span><span class="cx"> var headers = new Headers(headerEntriesDict);
</span><span class="cx"> var actual = headers.keys();
</span><ins>+ checkIteratorProperties(actual);
+
</ins><span class="cx"> sortedHeaderKeys.forEach(function(key) {
</span><span class="cx"> entry = actual.next();
</span><span class="cx"> assert_false(entry.done);
</span><span class="lines">@@ -135,11 +150,15 @@
</span><span class="cx"> });
</span><span class="cx"> assert_true(actual.next().done);
</span><span class="cx"> assert_true(actual.next().done);
</span><ins>+
+ for (key of headers.keys())
+ assert_true(sortedHeaderKeys.indexOf(key) != -1);
</ins><span class="cx"> }, "Check keys method");
</span><span class="cx">
</span><span class="cx"> test(function() {
</span><span class="cx"> var headers = new Headers(headerEntriesDict);
</span><span class="cx"> var actual = headers.values();
</span><ins>+ checkIteratorProperties(actual);
</ins><span class="cx">
</span><span class="cx"> sortedHeaderKeys.forEach(function(key) {
</span><span class="cx"> entry = actual.next();
</span><span class="lines">@@ -148,11 +167,15 @@
</span><span class="cx"> });
</span><span class="cx"> assert_true(actual.next().done);
</span><span class="cx"> assert_true(actual.next().done);
</span><ins>+
+ for (value of headers.values())
+ assert_true(headerValues.indexOf(value) != -1);
</ins><span class="cx"> }, "Check values method");
</span><span class="cx">
</span><span class="cx"> test(function() {
</span><span class="cx"> var headers = new Headers(headerEntriesDict);
</span><span class="cx"> var actual = headers.entries();
</span><ins>+ checkIteratorProperties(actual);
</ins><span class="cx">
</span><span class="cx"> sortedHeaderKeys.forEach(function(key) {
</span><span class="cx"> entry = actual.next();
</span><span class="lines">@@ -162,6 +185,9 @@
</span><span class="cx"> });
</span><span class="cx"> assert_true(actual.next().done);
</span><span class="cx"> assert_true(actual.next().done);
</span><ins>+
+ for (entry of headers.entries())
+ assert_equals(entry[1], sortedHeaderDict[entry[0]]);
</ins><span class="cx"> }, "Check entries method");
</span><span class="cx">
</span><span class="cx"> test(function() {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203234 => 203235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-14 19:30:09 UTC (rev 203234)
+++ trunk/Source/WebCore/ChangeLog        2016-07-14 19:32:24 UTC (rev 203235)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2016-07-14 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><ins>+ DOMIterators should be assigned a correct prototype
+ https://bugs.webkit.org/show_bug.cgi?id=159115
+
+ Reviewed by Chris Dumez.
+
+ Default iterator object internal prototype property is the Iterator prototype as defined in
+ http://heycam.github.io/webidl/#dfn-iterator-prototype-object.
+ Linking DOMIterator prototype to IteratorPrototype.
+ This allows adding @@iterator property to the result of entries, keys and values methods.
+ This in turns allow doing for-of loops on them.
+
+ Covered by updated test.
+
+ * ForwardingHeaders/runtime/IteratorPrototype.h: Added.
+ * bindings/js/JSDOMIterator.h: Setting correct prototype and marking next prototype property as enumerable.
+
+2016-07-14 Youenn Fablet <youenn@apple.com>
+
</ins><span class="cx"> Remove support for value iterators from JSDOMIterator
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=159293
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersruntimeIteratorPrototypeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/runtime/IteratorPrototype.h (0 => 203235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/runtime/IteratorPrototype.h         (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/IteratorPrototype.h        2016-07-14 19:32:24 UTC (rev 203235)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+#pragma once
+#include <JavaScriptCore/IteratorPrototype.h>
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMIterator.h (203234 => 203235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMIterator.h        2016-07-14 19:30:09 UTC (rev 203234)
+++ trunk/Source/WebCore/bindings/js/JSDOMIterator.h        2016-07-14 19:32:24 UTC (rev 203235)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define JSDOMIterator_h
</span><span class="cx">
</span><span class="cx"> #include "JSDOMBinding.h"
</span><ins>+#include <runtime/IteratorPrototype.h>
</ins><span class="cx"> #include <runtime/JSDestructibleObject.h>
</span><span class="cx"> #include <type_traits>
</span><span class="cx">
</span><span class="lines">@@ -97,7 +98,7 @@
</span><span class="cx"> static JSDOMIteratorPrototype<JSWrapper>* createPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
</span><span class="cx"> {
</span><span class="cx"> return JSDOMIteratorPrototype<JSWrapper>::create(vm, globalObject,
</span><del>- JSDOMIteratorPrototype<JSWrapper>::createStructure(vm, globalObject, globalObject->objectPrototype()));
</del><ins>+ JSDOMIteratorPrototype<JSWrapper>::createStructure(vm, globalObject, globalObject->iteratorPrototype()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JSC::JSValue next(JSC::ExecState&);
</span><span class="lines">@@ -238,7 +239,7 @@
</span><span class="cx"> Base::finishCreation(vm);
</span><span class="cx"> ASSERT(inherits(info()));
</span><span class="cx">
</span><del>- JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, next, JSC::DontEnum, 0, JSC::NoIntrinsic);
</del><ins>+ JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, next, 0, 0, JSC::NoIntrinsic);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>