<!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>[203445] trunk/Source/WebCore</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/203445">203445</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-19 23:23:13 -0700 (Tue, 19 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Add a JS builtin to implement https://fetch.spec.whatwg.org/#concept-headers-fill
https://bugs.webkit.org/show_bug.cgi?id=159932

Patch by Youenn Fablet &lt;youenn@apple.com&gt; on 2016-07-19
Reviewed by Alex Christensen.

Covered by existing tests.

Refactoring Headers initializeWith to use the new built-in internal that implements
https://fetch.spec.whatwg.org/#concept-headers-fill.

Refactoring Response constructor to put more checks in the JS builtin fucntion called within constructor.
Making use of the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill.

* CMakeLists.txt: Adding FetchHeadersInternals.js
* DerivedSources.make: Ditto.
* Modules/fetch/FetchHeaders.js:
(initializeFetchHeaders): Using fillFetchHeaders new built-in internal.
* Modules/fetch/FetchInternals.js: Added.
(fillFetchHeaders):
* Modules/fetch/FetchResponse.cpp: Refactoring to do more in the JS built-in. Splitting of initializeWith so
that the checks are done in the order defined by the spec.
(WebCore::FetchResponse::setStatus):
(WebCore::FetchResponse::initializeWith):
(WebCore::isNullBodyStatus): Deleted.
* Modules/fetch/FetchResponse.h:
* Modules/fetch/FetchResponse.idl:
* Modules/fetch/FetchResponse.js:
(initializeFetchResponse): New built-in internal.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchHeadersjs">trunk/Source/WebCore/Modules/fetch/FetchHeaders.js</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseh">trunk/Source/WebCore/Modules/fetch/FetchResponse.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseidl">trunk/Source/WebCore/Modules/fetch/FetchResponse.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsejs">trunk/Source/WebCore/Modules/fetch/FetchResponse.js</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsWebCoreBuiltinNamesh">trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesfetchFetchInternalsjs">trunk/Source/WebCore/Modules/fetch/FetchInternals.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -3711,6 +3711,7 @@
</span><span class="cx"> 
</span><span class="cx"> set(WebCore_BUILTINS_SOURCES
</span><span class="cx">     ${WEBCORE_DIR}/Modules/fetch/FetchHeaders.js
</span><ins>+    ${WEBCORE_DIR}/Modules/fetch/FetchInternals.js
</ins><span class="cx">     ${WEBCORE_DIR}/Modules/fetch/FetchResponse.js
</span><span class="cx">     ${WEBCORE_DIR}/Modules/mediastream/MediaDevices.js
</span><span class="cx">     ${WEBCORE_DIR}/Modules/mediastream/NavigatorUserMedia.js
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/ChangeLog        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2016-07-19  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        [Fetch API] Add a JS builtin to implement https://fetch.spec.whatwg.org/#concept-headers-fill
+        https://bugs.webkit.org/show_bug.cgi?id=159932
+
+        Reviewed by Alex Christensen.
+
+        Covered by existing tests.
+
+        Refactoring Headers initializeWith to use the new built-in internal that implements
+        https://fetch.spec.whatwg.org/#concept-headers-fill.
+
+        Refactoring Response constructor to put more checks in the JS builtin fucntion called within constructor.
+        Making use of the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill.
+
+        * CMakeLists.txt: Adding FetchHeadersInternals.js
+        * DerivedSources.make: Ditto.
+        * Modules/fetch/FetchHeaders.js:
+        (initializeFetchHeaders): Using fillFetchHeaders new built-in internal.
+        * Modules/fetch/FetchInternals.js: Added.
+        (fillFetchHeaders):
+        * Modules/fetch/FetchResponse.cpp: Refactoring to do more in the JS built-in. Splitting of initializeWith so
+        that the checks are done in the order defined by the spec.
+        (WebCore::FetchResponse::setStatus):
+        (WebCore::FetchResponse::initializeWith):
+        (WebCore::isNullBodyStatus): Deleted.
+        * Modules/fetch/FetchResponse.h:
+        * Modules/fetch/FetchResponse.idl:
+        * Modules/fetch/FetchResponse.js:
+        (initializeFetchResponse): New built-in internal.
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
</ins><span class="cx"> 2016-07-19  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix null handling of SVGScriptElement.type attribute
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/DerivedSources.make        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -1284,6 +1284,7 @@
</span><span class="cx"> 
</span><span class="cx"> WebCore_BUILTINS_SOURCES = \
</span><span class="cx">     $(WebCore)/Modules/fetch/FetchHeaders.js \
</span><ins>+    $(WebCore)/Modules/fetch/FetchInternals.js \
</ins><span class="cx">     $(WebCore)/Modules/fetch/FetchResponse.js \
</span><span class="cx">     $(WebCore)/Modules/mediastream/MediaDevices.js \
</span><span class="cx">     $(WebCore)/Modules/mediastream/NavigatorUserMedia.js \
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchHeadersjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchHeaders.js (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchHeaders.js        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/Modules/fetch/FetchHeaders.js        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -35,26 +35,7 @@
</span><span class="cx">     if (!@isObject(headersInit))
</span><span class="cx">         throw new @TypeError(&quot;headersInit must be an object&quot;);
</span><span class="cx"> 
</span><del>-    if (headersInit instanceof @Headers) {
-        this.@fillFromJS(headersInit);
-        return this;
-    }
</del><ins>+    @fillFetchHeaders(this, headersInit);
</ins><span class="cx"> 
</span><del>-    if (@isArray(headersInit)) {
-        for (let i = 0; i &lt; headersInit.length; i++) {
-            let header = headersInit[i];
-            if (header.length !== 2)
-                throw new @TypeError(&quot;headersInit sequence items should contain two values&quot;);
-            this.@appendFromJS(header[0], header[1]);
-        }
-        return this;
-    }
-
-    let propertyNames = @Object.@getOwnPropertyNames(headersInit);
-    for (let i = 0; i &lt; propertyNames.length; ++i) {
-        let name = propertyNames[i];
-        this.@appendFromJS(name, headersInit[name]);
-    }
-
</del><span class="cx">     return this;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchInternalsjsfromrev203444trunkSourceWebCoreModulesfetchFetchHeadersjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/fetch/FetchInternals.js (from rev 203444, trunk/Source/WebCore/Modules/fetch/FetchHeaders.js) (0 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchInternals.js                                (rev 0)
+++ trunk/Source/WebCore/Modules/fetch/FetchInternals.js        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// @conditional=ENABLE(FETCH_API)
+// @internal
+
+function fillFetchHeaders(headers, headersInit)
+{
+    &quot;use strict&quot;;
+
+    if (headersInit instanceof @Headers) {
+        @Headers.prototype.@fillFromJS.@call(headers, headersInit);
+        return;
+    }
+
+    if (@isArray(headersInit)) {
+        for (let i = 0; i &lt; headersInit.length; i++) {
+            let header = headersInit[i];
+            if (header.length !== 2)
+                throw new @TypeError(&quot;headersInit sequence items should contain two values&quot;);
+            @Headers.prototype.@appendFromJS.@call(headers, header[0], header[1]);
+        }
+        return this;
+    }
+
+    let propertyNames = @Object.@getOwnPropertyNames(headersInit);
+    for (let i = 0; i &lt; propertyNames.length; ++i) {
+        let name = propertyNames[i];
+        @Headers.prototype.@appendFromJS.@call(headers, name, headersInit[name]);
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx"> 
</span><del>-#include &quot;Dictionary.h&quot;
</del><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;FetchRequest.h&quot;
</span><span class="cx"> #include &quot;HTTPParsers.h&quot;
</span><span class="lines">@@ -45,11 +44,6 @@
</span><span class="cx">     return status == 301 || status == 302 || status == 303 || status == 307 || status == 308;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool isNullBodyStatus(int status)
-{
-    return status == 101 || status == 204 || status == 205 || status == 304;
-}
-
</del><span class="cx"> Ref&lt;FetchResponse&gt; FetchResponse::error(ScriptExecutionContext&amp; context)
</span><span class="cx"> {
</span><span class="cx">     auto response = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</span><span class="lines">@@ -75,40 +69,21 @@
</span><span class="cx">     return WTFMove(redirectResponse);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FetchResponse::initializeWith(const Dictionary&amp; init, ExceptionCode&amp; ec)
</del><ins>+void FetchResponse::setStatus(int status, const String&amp; statusText, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    int status;
-    if (!init.get(&quot;status&quot;, status)) {
</del><ins>+    if (!isValidReasonPhrase(statusText)) {
</ins><span class="cx">         ec = TypeError;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (status &lt; 200 || status &gt; 599) {
-        ec = RangeError;
-        return;
-    }
-
-    String statusText;
-    if (!init.get(&quot;statusText&quot;, statusText) || !isValidReasonPhrase(statusText)) {
-        ec = TypeError;
-        return;
-    }
</del><span class="cx">     m_response.setHTTPStatusCode(status);
</span><span class="cx">     m_response.setHTTPStatusText(statusText);
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;FetchHeaders&gt; initialHeaders;
-    if (init.get(&quot;headers&quot;, initialHeaders))
-        m_headers-&gt;fill(initialHeaders.get());
-
-    JSC::JSValue body;
-    if (init.get(&quot;body&quot;, body)) {
-        if (isNullBodyStatus(status)) {
-            ec = TypeError;
-            return;
-        }
-        m_body = FetchBody::extract(*init.execState(), body);
-        if (m_headers-&gt;fastGet(HTTPHeaderName::ContentType).isEmpty() &amp;&amp; !m_body.mimeType().isEmpty())
-            m_headers-&gt;fastSet(HTTPHeaderName::ContentType, m_body.mimeType());
-    }
</del><ins>+void FetchResponse::initializeWith(JSC::ExecState&amp; execState, JSC::JSValue body)
+{
+    m_body = FetchBody::extract(execState, body);
+    if (m_headers-&gt;fastGet(HTTPHeaderName::ContentType).isEmpty() &amp;&amp; !m_body.mimeType().isEmpty())
+        m_headers-&gt;fastSet(HTTPHeaderName::ContentType, m_body.mimeType());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FetchResponse::FetchResponse(ScriptExecutionContext&amp; context, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, ResourceResponse&amp;&amp; response)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.h (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -36,6 +36,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> class ArrayBuffer;
</span><ins>+class ExecState;
+class JSValue;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -58,8 +60,10 @@
</span><span class="cx">     static void fetch(ScriptExecutionContext&amp;, FetchRequest&amp;, const Dictionary&amp;, FetchPromise&amp;&amp;);
</span><span class="cx">     static void fetch(ScriptExecutionContext&amp;, const String&amp;, const Dictionary&amp;, FetchPromise&amp;&amp;);
</span><span class="cx"> 
</span><del>-    void initializeWith(const Dictionary&amp;, ExceptionCode&amp;);
</del><span class="cx"> 
</span><ins>+    void setStatus(int, const String&amp;, ExceptionCode&amp;);
+    void initializeWith(JSC::ExecState&amp;, JSC::JSValue);
+
</ins><span class="cx">     Type type() const { return m_response.type(); }
</span><span class="cx">     const String&amp; url() const;
</span><span class="cx">     bool redirected() const { return m_response.isRedirected(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.idl (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> 
</span><span class="cx">     [NewObject, CallWith=ScriptExecutionContext, RaisesException] FetchResponse clone();
</span><span class="cx"> 
</span><del>-    [PrivateIdentifier, RaisesException] void initializeWith(Dictionary parameters);
</del><ins>+    [PrivateIdentifier, RaisesException] void setStatus(unsigned short status, DOMString statusText);
+    [CallWith=ScriptState, PrivateIdentifier] void initializeWith(any body);
</ins><span class="cx"> };
</span><span class="cx"> FetchResponse implements FetchBody;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.js (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.js        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.js        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -29,24 +29,27 @@
</span><span class="cx"> {
</span><span class="cx">     &quot;use strict&quot;;
</span><span class="cx"> 
</span><del>-    let parameters = { };
-    if (init !== @undefined) {
-        if (!@isObject(init))
-            throw new @TypeError(&quot;Response init must be an object&quot;);
-        parameters.status = init.status;
-        parameters.statusText = init.statusText;
-        if (init.headers)
-            parameters.headers = (init.headers instanceof @Headers) ? init.headers : new @Headers(init.headers);
-    }
</del><ins>+    if (init === @undefined)
+        init = { };
+    else if (!@isObject(init))
+        throw new @TypeError(&quot;Response init must be an object&quot;);
</ins><span class="cx"> 
</span><del>-    if (parameters.status === @undefined)
-        parameters.status = 200;
-    if (parameters.statusText === @undefined)
-        parameters.statusText = &quot;OK&quot;;
</del><ins>+    let status = (init.status !== @undefined) ? @toNumber(init.status) : 200;
+    if (status &lt; 200  || status &gt; 599)
+        throw new @RangeError(&quot;Status must be between 200 and 599&quot;);
</ins><span class="cx"> 
</span><del>-    if (body !== @undefined &amp;&amp; body !== null)
-         parameters.body = body;
</del><ins>+    let statusText = (init.statusText !== @undefined) ? init.statusText : &quot;OK&quot;;
</ins><span class="cx"> 
</span><del>-    this.@initializeWith(parameters);
</del><ins>+    this.@setStatus(status, statusText);
+
+    if (init.headers !== @undefined)
+        @fillFetchHeaders(this.headers, init.headers);
+
+    if (body !== @undefined &amp;&amp; body !== null) {
+        if (status == 101 || status == 204 || status == 205 || status == 304)
+            throw new @TypeError(&quot;Response cannot have a body with the given status&quot;);
+        this.@initializeWith(body);
+    }
+
</ins><span class="cx">     return this;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -1596,6 +1596,7 @@
</span><span class="cx">                 4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A4551011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp */; };
</span><span class="cx">                 4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */; };
</span><span class="cx">                 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
</span><ins>+                416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 416E6FE81BBD12DF000A6033 /* StreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764E9 /* WritableStreamInternalsBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -11815,6 +11816,7 @@
</span><span class="cx">                 9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableStreamBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9908B0FA1BCAD07D00ED0F65 /* ReadableStreamControllerBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamControllerBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9908B0FB1BCAD07D00ED0F65 /* ReadableStreamControllerBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamControllerBuiltins.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                9908B0FD1BCAD07D00ED0F45 /* FetchInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchInternalsBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9908B0FD1BCAD07D00ED0F55 /* StreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamInternalsBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9908B0FD1BCAD07D00ED0F65 /* ReadableStreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamInternalsBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9908B0FD1BCAD07D00ED0F75 /* WritableStreamInternalsBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableStreamInternalsBuiltins.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -11857,6 +11859,7 @@
</span><span class="cx">                 9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchInternalsBuiltins.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamInternalsBuiltins.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamInternalsBuiltins.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17919,7 +17922,9 @@
</span><span class="cx">                                 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */,
</span><span class="cx">                                 9908B0FA1BCAD07D00ED0F65 /* ReadableStreamControllerBuiltins.cpp */,
</span><span class="cx">                                 9908B0FB1BCAD07D00ED0F65 /* ReadableStreamControllerBuiltins.h */,
</span><ins>+                                9908B0FD1BCAD07D00ED0F45 /* FetchInternalsBuiltins.cpp */,
</ins><span class="cx">                                 9908B0FD1BCAD07D00ED0F65 /* ReadableStreamInternalsBuiltins.cpp */,
</span><ins>+                                9B03D8061BB3110D00B764B9 /* FetchInternalsBuiltins.h */,
</ins><span class="cx">                                 9B03D8061BB3110D00B764D9 /* ReadableStreamInternalsBuiltins.h */,
</span><span class="cx">                                 9908B0FE1BCAD07D00ED0F65 /* ReadableStreamReaderBuiltins.cpp */,
</span><span class="cx">                                 9908B0FF1BCAD07D00ED0F65 /* ReadableStreamReaderBuiltins.h */,
</span><span class="lines">@@ -27853,6 +27858,7 @@
</span><span class="cx">                                 6E84E9E117668BF100815B68 /* RasterShape.h in Headers */,
</span><span class="cx">                                 A84D827C11D333ED00972990 /* RawDataDocumentParser.h in Headers */,
</span><span class="cx">                                 416E6FE91BBD12E5000A6043 /* ReadableStreamBuiltins.h in Headers */,
</span><ins>+                                416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */,
</ins><span class="cx">                                 416E6FE81BBD12DF000A6043 /* ReadableStreamInternalsBuiltins.h in Headers */,
</span><span class="cx">                                 FD31603C12B0267600C1A359 /* RealtimeAnalyser.h in Headers */,
</span><span class="cx">                                 4A4F65711AA997F100E38CDD /* RealtimeMediaSource.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsWebCoreBuiltinNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (203444 => 203445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h        2016-07-20 05:13:06 UTC (rev 203444)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h        2016-07-20 06:23:13 UTC (rev 203445)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx">     macro(readRequests) \
</span><span class="cx">     macro(readyPromiseCapability) \
</span><span class="cx">     macro(removeTrack) \
</span><ins>+    macro(setStatus) \
</ins><span class="cx">     macro(state) \
</span><span class="cx">     macro(started) \
</span><span class="cx">     macro(startedPromise) \
</span></span></pre>
</div>
</div>

</body>
</html>