<!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 <youenn.fablet@crf.canon.fr>
+
+ [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 <annulen@yandex.ru>
</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 <youenn.fablet@crf.canon.fr>
+
+ [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 <youenn.fablet@crf.canon.fr>
</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: "Fetch is not yet implemented"
-FAIL Loading an erroneous blob scheme URL assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Loading a blob URL using POST assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+FAIL Fetching [GET] URL.createObjectURL(blob) is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
+FAIL Fetching [GET] blob:http://www.localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
+FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</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, "Response's body is " + 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(["Blob's data"], { "type" : "text/plain" });
</span><del>-checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain", blob.size, "Regular Blob loading");
</del><ins>+checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain", blob.size,
+ "Fetching [GET] URL.createObjectURL(blob) is OK");
</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(["Blob's data"], { "type" : "text/plain" });
</span><del>-checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET", "Loading an erroneous blob scheme URL");
-checkKoUrl(URL.createObjectURL(blob2), "POST", "Loading a blob URL using POST");
</del><ins>+checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET",
+ "Fetching [GET] blob:http://{{domains[www]}}:{{ports[http][0]}}/ is KO");
+checkKoUrl(URL.createObjectURL(blob2), "POST",
+ "Fetching [POST] URL.createObjectURL(blob) is KO");
</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(), () => new Headers(parameter));
</del><ins>+ assert_throws(new TypeError(), function() { new Headers(parameter) });
</ins><span class="cx"> }, "Create headers with " + parameter + " should throw");
</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>+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Request cache</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="timeout" content="long">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ </head>
+ <body>
+ <script>
+ var now = new Date();
+ var tests = [
+ {
+ name: 'RequestCache "default" mode checks the cache for previously cached content and goes to the network for stale responses',
+ state: "stale",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "no-cache" mode revalidates stale responses found in the cache',
+ state: "stale",
+ request_cache: ["default", "no-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ expected_max_age_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-cache" mode revalidates fresh responses found in the cache',
+ state: "fresh",
+ request_cache: ["default", "no-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ expected_max_age_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses',
+ state: "stale",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses',
+ state: "fresh",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+ state: "stale",
+ request_cache: ["force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found',
+ state: "fresh",
+ request_cache: ["force-cache"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+ state: "stale",
+ vary: "*",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary',
+ state: "fresh",
+ vary: "*",
+ request_cache: ["default", "force-cache"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+ state: "stale",
+ request_cache: ["force-cache", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network',
+ state: "fresh",
+ request_cache: ["force-cache", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [false],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "stale",
+ request_cache: ["default", "no-store"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "fresh",
+ request_cache: ["default", "no-store"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not store the response in the cache',
+ state: "stale",
+ request_cache: ["no-store", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "no-store" mode does not store the response in the cache',
+ state: "fresh",
+ request_cache: ["no-store", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-None-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-None-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-None-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-None-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Match": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Match": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Range": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{}, {"If-Range": '"foo"'}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "stale",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Range": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
+ state: "fresh",
+ request_cache: ["default", "default"],
+ request_headers: [{"If-Range": '"foo"'}, {}],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+ state: "stale",
+ cache_control: "no-store",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'Responses with the "Cache-Control: no-store" header are not stored in the cache',
+ state: "fresh",
+ cache_control: "no-store",
+ request_cache: ["default", "default"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, false],
+ },
+ {
+ name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "stale",
+ request_cache: ["default", "reload"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "reload" mode does not check the cache for previously cached content and goes to the network regardless',
+ state: "fresh",
+ request_cache: ["default", "reload"],
+ expected_validation_headers: [false, false],
+ expected_no_cache_headers: [false, true],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache',
+ state: "stale",
+ request_cache: ["reload", "default"],
+ expected_validation_headers: [false, true],
+ expected_no_cache_headers: [true, false],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache',
+ state: "fresh",
+ request_cache: ["reload", "default"],
+ expected_validation_headers: [false],
+ expected_no_cache_headers: [true],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+ state: "stale",
+ request_cache: ["default", "reload", "default"],
+ expected_validation_headers: [false, false, true],
+ expected_no_cache_headers: [false, true, false],
+ },
+ {
+ name: 'RequestCache "reload" mode does store the response in the cache even if a previous response is already stored',
+ state: "fresh",
+ request_cache: ["default", "reload", "default"],
+ 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 = "";
+ if ("vary" in info) {
+ vary = "&vary=" + info.vary;
+ }
+ var cache_control = "";
+ if ("cache_control" in info) {
+ cache_control = "&cache_control=" + info.cache_control;
+ }
+ var ignore_request_headers = "";
+ if ("request_headers" in info) {
+ // Ignore the request headers that we send since they may be synthesized by the test.
+ ignore_request_headers = "&ignore";
+ }
+ return "resources/cache.py?token=" + uuid +
+ "&content=" + content +
+ "&" + id + "=" + value +
+ "&expires=" + dates[info.state] +
+ vary + cache_control + ignore_request_headers;
+ }
+ function expected_status(type, identifier, init) {
+ if (type == "date" &&
+ init.headers &&
+ init.headers["If-Modified-Since"] == identifier) {
+ // The server will respond with a 304 in this case.
+ return [304, "Not Modified"];
+ }
+ return [200, "OK"];
+ }
+ function expected_response_text(type, identifier, init, content) {
+ if (type == "date" &&
+ init.headers &&
+ init.headers["If-Modified-Since"] == identifier) {
+ // The server will respond with a 304 in this case.
+ return "";
+ }
+ return content;
+ }
+ function server_state(uuid) {
+ return fetch("resources/cache.py?querystate&token=" + 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 ("request_headers" 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 == "tag" ? 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 < info.request_cache.length; ++i) {
+ fetch_functions.push(function(idx) {
+ var init = {cache: info.request_cache[idx]};
+ if ("request_headers" 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 == "tag") {
+ expectedState.push({"If-None-Match": '"' + identifier + '"'});
+ } else {
+ expectedState.push({"If-Modified-Since": identifier});
+ }
+ } else {
+ expectedState.push({});
+ }
+ });
+ for (var i = 0; i < info.expected_no_cache_headers.length; ++i) {
+ if (info.expected_no_cache_headers[i]) {
+ expectedState[i]["Pragma"] = "no-cache";
+ expectedState[i]["Cache-Control"] = "no-cache";
+ }
+ }
+ if ("expected_max_age_headers" in info) {
+ for (var i = 0; i < info.expected_max_age_headers.length; ++i) {
+ if (info.expected_max_age_headers[i]) {
+ expectedState[i]["Cache-Control"] = "max-age=0";
+ }
+ }
+ }
+ assert_equals(state.length, expectedState.length);
+ for (var i = 0; i < 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("tag", info), info.name + " with Etag and " + info.state + " response");
+ promise_test(make_test("date", info), info.name + " with date and " + info.state + " response");
+ });
+ </script>
+ </body>
+</html>
</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"> <body>
</span><span class="cx"> <script>
</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, "", "Resolved value should be empty");
</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, "Resolved value should be empty");
</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) => {
</del><ins>+ function(bodyAsJSON) {
</ins><span class="cx"> assert_unreached("JSON parsing should fail");
</span><span class="cx"> },
</span><del>- () => {
</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("", {"method": "POST", "body" : body});
</del><ins>+ var request = new Request("", {"method": "POST", "body": body});
</ins><span class="cx"> assert_false(request.bodyUsed, "bodyUsed is false at init");
</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"> <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
</span><span class="cx"> <script src="/resources/testharness.js"></script>
</span><span class="cx"> <script src="/resources/testharnessreport.js"></script>
</span><ins>+ <script src="../resources/utils.js"></script>
</ins><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <script>
</span><span class="lines">@@ -37,19 +38,9 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- <!-- Taken from https://developers.google.com -->
- 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 < 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), "Retrieve and verify request's body");
</del><ins>+ return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
+ validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify request's body");
</ins><span class="cx"> assert_true(request.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +76,7 @@
</span><span class="cx"> checkRequestBody(textData, "text", checkBodyText);
</span><span class="cx"> checkRequestBody(textData, "blob", checkBodyBlob);
</span><span class="cx"> checkRequestBody(textData, "arrayBuffer", checkBodyArrayBuffer);
</span><del>- checkRequestBody(JSON.stringify(textData), "json", checkBodyJSON);
</del><ins>+ checkRequestBody(textData, "json", checkBodyJSON);
</ins><span class="cx"> checkRequestBody(formData, "formData", 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("") must inherit property "type" with the proper type (3)
</span><span class="cx"> PASS Request interface: new Request("") must inherit property "destination" with the proper type (4)
</span><span class="cx"> PASS Request interface: new Request("") must inherit property "referrer" with the proper type (5)
</span><del>-FAIL Request interface: new Request("") must inherit property "referrerPolicy" with the proper type (6) Unrecognized type ReferrerPolicy
</del><ins>+PASS Request interface: new Request("") must inherit property "referrerPolicy" with the proper type (6)
</ins><span class="cx"> PASS Request interface: new Request("") must inherit property "mode" with the proper type (7)
</span><span class="cx"> PASS Request interface: new Request("") must inherit property "credentials" with the proper type (8)
</span><span class="cx"> PASS Request interface: new Request("") must inherit property "cache" 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 { "omit", "same-origin", "include" };
</span><span class="cx"> enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
</span><span class="cx"> enum RequestRedirect { "follow", "error", "manual" };
</span><ins>+ enum ReferrerPolicy { "", "no-referrer", "no-referrer-when-downgrade", "origin-only", "origin-when-cross-origin", "unsafe-url" };
</ins><span class="cx"> </script>
</span><span class="cx"> <script>
</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"> }, "Initialize Request with headers values");
</span><span class="cx">
</span><ins>+ function makeRequestInit(body, method) {
+ return {"method": method, "body": body};
+ }
+
</ins><span class="cx"> function checkRequestInit(body, bodyType, expectedTextBody) {
</span><span class="cx"> promise_test(function(test) {
</span><del>- var request = new Request("", {"method": "POST", "body": body});
- assert_throws(new TypeError(),
- function() { new Request("", {"method": "GET", "body": body}); }
- );
- assert_throws(new TypeError(),
- function() { new Request("", {"method": "HEAD", "body": body}); }
- );
</del><ins>+ var request = new Request("", makeRequestInit(body, "POST"));
+ if (body) {
+ assert_throws(new TypeError(),
+ function() { new Request("", makeRequestInit(body, "GET")); }
+ );
+ } else {
+ new Request("", makeRequestInit(body, "GET")); // should not throw
+ }
</ins><span class="cx"> var reqHeaders = request.headers;
</span><span class="cx"> var mime = reqHeaders.get("Content-Type");
</span><del>- assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
</del><ins>+ assert_true(!body || (mime && mime.search(bodyType) > -1), "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
</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) > -1, "Retrieve and verify request body");
</span><span class="lines">@@ -47,6 +52,8 @@
</span><span class="cx"> formaData.append("name", "value");
</span><span class="cx"> var usvString = "This is a USVString"
</span><span class="cx">
</span><ins>+ checkRequestInit(undefined, undefined, "");
+ checkRequestInit(null, null, "");
</ins><span class="cx"> checkRequestInit(blob, "application/octet-binary", "This is a blob");
</span><span class="cx"> checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
</span><span class="cx"> checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
</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("token", None)
+ if "querystate" in request.GET:
+ from json import JSONEncoder
+ response.headers.set("Content-Type", "text/plain")
+ return JSONEncoder().encode(request.server.stash.take(token))
+ content = request.GET.first("content", None)
+ tag = request.GET.first("tag", None)
+ date = request.GET.first("date", None)
+ expires = request.GET.first("expires", None)
+ vary = request.GET.first("vary", None)
+ cc = request.GET.first("cache_control", None)
+ inm = request.headers.get("If-None-Match", None)
+ ims = request.headers.get("If-Modified-Since", None)
+ pragma = request.headers.get("Pragma", None)
+ cache_control = request.headers.get("Cache-Control", None)
+ ignore = "ignore" in request.GET
+
+ server_state = request.server.stash.take(token)
+ if not server_state:
+ server_state = []
+ state = dict()
+ if not ignore:
+ if inm:
+ state["If-None-Match"] = inm
+ if ims:
+ state["If-Modified-Since"] = ims
+ if pragma:
+ state["Pragma"] = pragma
+ if cache_control:
+ state["Cache-Control"] = cache_control
+ server_state.append(state)
+ request.server.stash.put(token, server_state)
+
+ if tag:
+ response.headers.set("ETag", '"%s"' % tag)
+ elif date:
+ response.headers.set("Last-Modified", date)
+ if expires:
+ response.headers.set("Expires", expires)
+ if vary:
+ response.headers.set("Vary", vary)
+ if cc:
+ response.headers.set("Cache-Control", cc)
+
+ if ((inm is not None and inm == tag) or
+ (ims is not None and ims == date)):
+ response.status = (304, "Not Modified")
+ return ""
+ else:
+ response.status = (200, "OK")
+ response.headers.set("Content-Type", "text/plain")
+ 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 = "";
- reader.read().then(function(data) {
</del><ins>+function stringToArray(str) {
+ var array = new Uint8Array(str.length);
+ for (var i=0, strLen = str.length; i < 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, "Retrieve and verify stream");
- asyncTest.done();
- });
- }).catch(function(e) {
- asyncTest.step(function() {
- assert_unreached("Cannot read stream " + e);
- asyncTest.done();
- });
</del><ins>+ validateBufferFromString(retrievedArrayBuffer, expectedValue, "Retrieve and verify stream");
</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"> "Expect response.headers has name:value header");
</span><span class="cx"> }, "Check Response's clone has the expected attribute values");
</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"> }, "Check orginal response's body after cloning");
</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"> }, "Check cloned response's body");
</span><span class="cx">
</span><span class="cx"> promise_test(function(test) {
</span><span class="lines">@@ -63,4 +63,4 @@
</span><span class="cx"> }, "Cannot clone a disturbed response");
</span><span class="cx"> </script>
</span><span class="cx"> </body>
</span><del>-</html>
</del><span class="cx">\ No newline at end of file
</span><ins>+</html>
</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"> <body>
</span><span class="cx"> <script>
</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, "", "Resolved value should be empty");
</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, "Resolved value should be empty");
</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) => {
</del><ins>+ function(bodyAsJSON) {
</ins><span class="cx"> assert_unreached("JSON parsing should fail");
</span><span class="cx"> },
</span><del>- () => {
</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("", {"method": "POST", "body" : body});
</del><ins>+ var response = new Response(body);
</ins><span class="cx"> assert_false(response.bodyUsed, "bodyUsed is false at init");
</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"> <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
</span><span class="cx"> <script src="/resources/testharness.js"></script>
</span><span class="cx"> <script src="/resources/testharnessreport.js"></script>
</span><ins>+ <script src="../resources/utils.js"></script>
</ins><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <script>
</span><span class="lines">@@ -37,19 +38,9 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- <!-- Taken from https://developers.google.com -->
- 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 < 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), "Retrieve and verify response's body");
</del><ins>+ validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify response's body");
</ins><span class="cx"> assert_true(response.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -85,9 +76,7 @@
</span><span class="cx"> checkResponseBody(textData, "text", checkBodyText);
</span><span class="cx"> checkResponseBody(textData, "blob", checkBodyBlob);
</span><span class="cx"> checkResponseBody(textData, "arrayBuffer", checkBodyArrayBuffer);
</span><del>-
- checkResponseBody(JSON.stringify("This is response's body"), "json", checkBodyJSON);
-
</del><ins>+ checkResponseBody(textData, "json", checkBodyJSON);
</ins><span class="cx"> checkResponseBody(formData, "formData", 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, "application/x-www-form-urlencoded;charset=UTF-8", "name=value");
</span><span class="cx"> checkResponseInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
</span><span class="cx">
</span><del>- async_test(function(test) {
</del><ins>+ promise_test(function(test) {
</ins><span class="cx"> var body = "This is response body";
</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"> }, "Read Response's body as readableStream");
</span><span class="cx"> </script>
</span><span class="cx"> </body>
</span></span></pre>
</div>
</div>
</body>
</html>