<!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>[204225] 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/204225">204225</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-06 01:51:01 -0700 (Sat, 06 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Fetching with a FormData body should reject until it is implemented
https://bugs.webkit.org/show_bug.cgi?id=160595

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

LayoutTests/imported/w3c:

Adding new tests to cover changes.
Removing HEAD with body test as it throws as expected and is redundant with
web-platform-tests/fetch/api/request/request-init-002.html.

* web-platform-tests/fetch/api/basic/request-headers-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers.js:
(checkContentType):
(requestHeaders):

Source/WebCore:

Covered by updated tests.

This patch ensures that fetch will throw if trying to upload something that is not supported.
This is the case of BufferSource (FetchBody does not yet extract it) and FormData (no upload support yet).

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract): Added a FIXME.
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::bodyType): Getter used by FetchResponse.
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::setBody): Throwing if given body parameter cannot be extracted by FetchBody.
This ensures that a fetch with a body that cannot be uploaded will fail.
This is the case of BufferSource which is not yet supported.
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::fetch): Rejecting fetch promise if trying to upload a FormData as it is not implemented.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchBodycpp">trunk/Source/WebCore/Modules/fetch/FetchBody.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchBodyOwnerh">trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequestcpp">trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2016-08-06  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [Fetch API] Fetching with a FormData body should reject until it is implemented
+        https://bugs.webkit.org/show_bug.cgi?id=160595
+
+        Reviewed by Alex Christensen.
+
+        Adding new tests to cover changes.
+        Removing HEAD with body test as it throws as expected and is redundant with
+        web-platform-tests/fetch/api/request/request-init-002.html.
+
+        * web-platform-tests/fetch/api/basic/request-headers-expected.txt:
+        * web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
+        * web-platform-tests/fetch/api/basic/request-headers.js:
+        (checkContentType):
+        (requestHeaders):
+
+2016-08-06  Youenn Fablet  &lt;youenn@apple.com&gt;
+
</ins><span class="cx">         [Fetch API] Fetch API should strip fragment and credentials from URLs used as referrer
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160593
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -1,11 +1,14 @@
</span><span class="cx"> 
</span><del>-FAIL Fetch with GET assert_equals: Request has header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
-FAIL Fetch with HEAD assert_equals: Request has header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
-FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+FAIL Fetch with GET assert_equals: Request should have header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
+FAIL Fetch with HEAD assert_equals: Request should have header content-length: null expected (object) null but got (string) &quot;0&quot;
</ins><span class="cx"> PASS Fetch with PUT without body 
</span><span class="cx"> PASS Fetch with PUT with body 
</span><span class="cx"> PASS Fetch with POST without body 
</span><del>-PASS Fetch with POST with body 
-FAIL Fetch with Chicken assert_equals: Request has header content-length: null expected (object) null but got (string) &quot;0&quot;
</del><ins>+PASS Fetch with POST with text body 
+FAIL Fetch with POST with FormData body promise_test: Unhandled rejection with value: object &quot;TypeError: Uploading FormData is not yet implemented&quot;
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) &quot;application/x-www-form-urlencoded&quot;
+FAIL Fetch with POST with ArrayBuffer body promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
+PASS Fetch with POST with Blob body with mime type 
+FAIL Fetch with Chicken assert_equals: Request should have header content-length: null expected (object) null but got (string) &quot;0&quot;
</ins><span class="cx"> PASS Fetch with Chicken with body 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -1,11 +1,13 @@
</span><span class="cx"> 
</span><del>-FAIL Fetch with GET assert_equals: Request has header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
-FAIL Fetch with HEAD assert_equals: Request has header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
-FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+FAIL Fetch with GET assert_equals: Request should have header origin: http://localhost:8800 expected (string) &quot;http://localhost:8800&quot; but got (object) null
+FAIL Fetch with HEAD assert_equals: Request should have header content-length: null expected (object) null but got (string) &quot;0&quot;
</ins><span class="cx"> PASS Fetch with PUT without body 
</span><span class="cx"> PASS Fetch with PUT with body 
</span><span class="cx"> PASS Fetch with POST without body 
</span><del>-PASS Fetch with POST with body 
-FAIL Fetch with Chicken assert_equals: Request has header content-length: null expected (object) null but got (string) &quot;0&quot;
</del><ins>+PASS Fetch with POST with text body 
+FAIL Fetch with POST with Blob body assert_equals: Request should have header content-type: null expected (object) null but got (string) &quot;application/x-www-form-urlencoded&quot;
+FAIL Fetch with POST with ArrayBuffer body promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
+PASS Fetch with POST with Blob body with mime type 
+FAIL Fetch with Chicken assert_equals: Request should have header content-length: null expected (object) null but got (string) &quot;0&quot;
</ins><span class="cx"> PASS Fetch with Chicken with body 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.js        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -3,8 +3,24 @@
</span><span class="cx">   importScripts(&quot;../resources/utils.js&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function checkContentType(contentType, body)
+{
+    if (self.FormData &amp;&amp; body instanceof self.FormData) {
+        assert_true(contentType.startsWith(&quot;multipart/form-data;boundary=&quot;), &quot;Request should have header content-type starting with multipart/form-data;boundary=, but got &quot; + contentType);
+        return;
+    }
+
+    var expectedContentType = &quot;text/plain;charset=UTF-8&quot;;
+    if(body === null || body instanceof ArrayBuffer)
+        expectedContentType = null;
+    else if (body instanceof Blob)
+        expectedContentType = body.type ? body.type : null;
+
+    assert_equals(contentType , expectedContentType, &quot;Request should have header content-type: &quot; + expectedContentType);
+}
+
</ins><span class="cx"> function requestHeaders(desc, url, method, body, expectedOrigin, expectedContentLength) {
</span><del>-  var urlParameters = &quot;?headers=origin|user-agent|accept-charset|content-length&quot;;
</del><ins>+  var urlParameters = &quot;?headers=origin|user-agent|accept-charset|content-length|content-type&quot;;
</ins><span class="cx">   var requestInit = {&quot;method&quot;: method}
</span><span class="cx">   if (body)
</span><span class="cx">     requestInit[&quot;body&quot;] = body;
</span><span class="lines">@@ -12,10 +28,12 @@
</span><span class="cx">     return fetch(url + urlParameters, requestInit).then(function(resp) {
</span><span class="cx">       assert_equals(resp.status, 200, &quot;HTTP status is 200&quot;);
</span><span class="cx">       assert_equals(resp.type , &quot;basic&quot;, &quot;Response's type is basic&quot;);
</span><del>-      assert_equals(resp.headers.get(&quot;x-request-origin&quot;) , expectedOrigin, &quot;Request has header origin: &quot; + expectedOrigin);
-      assert_equals(resp.headers.get(&quot;x-request-content-length&quot;) , expectedContentLength, &quot;Request has header content-length: &quot; + expectedContentLength);
</del><ins>+      checkContentType(resp.headers.get(&quot;x-request-content-type&quot;), body);
+      if (expectedContentLength !== undefined)
+        assert_equals(resp.headers.get(&quot;x-request-content-length&quot;) , expectedContentLength, &quot;Request should have header content-length: &quot; + expectedContentLength);
</ins><span class="cx">       assert_true(resp.headers.has(&quot;x-request-user-agent&quot;), &quot;Request has header user-agent&quot;);
</span><span class="cx">       assert_false(resp.headers.has(&quot;accept-charset&quot;), &quot;Request has header accept-charset&quot;);
</span><ins>+      assert_equals(resp.headers.get(&quot;x-request-origin&quot;) , expectedOrigin, &quot;Request should have header origin: &quot; + expectedOrigin);
</ins><span class="cx">     });
</span><span class="cx">   }, desc);
</span><span class="cx"> }
</span><span class="lines">@@ -24,11 +42,15 @@
</span><span class="cx"> 
</span><span class="cx"> requestHeaders(&quot;Fetch with GET&quot;, url, &quot;GET&quot;, null, location.origin, null);
</span><span class="cx"> requestHeaders(&quot;Fetch with HEAD&quot;, url, &quot;HEAD&quot;, null, location.origin, null);
</span><del>-requestHeaders(&quot;Fetch with HEAD with body&quot;, url, &quot;HEAD&quot;, &quot;Request's body&quot;, location.origin, &quot;14&quot;);
</del><span class="cx"> requestHeaders(&quot;Fetch with PUT without body&quot;, url, &quot;POST&quot;, null, location.origin, &quot;0&quot;);
</span><span class="cx"> requestHeaders(&quot;Fetch with PUT with body&quot;, url, &quot;PUT&quot;, &quot;Request's body&quot;, location.origin, &quot;14&quot;);
</span><span class="cx"> requestHeaders(&quot;Fetch with POST without body&quot;, url, &quot;POST&quot;, null, location.origin, &quot;0&quot;);
</span><del>-requestHeaders(&quot;Fetch with POST with body&quot;, url, &quot;POST&quot;, &quot;Request's body&quot;, location.origin, &quot;14&quot;);
</del><ins>+requestHeaders(&quot;Fetch with POST with text body&quot;, url, &quot;POST&quot;, &quot;Request's body&quot;, location.origin, &quot;14&quot;);
+if (self.FormData)
+    requestHeaders(&quot;Fetch with POST with FormData body&quot;, url, &quot;POST&quot;, new FormData(), location.origin);
+requestHeaders(&quot;Fetch with POST with Blob body&quot;, url, &quot;POST&quot;, new Blob([&quot;Test&quot;]), location.origin, &quot;4&quot;);
+requestHeaders(&quot;Fetch with POST with ArrayBuffer body&quot;, url, &quot;POST&quot;, new ArrayBuffer(4), location.origin, &quot;4&quot;);
+requestHeaders(&quot;Fetch with POST with Blob body with mime type&quot;, url, &quot;POST&quot;, new Blob([&quot;Test&quot;], { type: &quot;text/maybe&quot; }), location.origin, &quot;4&quot;);
</ins><span class="cx"> requestHeaders(&quot;Fetch with Chicken&quot;, url, &quot;Chicken&quot;, null, location.origin, null);
</span><span class="cx"> requestHeaders(&quot;Fetch with Chicken with body&quot;, url, &quot;Chicken&quot;, &quot;Request's body&quot;, location.origin, &quot;14&quot;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/Source/WebCore/ChangeLog        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2016-08-06  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [Fetch API] Fetching with a FormData body should reject until it is implemented
+        https://bugs.webkit.org/show_bug.cgi?id=160595
+
+        Reviewed by Alex Christensen.
+
+        Covered by updated tests.
+
+        This patch ensures that fetch will throw if trying to upload something that is not supported.
+        This is the case of BufferSource (FetchBody does not yet extract it) and FormData (no upload support yet).
+
+        * Modules/fetch/FetchBody.cpp:
+        (WebCore::FetchBody::extract): Added a FIXME.
+        * Modules/fetch/FetchBodyOwner.h:
+        (WebCore::FetchBodyOwner::bodyType): Getter used by FetchResponse.
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::FetchRequest::setBody): Throwing if given body parameter cannot be extracted by FetchBody.
+        This ensures that a fetch with a body that cannot be uploaded will fail.
+        This is the case of BufferSource which is not yet supported.
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::fetch): Rejecting fetch promise if trying to upload a FormData as it is not implemented.
+
+2016-08-06  Youenn Fablet  &lt;youenn@apple.com&gt;
+
</ins><span class="cx">         [Fetch API] Fetch API should strip fragment and credentials from URLs used as referrer
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160593
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchBodycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.cpp (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchBody.cpp        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.cpp        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">         return FetchBody(value.toWTFString(&amp;state));
</span><span class="cx">     if (value.inherits(JSReadableStream::info()))
</span><span class="cx">         return { Type::ReadableStream };
</span><ins>+    // FIXME: Implement BufferSource extraction.
</ins><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchBodyOwnerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isActive() const { return !!m_blobLoader; }
</span><span class="cx"> 
</span><ins>+    FetchBody::Type bodyType() const { return m_body.type(); }
+
</ins><span class="cx"> protected:
</span><span class="cx">     const FetchBody&amp; body() const { return m_body; }
</span><span class="cx">     FetchBody&amp; body() { return m_body; }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -256,8 +256,13 @@
</span><span class="cx"> 
</span><span class="cx"> void FetchRequest::setBody(JSC::ExecState&amp; execState, JSC::JSValue body, FetchRequest* request, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (!body.isNull())
</del><ins>+    if (!body.isNull()) {
</ins><span class="cx">         m_body = FetchBody::extract(execState, body);
</span><ins>+        if (m_body.type() == FetchBody::Type::None) {
+            ec = TypeError;
+            return;
+        }
+    }
</ins><span class="cx">     else if (request &amp;&amp; !request-&gt;m_body.isEmpty()) {
</span><span class="cx">         m_body = FetchBody::extractFromBody(&amp;request-&gt;m_body);
</span><span class="cx">         request-&gt;setDisturbed();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (204224 => 204225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-08-06 08:50:13 UTC (rev 204224)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-08-06 08:51:01 UTC (rev 204225)
</span><span class="lines">@@ -105,6 +105,11 @@
</span><span class="cx"> {
</span><span class="cx">     auto response = adoptRef(*new FetchResponse(context, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</span><span class="cx"> 
</span><ins>+    // FIXME: Implement form data upload.
+    if (request.bodyType() == FetchBody::Type::FormData) {
+        promise.reject(TypeError, &quot;Uploading FormData is not yet implemented&quot;);
+        return;
+    }
</ins><span class="cx">     // Setting pending activity until BodyLoader didFail or didSucceed callback is called.
</span><span class="cx">     response-&gt;setPendingActivity(response.ptr());
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>