<!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>[198888] trunk/LayoutTests</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/198888">198888</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-03-31 01:26:29 -0700 (Thu, 31 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Update web-platform-test fetch API tests
https://bugs.webkit.org/show_bug.cgi?id=155969

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Resyncing tests and updated expectations.
New test web-platform-tests/fetch/api/request/request-cache.html is timing out.

* web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob.js:
(checkFetchResponse):
* web-platform-tests/fetch/api/headers/headers-basic.html:
* web-platform-tests/fetch/api/request/request-cache-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-cache.html: Added.
* web-platform-tests/fetch/api/request/request-consume-empty.html:
* web-platform-tests/fetch/api/request/request-consume.html:
* web-platform-tests/fetch/api/request/request-idl-expected.txt:
* web-platform-tests/fetch/api/request/request-idl.html:
* web-platform-tests/fetch/api/request/request-init-002-expected.txt:
* web-platform-tests/fetch/api/request/request-init-002.html:
* web-platform-tests/fetch/api/request/resources/cache.py: Added.
(main):
* web-platform-tests/fetch/api/resources/utils.js:
(stringToArray):
(validateBufferFromString):
(validateStreamFromString):
* web-platform-tests/fetch/api/response/response-clone.html:
* web-platform-tests/fetch/api/response/response-consume-empty.html:
* web-platform-tests/fetch/api/response/response-consume.html:
* web-platform-tests/fetch/api/response/response-init-002.html:

LayoutTests:

* TestExpectations: Marking imported/w3c/web-platform-tests/fetch/api/request/request-cache.html as timing out.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiheadersheadersbasichtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestconsumeemptyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestconsumehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestidlexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestidlhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit002expectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit002html">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresourcesutilsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseclonehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseconsumeemptyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseconsumehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseinit002html">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestresourcescachepy">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/ChangeLog        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-03-31  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Update web-platform-test fetch API tests
+        https://bugs.webkit.org/show_bug.cgi?id=155969
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations: Marking imported/w3c/web-platform-tests/fetch/api/request/request-cache.html as timing out.
+
</ins><span class="cx"> 2016-03-30  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         Fixed typo in fast/css/viewport-vmin-border test.
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/TestExpectations        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -317,6 +317,8 @@
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-cors.htm [ Skip ]
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-non-cors.htm [ Skip ]
</span><span class="cx"> 
</span><ins>+imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Timeout ]
+
</ins><span class="cx"> # New W3C ref tests that are failing.
</span><span class="cx"> webkit.org/b/148856 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-03-31  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Update web-platform-test fetch API tests
+        https://bugs.webkit.org/show_bug.cgi?id=155969
+
+        Reviewed by Darin Adler.
+
+        Resyncing tests and updated expectations.
+        New test web-platform-tests/fetch/api/request/request-cache.html is timing out.
+
+        * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
+        * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
+        * web-platform-tests/fetch/api/basic/scheme-blob.js:
+        (checkFetchResponse):
+        * web-platform-tests/fetch/api/headers/headers-basic.html:
+        * web-platform-tests/fetch/api/request/request-cache-expected.txt: Added.
+        * web-platform-tests/fetch/api/request/request-cache.html: Added.
+        * web-platform-tests/fetch/api/request/request-consume-empty.html:
+        * web-platform-tests/fetch/api/request/request-consume.html:
+        * web-platform-tests/fetch/api/request/request-idl-expected.txt:
+        * web-platform-tests/fetch/api/request/request-idl.html:
+        * web-platform-tests/fetch/api/request/request-init-002-expected.txt:
+        * web-platform-tests/fetch/api/request/request-init-002.html:
+        * web-platform-tests/fetch/api/request/resources/cache.py: Added.
+        (main):
+        * web-platform-tests/fetch/api/resources/utils.js:
+        (stringToArray):
+        (validateBufferFromString):
+        (validateStreamFromString):
+        * web-platform-tests/fetch/api/response/response-clone.html:
+        * web-platform-tests/fetch/api/response/response-consume-empty.html:
+        * web-platform-tests/fetch/api/response/response-consume.html:
+        * web-platform-tests/fetch/api/response/response-init-002.html:
+
</ins><span class="cx"> 2016-03-25  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         [Fetch API] Add basic loading of resources
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-expected.txt        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> 
</span><del>-PASS Regular Blob loading 
-PASS Loading an erroneous blob scheme URL 
-FAIL Loading a blob URL using POST assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Fetching [GET] URL.createObjectURL(blob) is OK 
+PASS Fetching [GET] blob:http://www.localhost:8800/ is KO 
+FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_unreached: Should have rejected. Reached unreachable code
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> 
</span><del>-FAIL Regular Blob loading promise_test: Unhandled rejection with value: &quot;Fetch is not yet implemented&quot;
-FAIL Loading an erroneous blob scheme URL assert_throws: function &quot;function () { throw e }&quot; threw &quot;Fetch is not yet implemented&quot; (undefined) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
-FAIL Loading a blob URL using POST assert_throws: function &quot;function () { throw e }&quot; threw &quot;Fetch is not yet implemented&quot; (undefined) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
</del><ins>+FAIL Fetching [GET] URL.createObjectURL(blob) is OK promise_test: Unhandled rejection with value: &quot;Fetch is not yet implemented&quot;
+FAIL Fetching [GET] blob:http://www.localhost:8800/ is KO assert_throws: function &quot;function () { throw e }&quot; threw &quot;Fetch is not yet implemented&quot; (undefined) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
+FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_throws: function &quot;function () { throw e }&quot; threw &quot;Fetch is not yet implemented&quot; (undefined) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeblobjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -14,12 +14,13 @@
</span><span class="cx">       return resp.text();
</span><span class="cx">     }).then(function(bodyAsText) {
</span><span class="cx">       assert_equals(bodyAsText, data, &quot;Response's body is &quot; + data);
</span><del>-    })
</del><ins>+    });
</ins><span class="cx">   }, desc);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> var blob = new Blob([&quot;Blob's data&quot;], { &quot;type&quot; : &quot;text/plain&quot; });
</span><del>-checkFetchResponse(URL.createObjectURL(blob), &quot;Blob's data&quot;, &quot;text/plain&quot;,  blob.size, &quot;Regular Blob loading&quot;);
</del><ins>+checkFetchResponse(URL.createObjectURL(blob), &quot;Blob's data&quot;, &quot;text/plain&quot;,  blob.size,
+                  &quot;Fetching [GET] URL.createObjectURL(blob) is OK&quot;);
</ins><span class="cx"> 
</span><span class="cx"> function checkKoUrl(url, method, desc) {
</span><span class="cx">   promise_test(function(test) {
</span><span class="lines">@@ -29,7 +30,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> var blob2 = new Blob([&quot;Blob's data&quot;], { &quot;type&quot; : &quot;text/plain&quot; });
</span><del>-checkKoUrl(&quot;blob:http://{{domains[www]}}:{{ports[http][0]}}/&quot;, &quot;GET&quot;, &quot;Loading an erroneous blob scheme URL&quot;);
-checkKoUrl(URL.createObjectURL(blob2), &quot;POST&quot;, &quot;Loading a blob URL using POST&quot;);
</del><ins>+checkKoUrl(&quot;blob:http://{{domains[www]}}:{{ports[http][0]}}/&quot;, &quot;GET&quot;,
+          &quot;Fetching [GET] blob:http://{{domains[www]}}:{{ports[http][0]}}/ is KO&quot;);
+checkKoUrl(URL.createObjectURL(blob2), &quot;POST&quot;,
+           &quot;Fetching [POST] URL.createObjectURL(blob) is KO&quot;);
</ins><span class="cx"> 
</span><span class="cx"> done();
</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 (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-basic.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">       var parameters = [null, 1];
</span><span class="cx">       parameters.forEach(function(parameter) {
</span><span class="cx">         test(function() {
</span><del>-          assert_throws(new TypeError(), () =&gt; new Headers(parameter));
</del><ins>+          assert_throws(new TypeError(), function() { new Headers(parameter) });
</ins><span class="cx">         }, &quot;Create headers with &quot; + parameter + &quot; should throw&quot;);
</span><span class="cx">       });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcacheexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt (0 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-expected.txt        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+FAIL: Timed out waiting for notifyDone to be called
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestcachehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html (0 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -0,0 +1,498 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;meta charset=&quot;utf-8&quot;&gt;
+    &lt;title&gt;Request cache&lt;/title&gt;
+    &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#request&quot;&gt;
+    &lt;meta name=&quot;timeout&quot; content=&quot;long&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;script src=&quot;/common/utils.js&quot;&gt;&lt;/script&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    &lt;script&gt;
+    var now = new Date();
+    var tests = [
+      {
+        name: 'RequestCache &quot;default&quot; mode checks the cache for previously cached content and goes to the network for stale responses',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode checks the cache for previously cached content and avoids going to the network if a fresh response exists',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;no-cache&quot; mode revalidates stale responses found in the cache',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;no-cache&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+        expected_max_age_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;no-cache&quot; mode revalidates fresh responses found in the cache',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;no-cache&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+        expected_max_age_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and avoid revalidation for stale responses',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;force-cache&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and avoid revalidation for fresh responses',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;force-cache&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;force-cache&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;force-cache&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+        state: &quot;stale&quot;,
+        vary: &quot;*&quot;,
+        request_cache: [&quot;default&quot;, &quot;force-cache&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+        state: &quot;fresh&quot;,
+        vary: &quot;*&quot;,
+        request_cache: [&quot;default&quot;, &quot;force-cache&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; stores the response in the cache if it goes to the network',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;force-cache&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache &quot;force-cache&quot; stores the response in the cache if it goes to the network',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;force-cache&quot;, &quot;default&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [false],
+      },
+      {
+        name: 'RequestCache &quot;no-store&quot; mode does not check the cache for previously cached content and goes to the network regardless',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;no-store&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;no-store&quot; mode does not check the cache for previously cached content and goes to the network regardless',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;no-store&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;no-store&quot; mode does not store the response in the cache',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;no-store&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;no-store&quot; mode does not store the response in the cache',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;no-store&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Modified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Modified-Since&quot;: now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Modified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Modified-Since&quot;: now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Modified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Modified-Since&quot;: now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Modified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Modified-Since&quot;: now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-None-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-None-Match&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-None-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-None-Match&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-None-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-None-Match&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-None-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-None-Match&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Unmodified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Unmodified-Since&quot;: now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Unmodified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Unmodified-Since&quot;: now.toGMTString()}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Unmodified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Unmodified-Since&quot;: now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Unmodified-Since header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Unmodified-Since&quot;: now.toGMTString()}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Match&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Match&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Match&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Match header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Match&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Range header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Range&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Range header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{}, {&quot;If-Range&quot;: '&quot;foo&quot;'}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Range header is treated similarly to &quot;no-store&quot;',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Range&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;default&quot; mode with an If-Range header is treated similarly to &quot;no-store&quot;',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        request_headers: [{&quot;If-Range&quot;: '&quot;foo&quot;'}, {}],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'Responses with the &quot;Cache-Control: no-store&quot; header are not stored in the cache',
+        state: &quot;stale&quot;,
+        cache_control: &quot;no-store&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'Responses with the &quot;Cache-Control: no-store&quot; header are not stored in the cache',
+        state: &quot;fresh&quot;,
+        cache_control: &quot;no-store&quot;,
+        request_cache: [&quot;default&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, false],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does not check the cache for previously cached content and goes to the network regardless',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;reload&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does not check the cache for previously cached content and goes to the network regardless',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;reload&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does store the response in the cache',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;reload&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, true],
+        expected_no_cache_headers: [true, false],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does store the response in the cache',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;reload&quot;, &quot;default&quot;],
+        expected_validation_headers: [false],
+        expected_no_cache_headers: [true],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does store the response in the cache even if a previous response is already stored',
+        state: &quot;stale&quot;,
+        request_cache: [&quot;default&quot;, &quot;reload&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false, true],
+        expected_no_cache_headers: [false, true, false],
+      },
+      {
+        name: 'RequestCache &quot;reload&quot; mode does store the response in the cache even if a previous response is already stored',
+        state: &quot;fresh&quot;,
+        request_cache: [&quot;default&quot;, &quot;reload&quot;, &quot;default&quot;],
+        expected_validation_headers: [false, false],
+        expected_no_cache_headers: [false, true],
+      },
+    ];
+    function make_url(uuid, id, value, content, info) {
+      var dates = {
+        fresh: new Date(now.getFullYear() + 1, now.getMonth(), now.getDay()).toGMTString(),
+        stale: new Date(now.getFullYear() - 1, now.getMonth(), now.getDay()).toGMTString(),
+      };
+      var vary = &quot;&quot;;
+      if (&quot;vary&quot; in info) {
+        vary = &quot;&amp;vary=&quot; + info.vary;
+      }
+      var cache_control = &quot;&quot;;
+      if (&quot;cache_control&quot; in info) {
+        cache_control = &quot;&amp;cache_control=&quot; + info.cache_control;
+      }
+      var ignore_request_headers = &quot;&quot;;
+      if (&quot;request_headers&quot; in info) {
+        // Ignore the request headers that we send since they may be synthesized by the test.
+        ignore_request_headers = &quot;&amp;ignore&quot;;
+      }
+      return &quot;resources/cache.py?token=&quot; + uuid +
+             &quot;&amp;content=&quot; + content +
+             &quot;&amp;&quot; + id + &quot;=&quot; + value +
+             &quot;&amp;expires=&quot; + dates[info.state] +
+             vary + cache_control + ignore_request_headers;
+    }
+    function expected_status(type, identifier, init) {
+      if (type == &quot;date&quot; &amp;&amp;
+          init.headers &amp;&amp;
+          init.headers[&quot;If-Modified-Since&quot;] == identifier) {
+        // The server will respond with a 304 in this case.
+        return [304, &quot;Not Modified&quot;];
+      }
+      return [200, &quot;OK&quot;];
+    }
+    function expected_response_text(type, identifier, init, content) {
+      if (type == &quot;date&quot; &amp;&amp;
+          init.headers &amp;&amp;
+          init.headers[&quot;If-Modified-Since&quot;] == identifier) {
+        // The server will respond with a 304 in this case.
+        return &quot;&quot;;
+      }
+      return content;
+    }
+    function server_state(uuid) {
+      return fetch(&quot;resources/cache.py?querystate&amp;token=&quot; + uuid)
+        .then(function(response) {
+          return response.text();
+        }).then(function(text) {
+          return JSON.parse(text);
+        });
+    }
+    function populate_cache(url, content, info, type, identifier) {
+      var init = {cache: info.request_cache[0]};
+      if (&quot;request_headers&quot; in info) {
+        init.headers = info.request_headers[0];
+      }
+      return fetch(url, init)
+        .then(function(response) {
+          assert_array_equals([response.status, response.statusText],
+                              expected_status(type, identifier, init));
+          return response.text();
+        }).then(function(text) {
+          assert_equals(text, expected_response_text(type, identifier, init, content));
+        });
+    }
+    function make_test(type, info) {
+      return function(test) {
+        var uuid = token();
+        var identifier = (type == &quot;tag&quot; ? Math.random() : now.toGMTString());
+        var content = Math.random().toString();
+        var url = make_url(uuid, type, identifier, content, info);
+        var fetch_functions = [function() {
+          return populate_cache(url, content, info, type, identifier);
+        }];
+        for (var i = 1; i &lt; info.request_cache.length; ++i) {
+          fetch_functions.push(function(idx) {
+            var init = {cache: info.request_cache[idx]};
+            if (&quot;request_headers&quot; in info) {
+              init.headers = info.request_headers[idx];
+            }
+            return fetch(url, init)
+              .then(function(response) {
+                assert_array_equals([response.status, response.statusText],
+                                    expected_status(type, identifier, init));
+                return response.text();
+              }).then(function(text) {
+                assert_equals(text, expected_response_text(type, identifier, init, content));
+              });
+          });
+        }
+        var i = 0;
+        function run_next_step() {
+          if (fetch_functions.length) {
+            return fetch_functions.shift()(i++)
+              .then(run_next_step);
+          } else {
+            return Promise.resolve();
+          }
+        }
+        return run_next_step()
+          .then(function() {
+            // Now, query the server state
+            return server_state(uuid);
+          }).then(function(state) {
+            var expectedState = [];
+            info.expected_validation_headers.forEach(function (validate) {
+              if (validate) {
+                if (type == &quot;tag&quot;) {
+                  expectedState.push({&quot;If-None-Match&quot;: '&quot;' + identifier + '&quot;'});
+                } else {
+                  expectedState.push({&quot;If-Modified-Since&quot;: identifier});
+                }
+              } else {
+                expectedState.push({});
+              }
+            });
+            for (var i = 0; i &lt; info.expected_no_cache_headers.length; ++i) {
+              if (info.expected_no_cache_headers[i]) {
+                expectedState[i][&quot;Pragma&quot;] = &quot;no-cache&quot;;
+                expectedState[i][&quot;Cache-Control&quot;] = &quot;no-cache&quot;;
+              }
+            }
+            if (&quot;expected_max_age_headers&quot; in info) {
+              for (var i = 0; i &lt; info.expected_max_age_headers.length; ++i) {
+                if (info.expected_max_age_headers[i]) {
+                  expectedState[i][&quot;Cache-Control&quot;] = &quot;max-age=0&quot;;
+                }
+              }
+            }
+            assert_equals(state.length, expectedState.length);
+            for (var i = 0; i &lt; state.length; ++i) {
+              for (var header in state[i]) {
+                assert_equals(state[i][header], expectedState[i][header]);
+                delete expectedState[i][header];
+              }
+              for (var header in expectedState[i]) {
+                assert_false(header in state[i]);
+              }
+            }
+          });
+      };
+    }
+    tests.forEach(function(info) {
+      promise_test(make_test(&quot;tag&quot;, info), info.name + &quot; with Etag and &quot; + info.state + &quot; response&quot;);
+      promise_test(make_test(&quot;date&quot;, info), info.name + &quot; with date and &quot; + info.state + &quot; response&quot;);
+    });
+    &lt;/script&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestconsumeemptyhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx">   &lt;body&gt;
</span><span class="cx">     &lt;script&gt;
</span><span class="cx">     function checkBodyText(request) {
</span><del>-      return request.text().then( function(bodyAsText) {
</del><ins>+      return request.text().then(function(bodyAsText) {
</ins><span class="cx">         assert_equals(bodyAsText, &quot;&quot;, &quot;Resolved value should be empty&quot;);
</span><span class="cx">         assert_false(request.bodyUsed);
</span><span class="cx">       });
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> 
</span><span class="cx">     function checkBodyBlob(request) {
</span><span class="cx">       return request.blob().then(function(bodyAsBlob) {
</span><del>-        var promise = new Promise(function (resolve, reject) {
</del><ins>+        var promise = new Promise(function(resolve, reject) {
</ins><span class="cx">           var reader = new FileReader();
</span><span class="cx">           reader.onload = function(evt) {
</span><span class="cx">             resolve(reader.result)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function checkBodyArrayBuffer(request) {
</span><del>-      return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
</del><ins>+      return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
</ins><span class="cx">         assert_equals(bodyAsArrayBuffer.byteLength, 0, &quot;Resolved value should be empty&quot;);
</span><span class="cx">         assert_false(request.bodyUsed);
</span><span class="cx">       });
</span><span class="lines">@@ -46,10 +46,10 @@
</span><span class="cx"> 
</span><span class="cx">     function checkBodyJSON(request) {
</span><span class="cx">       return request.json().then(
</span><del>-        (bodyAsJSON) =&gt; {
</del><ins>+        function(bodyAsJSON) {
</ins><span class="cx">           assert_unreached(&quot;JSON parsing should fail&quot;);
</span><span class="cx">         },
</span><del>-        () =&gt; {
</del><ins>+        function() {
</ins><span class="cx">           assert_false(request.bodyUsed);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     function checkRequestWithEmptyBody(bodyType, body, asText) {
</span><span class="cx">       promise_test(function(test) {
</span><del>-        var request = new Request(&quot;&quot;, {&quot;method&quot;: &quot;POST&quot;, &quot;body&quot; : body});
</del><ins>+        var request = new Request(&quot;&quot;, {&quot;method&quot;: &quot;POST&quot;, &quot;body&quot;: body});
</ins><span class="cx">         assert_false(request.bodyUsed, &quot;bodyUsed is false at init&quot;);
</span><span class="cx">         if (asText) {
</span><span class="cx">           return request.text().then(function(bodyAsString) {
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestconsumehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -8,6 +8,7 @@
</span><span class="cx">     &lt;meta name=&quot;author&quot; title=&quot;Canon Research France&quot; href=&quot;https://www.crf.canon.fr&quot;&gt;
</span><span class="cx">     &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;../resources/utils.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">   &lt;/head&gt;
</span><span class="cx">   &lt;body&gt;
</span><span class="cx">     &lt;script&gt;
</span><span class="lines">@@ -37,19 +38,9 @@
</span><span class="cx">       });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    &lt;!-- Taken from https://developers.google.com --&gt;
-    function str2ab(str) {
-      var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
-      var bufView = new Uint16Array(buf);
-      for (var i=0, strLen=str.length; i &lt; strLen; i++) {
-        bufView[i] = str.charCodeAt(i);
-      }
-      return buf;
-    }
-
</del><span class="cx">     function checkBodyArrayBuffer(request, expectedBody) {
</span><del>-      return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
-        assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), &quot;Retrieve and verify request's body&quot;);
</del><ins>+      return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
+        validateBufferFromString(bodyAsArrayBuffer, expectedBody, &quot;Retrieve and verify request's body&quot;);
</ins><span class="cx">         assert_true(request.bodyUsed, &quot;body as arrayBuffer: bodyUsed turned true&quot;);
</span><span class="cx">       });
</span><span class="cx">     }
</span><span class="lines">@@ -85,7 +76,7 @@
</span><span class="cx">     checkRequestBody(textData, &quot;text&quot;, checkBodyText);
</span><span class="cx">     checkRequestBody(textData, &quot;blob&quot;, checkBodyBlob);
</span><span class="cx">     checkRequestBody(textData, &quot;arrayBuffer&quot;, checkBodyArrayBuffer);
</span><del>-    checkRequestBody(JSON.stringify(textData), &quot;json&quot;, checkBodyJSON);
</del><ins>+    checkRequestBody(textData, &quot;json&quot;, checkBodyJSON);
</ins><span class="cx">     checkRequestBody(formData, &quot;formData&quot;, checkBodyFormData);
</span><span class="cx"> 
</span><span class="cx">     function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestidlexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;type&quot; with the proper type (3) 
</span><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;destination&quot; with the proper type (4) 
</span><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;referrer&quot; with the proper type (5) 
</span><del>-FAIL Request interface: new Request(&quot;&quot;) must inherit property &quot;referrerPolicy&quot; with the proper type (6) Unrecognized type ReferrerPolicy
</del><ins>+PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;referrerPolicy&quot; with the proper type (6) 
</ins><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;mode&quot; with the proper type (7) 
</span><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;credentials&quot; with the proper type (8) 
</span><span class="cx"> PASS Request interface: new Request(&quot;&quot;) must inherit property &quot;cache&quot; with the proper type (9) 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestidlhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx">       enum RequestCredentials { &quot;omit&quot;, &quot;same-origin&quot;, &quot;include&quot; };
</span><span class="cx">       enum RequestCache { &quot;default&quot;, &quot;no-store&quot;, &quot;reload&quot;, &quot;no-cache&quot;, &quot;force-cache&quot;, &quot;only-if-cached&quot; };
</span><span class="cx">       enum RequestRedirect { &quot;follow&quot;, &quot;error&quot;, &quot;manual&quot; };
</span><ins>+      enum ReferrerPolicy { &quot;&quot;, &quot;no-referrer&quot;, &quot;no-referrer-when-downgrade&quot;, &quot;origin-only&quot;, &quot;origin-when-cross-origin&quot;, &quot;unsafe-url&quot; };
</ins><span class="cx">     &lt;/script&gt;
</span><span class="cx">     &lt;script&gt;
</span><span class="cx">       var idlsArray = new IdlArray();
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit002expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -1,5 +1,7 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Initialize Request with headers values 
</span><ins>+PASS Initialize Request's body with undefined 
+PASS Initialize Request's body with null 
</ins><span class="cx"> PASS Initialize Request's body with application/octet-binary 
</span><span class="cx"> FAIL Initialize Request's body with multipart/form-data promise_test: Unhandled rejection with value: undefined
</span><span class="cx"> PASS Initialize Request's body with text/plain;charset=UTF-8 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestrequestinit002html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -23,18 +23,23 @@
</span><span class="cx">         }
</span><span class="cx">       }, &quot;Initialize Request with headers values&quot;);
</span><span class="cx"> 
</span><ins>+      function makeRequestInit(body, method) {
+        return {&quot;method&quot;: method, &quot;body&quot;: body};
+      }
+
</ins><span class="cx">       function checkRequestInit(body, bodyType, expectedTextBody) {
</span><span class="cx">         promise_test(function(test) {
</span><del>-          var request = new Request(&quot;&quot;, {&quot;method&quot;: &quot;POST&quot;, &quot;body&quot;: body});
-          assert_throws(new TypeError(),
-                        function() { new Request(&quot;&quot;, {&quot;method&quot;: &quot;GET&quot;, &quot;body&quot;: body}); }
-          );
-          assert_throws(new TypeError(),
-                        function() { new Request(&quot;&quot;, {&quot;method&quot;: &quot;HEAD&quot;, &quot;body&quot;: body}); }
-          );
</del><ins>+          var request = new Request(&quot;&quot;, makeRequestInit(body, &quot;POST&quot;));
+          if (body) {
+            assert_throws(new TypeError(),
+                          function() { new Request(&quot;&quot;, makeRequestInit(body, &quot;GET&quot;)); }
+            );
+          } else {
+            new Request(&quot;&quot;, makeRequestInit(body, &quot;GET&quot;)); // should not throw
+          }
</ins><span class="cx">           var reqHeaders = request.headers;
</span><span class="cx">           var mime = reqHeaders.get(&quot;Content-Type&quot;);
</span><del>-          assert_true(mime &amp;&amp; mime.search(bodyType) &gt; -1, &quot;Content-Type header should be \&quot;&quot; + bodyType + &quot;\&quot;, not \&quot;&quot; + mime + &quot;\&quot;&quot;);
</del><ins>+          assert_true(!body || (mime &amp;&amp; mime.search(bodyType) &gt; -1), &quot;Content-Type header should be \&quot;&quot; + bodyType + &quot;\&quot;, not \&quot;&quot; + mime + &quot;\&quot;&quot;);
</ins><span class="cx">           return request.text().then(function(bodyAsText) {
</span><span class="cx">             //not equals: cannot guess formData exact value
</span><span class="cx">             assert_true( bodyAsText.search(expectedTextBody) &gt; -1, &quot;Retrieve and verify request body&quot;);
</span><span class="lines">@@ -47,6 +52,8 @@
</span><span class="cx">       formaData.append(&quot;name&quot;, &quot;value&quot;);
</span><span class="cx">       var usvString = &quot;This is a USVString&quot;
</span><span class="cx"> 
</span><ins>+      checkRequestInit(undefined, undefined, &quot;&quot;);
+      checkRequestInit(null, null, &quot;&quot;);
</ins><span class="cx">       checkRequestInit(blob, &quot;application/octet-binary&quot;, &quot;This is a blob&quot;);
</span><span class="cx">       checkRequestInit(formaData, &quot;multipart/form-data&quot;, &quot;name=\&quot;name\&quot;\r\n\r\nvalue&quot;);
</span><span class="cx">       checkRequestInit(usvString, &quot;text/plain;charset=UTF-8&quot;, &quot;This is a USVString&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapirequestresourcescachepy"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py (0 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+def main(request, response):
+    token = request.GET.first(&quot;token&quot;, None)
+    if &quot;querystate&quot; in request.GET:
+        from json import JSONEncoder
+        response.headers.set(&quot;Content-Type&quot;, &quot;text/plain&quot;)
+        return JSONEncoder().encode(request.server.stash.take(token))
+    content = request.GET.first(&quot;content&quot;, None)
+    tag = request.GET.first(&quot;tag&quot;, None)
+    date = request.GET.first(&quot;date&quot;, None)
+    expires = request.GET.first(&quot;expires&quot;, None)
+    vary = request.GET.first(&quot;vary&quot;, None)
+    cc = request.GET.first(&quot;cache_control&quot;, None)
+    inm = request.headers.get(&quot;If-None-Match&quot;, None)
+    ims = request.headers.get(&quot;If-Modified-Since&quot;, None)
+    pragma = request.headers.get(&quot;Pragma&quot;, None)
+    cache_control = request.headers.get(&quot;Cache-Control&quot;, None)
+    ignore = &quot;ignore&quot; in request.GET
+
+    server_state = request.server.stash.take(token)
+    if not server_state:
+        server_state = []
+    state = dict()
+    if not ignore:
+        if inm:
+            state[&quot;If-None-Match&quot;] = inm
+        if ims:
+            state[&quot;If-Modified-Since&quot;] = ims
+        if pragma:
+            state[&quot;Pragma&quot;] = pragma
+        if cache_control:
+            state[&quot;Cache-Control&quot;] = cache_control
+    server_state.append(state)
+    request.server.stash.put(token, server_state)
+
+    if tag:
+        response.headers.set(&quot;ETag&quot;, '&quot;%s&quot;' % tag)
+    elif date:
+        response.headers.set(&quot;Last-Modified&quot;, date)
+    if expires:
+        response.headers.set(&quot;Expires&quot;, expires)
+    if vary:
+        response.headers.set(&quot;Vary&quot;, vary)
+    if cc:
+        response.headers.set(&quot;Cache-Control&quot;, cc)
+
+    if ((inm is not None and inm == tag) or
+        (ims is not None and ims == date)):
+        response.status = (304, &quot;Not Modified&quot;)
+        return &quot;&quot;
+    else:
+        response.status = (200, &quot;OK&quot;)
+        response.headers.set(&quot;Content-Type&quot;, &quot;text/plain&quot;)
+        return content
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresourcesutilsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/utils.js        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -44,25 +44,31 @@
</span><span class="cx">   }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-//check reader's text content in an asyncronous test
-function readTextStream(reader, asyncTest, expectedValue, retrievedText) {
-  if (!retrievedText)
-    retrievedText = &quot;&quot;;
-  reader.read().then(function(data) {
</del><ins>+function stringToArray(str) {
+  var array = new Uint8Array(str.length);
+  for (var i=0, strLen = str.length; i &lt; strLen; i++)
+    array[i] = str.charCodeAt(i);
+  return array;
+}
+
+function validateBufferFromString(buffer, expectedValue, message)
+{
+  return assert_array_equals(new Uint8Array(buffer), stringToArray(expectedValue), message);
+}
+
+function validateStreamFromString(reader, expectedValue, retrievedArrayBuffer) {
+  return reader.read().then(function(data) {
</ins><span class="cx">     if (!data.done) {
</span><del>-      var decoder = new TextDecoder();
-      retrievedText += decoder.decode(data.value);
-      readTextStream(reader, asyncTest, expectedValue, retrievedText);
-      return;
</del><ins>+      var newBuffer;
+      if (retrievedArrayBuffer) {
+        newBuffer =  new ArrayBuffer(data.value.length + retrievedArrayBuffer.length);
+        newBuffer.set(retrievedArrayBuffer, 0);
+        newBuffer.set(data.value, retrievedArrayBuffer.length);
+      } else {
+        newBuffer = data.value;
+      }
+      return validateStreamFromString(reader, expectedValue, newBuffer);
</ins><span class="cx">     }
</span><del>-    asyncTest.step(function() {
-      assert_equals(retrievedText, expectedValue, &quot;Retrieve and verify stream&quot;);
-      asyncTest.done();
-    });
-  }).catch(function(e) {
-    asyncTest.step(function() {
-      assert_unreached(&quot;Cannot read stream &quot; + e);
-      asyncTest.done();
-    });
</del><ins>+    validateBufferFromString(retrievedArrayBuffer, expectedValue, &quot;Retrieve and verify stream&quot;);
</ins><span class="cx">   });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseclonehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -45,12 +45,12 @@
</span><span class="cx">           &quot;Expect response.headers has name:value header&quot;);
</span><span class="cx">       }, &quot;Check Response's clone has the expected attribute values&quot;);
</span><span class="cx"> 
</span><del>-      async_test(function(test) {
-        readTextStream(response.body.getReader(), test, body);
</del><ins>+      promise_test(function(test) {
+        return validateStreamFromString(response.body.getReader(), body);
</ins><span class="cx">       }, &quot;Check orginal response's body after cloning&quot;);
</span><span class="cx"> 
</span><del>-      async_test(function(test) {
-        readTextStream(clonedResponse.body.getReader(), test, body);
</del><ins>+      promise_test(function(test) {
+        return validateStreamFromString(clonedResponse.body.getReader(), body);
</ins><span class="cx">       }, &quot;Check cloned response's body&quot;);
</span><span class="cx"> 
</span><span class="cx">       promise_test(function(test) {
</span><span class="lines">@@ -63,4 +63,4 @@
</span><span class="cx">       }, &quot;Cannot clone a disturbed response&quot;);
</span><span class="cx">     &lt;/script&gt;
</span><span class="cx">   &lt;/body&gt;
</span><del>-&lt;/html&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseconsumeemptyhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx">   &lt;body&gt;
</span><span class="cx">     &lt;script&gt;
</span><span class="cx">     function checkBodyText(response) {
</span><del>-      return response.text().then( function(bodyAsText) {
</del><ins>+      return response.text().then(function(bodyAsText) {
</ins><span class="cx">         assert_equals(bodyAsText, &quot;&quot;, &quot;Resolved value should be empty&quot;);
</span><span class="cx">         assert_false(response.bodyUsed);
</span><span class="cx">       });
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> 
</span><span class="cx">     function checkBodyBlob(response) {
</span><span class="cx">       return response.blob().then(function(bodyAsBlob) {
</span><del>-        var promise = new Promise(function (resolve, reject) {
</del><ins>+        var promise = new Promise(function(resolve, reject) {
</ins><span class="cx">           var reader = new FileReader();
</span><span class="cx">           reader.onload = function(evt) {
</span><span class="cx">             resolve(reader.result)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function checkBodyArrayBuffer(response) {
</span><del>-      return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
</del><ins>+      return response.arrayBuffer().then(function(bodyAsArrayBuffer) {
</ins><span class="cx">         assert_equals(bodyAsArrayBuffer.byteLength, 0, &quot;Resolved value should be empty&quot;);
</span><span class="cx">         assert_false(response.bodyUsed);
</span><span class="cx">       });
</span><span class="lines">@@ -46,10 +46,10 @@
</span><span class="cx"> 
</span><span class="cx">     function checkBodyJSON(response) {
</span><span class="cx">       return response.json().then(
</span><del>-        (bodyAsJSON) =&gt; {
</del><ins>+        function(bodyAsJSON) {
</ins><span class="cx">           assert_unreached(&quot;JSON parsing should fail&quot;);
</span><span class="cx">         },
</span><del>-        () =&gt; {
</del><ins>+        function() {
</ins><span class="cx">           assert_false(response.bodyUsed);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     function checkResponseWithEmptyBody(bodyType, body, asText) {
</span><span class="cx">       promise_test(function(test) {
</span><del>-        var response = new Response(&quot;&quot;, {&quot;method&quot;: &quot;POST&quot;, &quot;body&quot; : body});
</del><ins>+        var response = new Response(body);
</ins><span class="cx">         assert_false(response.bodyUsed, &quot;bodyUsed is false at init&quot;);
</span><span class="cx">         if (asText) {
</span><span class="cx">           return response.text().then(function(bodyAsString) {
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseconsumehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -8,6 +8,7 @@
</span><span class="cx">     &lt;meta name=&quot;author&quot; title=&quot;Canon Research France&quot; href=&quot;https://www.crf.canon.fr&quot;&gt;
</span><span class="cx">     &lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;../resources/utils.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">   &lt;/head&gt;
</span><span class="cx">   &lt;body&gt;
</span><span class="cx">     &lt;script&gt;
</span><span class="lines">@@ -37,19 +38,9 @@
</span><span class="cx">       });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    &lt;!-- Taken from https://developers.google.com --&gt;
-    function str2ab(str) {
-      var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
-      var bufView = new Uint16Array(buf);
-      for (var i=0, strLen=str.length; i &lt; strLen; i++) {
-        bufView[i] = str.charCodeAt(i);
-      }
-      return buf;
-    }
-
</del><span class="cx">     function checkBodyArrayBuffer(response, expectedBody) {
</span><span class="cx">       return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
</span><del>-        assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), &quot;Retrieve and verify response's body&quot;);
</del><ins>+        validateBufferFromString(bodyAsArrayBuffer, expectedBody, &quot;Retrieve and verify response's body&quot;);
</ins><span class="cx">         assert_true(response.bodyUsed, &quot;body as arrayBuffer: bodyUsed turned true&quot;);
</span><span class="cx">       });
</span><span class="cx">     }
</span><span class="lines">@@ -85,9 +76,7 @@
</span><span class="cx">     checkResponseBody(textData, &quot;text&quot;, checkBodyText);
</span><span class="cx">     checkResponseBody(textData, &quot;blob&quot;, checkBodyBlob);
</span><span class="cx">     checkResponseBody(textData, &quot;arrayBuffer&quot;, checkBodyArrayBuffer);
</span><del>-
-    checkResponseBody(JSON.stringify(&quot;This is response's body&quot;), &quot;json&quot;, checkBodyJSON);
-
</del><ins>+    checkResponseBody(textData, &quot;json&quot;, checkBodyJSON);
</ins><span class="cx">     checkResponseBody(formData, &quot;formData&quot;, checkBodyFormData);
</span><span class="cx"> 
</span><span class="cx">     function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiresponseresponseinit002html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html (198887 => 198888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html        2016-03-31 06:18:22 UTC (rev 198887)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html        2016-03-31 08:26:29 UTC (rev 198888)
</span><span class="lines">@@ -52,10 +52,10 @@
</span><span class="cx">       checkResponseInit(urlSearchParams, &quot;application/x-www-form-urlencoded;charset=UTF-8&quot;, &quot;name=value&quot;);
</span><span class="cx">       checkResponseInit(usvString, &quot;text/plain;charset=UTF-8&quot;, &quot;This is a USVString&quot;);
</span><span class="cx"> 
</span><del>-      async_test(function(test) {
</del><ins>+      promise_test(function(test) {
</ins><span class="cx">         var body = &quot;This is response body&quot;;
</span><span class="cx">         var response = new Response(body);
</span><del>-        readTextStream(response.body.getReader(), test, body);
</del><ins>+        return validateStreamFromString(response.body.getReader(), body);
</ins><span class="cx">       }, &quot;Read Response's body as readableStream&quot;);
</span><span class="cx">     &lt;/script&gt;
</span><span class="cx">   &lt;/body&gt;
</span></span></pre>
</div>
</div>

</body>
</html>