<!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>[205251] 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/205251">205251</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-31 09:36:57 -0700 (Wed, 31 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Response bodyUsed should check for its body disturbed state
https://bugs.webkit.org/show_bug.cgi?id=161429

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

Source/WebCore:

Test: http/tests/fetch/bodyUsed-worker.html

Implementing bodyUsed as a JS Builtin.
This allows using directly @isReadableStreamDisturbed if response has a body.

Renaming isDisturbed to isDisturbedOrLocked to better match fetch spec terminology.

* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::isDisturbedOrLocked): Renaming isDisturbed to isDisturbedOrLocked.
(WebCore::FetchBodyOwner::arrayBuffer): Ditto.
(WebCore::FetchBodyOwner::blob): Ditto.
(WebCore::FetchBodyOwner::formData): Ditto.
(WebCore::FetchBodyOwner::json): Ditto.
(WebCore::FetchBodyOwner::text): Ditto.
(WebCore::FetchBodyOwner::isDisturbed): Ditto.
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::isDisturbed): Ditto.
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::initializeWith): Ditto.
(WebCore::FetchRequest::clone): Ditto.
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::cloneForJS): Ditto.
(WebCore::FetchResponse::createReadableStreamSource): Only asserting for isDisturbed.
* Modules/fetch/FetchResponse.idl: Marking bodyUsed as JS builtin.
* Modules/fetch/FetchResponse.js: Adding bodyUsed.
(bodyUsed):
(clone):

LayoutTests:

* http/tests/fetch/bodyUsed-expected.txt: Added.
* http/tests/fetch/bodyUsed-worker-expected.txt: Added.
* http/tests/fetch/bodyUsed-worker.html: Added.
* http/tests/fetch/bodyUsed.js: Added.
* http/tests/fetch/window/body-mixin-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchBodyOwnercpp">trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.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>
<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>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsfetchbodyUsedexpectedtxt">trunk/LayoutTests/http/tests/fetch/bodyUsed-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsfetchbodyUsedworkerexpectedtxt">trunk/LayoutTests/http/tests/fetch/bodyUsed-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsfetchbodyUsedworkerhtml">trunk/LayoutTests/http/tests/fetch/bodyUsed-worker.html</a></li>
<li><a href="#trunkLayoutTestshttptestsfetchbodyUsedhtml">trunk/LayoutTests/http/tests/fetch/bodyUsed.html</a></li>
<li><a href="#trunkLayoutTestshttptestsfetchbodyUsedjs">trunk/LayoutTests/http/tests/fetch/bodyUsed.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/LayoutTests/ChangeLog        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2016-08-31  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [Fetch API] Response bodyUsed should check for its body disturbed state
+        https://bugs.webkit.org/show_bug.cgi?id=161429
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/fetch/bodyUsed-expected.txt: Added.
+        * http/tests/fetch/bodyUsed-worker-expected.txt: Added.
+        * http/tests/fetch/bodyUsed-worker.html: Added.
+        * http/tests/fetch/bodyUsed.js: Added.
+        * http/tests/fetch/window/body-mixin-expected.txt:
+
+2016-08-31  Youenn Fablet  &lt;youenn@apple.com&gt;
+
</ins><span class="cx">         [Fetch API] Blob type should be correctly set in case of empty body
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=161431
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchbodyUsedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/bodyUsed-expected.txt (0 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/bodyUsed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/bodyUsed-expected.txt        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS BodyUsedShouldNotBeSetForNullBody 
+PASS BodyUsedShouldBeSetForEmptyBody 
+PASS BodyUsedShouldBeSetWhenRead 
+PASS BodyUsedShouldBeSetWhenCancelled 
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchbodyUsedworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/bodyUsed-worker-expected.txt (0 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/bodyUsed-worker-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/bodyUsed-worker-expected.txt        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS BodyUsedShouldNotBeSetForNullBody 
+PASS BodyUsedShouldBeSetForEmptyBody 
+PASS BodyUsedShouldBeSetWhenRead 
+PASS BodyUsedShouldBeSetWhenCancelled 
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchbodyUsedworkerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/bodyUsed-worker.html (0 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/bodyUsed-worker.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/bodyUsed-worker.html        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta charset=&quot;utf-8&quot;&gt;
+        &lt;title&gt;Response body used tests&lt;/title&gt;
+        &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#response&quot;&gt;
+        &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#body-mixin&quot;&gt;
+        &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script&gt;
+            fetch_tests_from_worker(new Worker(&quot;bodyUsed.js&quot;));
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchbodyUsedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/bodyUsed.html (0 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/bodyUsed.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/bodyUsed.html        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta charset=&quot;utf-8&quot;&gt;
+        &lt;title&gt;Response body used tests&lt;/title&gt;
+        &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#response&quot;&gt;
+        &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#body-mixin&quot;&gt;
+        &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script src=&quot;bodyUsed.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchbodyUsedjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/bodyUsed.js (0 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/bodyUsed.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/bodyUsed.js        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+if (this.document === undefined) {
+      importScripts(&quot;/resources/testharness.js&quot;);
+}
+
+// Four following tests are taken from Chromium fetch tests, see body-mixin.js file
+test(t =&gt; {
+    var req = new Request('/');
+    assert_false(req.bodyUsed);
+    req.text();
+    assert_false(req.bodyUsed);
+}, 'BodyUsedShouldNotBeSetForNullBody');
+
+test(t =&gt; {
+    var req = new Request('/', {method: 'POST', body: ''});
+    assert_false(req.bodyUsed);
+    req.text();
+    assert_true(req.bodyUsed);
+}, 'BodyUsedShouldBeSetForEmptyBody');
+
+test(t =&gt; {
+    var res = new Response('');
+    assert_false(res.bodyUsed);
+    var reader = res.body.getReader();
+    assert_false(res.bodyUsed);
+    reader.read();
+    assert_true(res.bodyUsed);
+}, 'BodyUsedShouldBeSetWhenRead');
+
+test(t =&gt; {
+    var res = new Response('');
+    assert_false(res.bodyUsed);
+    var reader = res.body.getReader();
+    assert_false(res.bodyUsed);
+    reader.cancel();
+    assert_true(res.bodyUsed);
+}, 'BodyUsedShouldBeSetWhenCancelled');
+
+done();
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/ChangeLog        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2016-08-31  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [Fetch API] Response bodyUsed should check for its body disturbed state
+        https://bugs.webkit.org/show_bug.cgi?id=161429
+
+        Reviewed by Alex Christensen.
+
+        Test: http/tests/fetch/bodyUsed-worker.html
+
+        Implementing bodyUsed as a JS Builtin.
+        This allows using directly @isReadableStreamDisturbed if response has a body.
+
+        Renaming isDisturbed to isDisturbedOrLocked to better match fetch spec terminology.
+
+        * Modules/fetch/FetchBodyOwner.cpp:
+        (WebCore::FetchBodyOwner::isDisturbedOrLocked): Renaming isDisturbed to isDisturbedOrLocked.
+        (WebCore::FetchBodyOwner::arrayBuffer): Ditto.
+        (WebCore::FetchBodyOwner::blob): Ditto.
+        (WebCore::FetchBodyOwner::formData): Ditto.
+        (WebCore::FetchBodyOwner::json): Ditto.
+        (WebCore::FetchBodyOwner::text): Ditto.
+        (WebCore::FetchBodyOwner::isDisturbed): Ditto.
+        * Modules/fetch/FetchBodyOwner.h:
+        (WebCore::FetchBodyOwner::isDisturbed): Ditto.
+        * Modules/fetch/FetchRequest.cpp:
+        (WebCore::FetchRequest::initializeWith): Ditto.
+        (WebCore::FetchRequest::clone): Ditto.
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::cloneForJS): Ditto.
+        (WebCore::FetchResponse::createReadableStreamSource): Only asserting for isDisturbed.
+        * Modules/fetch/FetchResponse.idl: Marking bodyUsed as JS builtin.
+        * Modules/fetch/FetchResponse.js: Adding bodyUsed.
+        (bodyUsed):
+        (clone):
+
+2016-08-31  Youenn Fablet  &lt;youenn@apple.com&gt;
+
</ins><span class="cx">         [Fetch API] Blob type should be correctly set in case of empty body
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=161431
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchBodyOwnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     ASSERT(!m_blobLoader);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FetchBodyOwner::isDisturbed() const
</del><ins>+bool FetchBodyOwner::isDisturbedOrLocked() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_isDisturbed)
</span><span class="cx">         return true;
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">         fulfillPromiseWithArrayBuffer(promise, nullptr, 0);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         promise.reject(TypeError);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         promise.resolve(Blob::create(Vector&lt;uint8_t&gt;(), Blob::normalizedContentType(extractMIMETypeFromMediaType(m_body.contentType()))));
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         promise.reject(TypeError);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">         promise.reject(0);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         promise.reject(TypeError);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">         promise.reject(SYNTAX_ERR);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         promise.reject(TypeError);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">         promise.resolve(String());
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         promise.reject(TypeError);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchBodyOwnerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     FetchBodyOwner(ScriptExecutionContext&amp;, FetchBody&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     // Exposed Body API
</span><del>-    bool isDisturbed() const;
</del><ins>+    bool isDisturbed() const { return m_isDisturbed; };
</ins><span class="cx"> 
</span><span class="cx">     void arrayBuffer(DeferredWrapper&amp;&amp;);
</span><span class="cx">     void blob(DeferredWrapper&amp;&amp;);
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx">     void json(DeferredWrapper&amp;&amp;);
</span><span class="cx">     void text(DeferredWrapper&amp;&amp;);
</span><span class="cx"> 
</span><ins>+    bool isDisturbedOrLocked() const;
+
</ins><span class="cx">     void loadBlob(Blob&amp;, FetchBodyConsumer*);
</span><span class="cx"> 
</span><span class="cx">     bool isActive() const { return !!m_blobLoader; }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx"> 
</span><span class="cx"> FetchHeaders* FetchRequest::initializeWith(FetchRequest&amp; input, const Dictionary&amp; init, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (input.isDisturbed()) {
</del><ins>+    if (input.isDisturbedOrLocked()) {
</ins><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="lines">@@ -308,7 +308,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;FetchRequest&gt; FetchRequest::clone(ScriptExecutionContext&amp; context, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (isDisturbed()) {
</del><ins>+    if (isDisturbedOrLocked()) {
</ins><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> Ref&lt;FetchResponse&gt; FetchResponse::cloneForJS()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scriptExecutionContext());
</span><del>-    ASSERT(!isDisturbed());
</del><ins>+    ASSERT(!isDisturbedOrLocked());
</ins><span class="cx">     return adoptRef(*new FetchResponse(*scriptExecutionContext(), FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx"> ReadableStreamSource* FetchResponse::createReadableStreamSource()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_readableStreamSource);
</span><del>-    ASSERT(!isDisturbed());
</del><ins>+    ASSERT(!m_isDisturbed);
</ins><span class="cx"> 
</span><span class="cx">     if (body().isEmpty())
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.idl (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.idl        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     [JSBuiltin] readonly attribute ReadableStream? body;
</span><span class="cx"> 
</span><span class="cx">     // Copy of FetchBody IDL as we want to implement some of these as built-ins.
</span><del>-    [ImplementedAs=isDisturbed] readonly attribute boolean bodyUsed;
</del><ins>+    [JSBuiltin] readonly attribute boolean bodyUsed;
</ins><span class="cx">     [JSBuiltin] Promise arrayBuffer();
</span><span class="cx">     [JSBuiltin] Promise blob();
</span><span class="cx">     [JSBuiltin] Promise formData();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.js (205250 => 205251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.js        2016-08-31 16:36:35 UTC (rev 205250)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.js        2016-08-31 16:36:57 UTC (rev 205251)
</span><span class="lines">@@ -60,6 +60,17 @@
</span><span class="cx">     return this;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bodyUsed()
+{
+   if (!(this instanceof @Response))
+        throw @makeGetterTypeError(&quot;Response&quot;, &quot;bodyUsed&quot;);
+
+    if (this.@body)
+        return @isReadableStreamDisturbed(this.@body);
+
+    return @Response.prototype.@isDisturbed.@call(this);
+}
+
</ins><span class="cx"> function body()
</span><span class="cx"> {
</span><span class="cx">     if (!(this instanceof @Response))
</span><span class="lines">@@ -83,7 +94,7 @@
</span><span class="cx">     if (!(this instanceof @Response))
</span><span class="cx">         throw @makeThisTypeError(&quot;Response&quot;, &quot;clone&quot;);
</span><span class="cx"> 
</span><del>-    if (@Response.prototype.@isDisturbed.@call(this))
</del><ins>+    if (@Response.prototype.@isDisturbed.@call(this) || (this.@body &amp;&amp; @isReadableStreamLocked(this.@body)))
</ins><span class="cx">         throw new @TypeError(&quot;Cannot clone a disturbed Response&quot;);
</span><span class="cx"> 
</span><span class="cx">     var cloned = @Response.prototype.@cloneForJS.@call(this);
</span></span></pre>
</div>
</div>

</body>
</html>