<!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>[198891] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198891">198891</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-03-31 04:05:11 -0700 (Thu, 31 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Fetch API] Add basic loading of resources for Workers
https://bugs.webkit.org/show_bug.cgi?id=155886
Reviewed by Alex Christensen.
LayoutTests/imported/w3c:
Updating test expectations as new tests are passing.
* web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt:
* web-platform-tests/fetch/api/basic/integrity-worker-expected.txt:
* web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
* web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt:
* web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt:
Source/WebCore:
Adding impplementation to WorkerGlobalScopeFetch::fetch similarly to DOMWindowFetch::fetch.
Refactored code in FetchResponse to share code between the two.
Updated WorkerThreadableLoader to cope with an ASSERT.
The ASSERT ensures that a DocumentThreadableLoader::create returns non null.
In our case, it might happen as all cross origin fetch requests are denied at the moment.
This leads to calling didFail in DocumentThreadableLoader::create call and DocumentThreadableLoader::create to return null.
Updated the ASSERT to ensures that either the load is finished or DocumentThreadableLoader::create does not return null.
Covered by rebased tests.
* Modules/fetch/DOMWindowFetch.cpp:
(WebCore::DOMWindowFetch::fetch):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::startFetching):
(WebCore::FetchResponse::fetch):
* Modules/fetch/FetchResponse.h:
* Modules/fetch/WorkerGlobalScopeFetch.cpp:
(WebCore::WorkerGlobalScopeFetch::fetch):
* Modules/fetch/WorkerGlobalScopeFetch.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck):
* loader/WorkerThreadableLoader.h:
LayoutTests:
Soup and Mac HTTP backends differ on Content-Length header handling.
* platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicacceptheaderworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicintegrityworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicmodenocorsworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicmodesameoriginworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestforbiddenheadersworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeaboutworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-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="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemedataworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeothersworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicstreamresponseworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchDOMWindowFetchcpp">trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseh">trunk/Source/WebCore/Modules/fetch/FetchResponse.h</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchcpp">trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchh">trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoadercpp">trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoaderh">trunk/Source/WebCore/loader/WorkerThreadableLoader.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt">trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/ChangeLog        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><ins>+ [Fetch API] Add basic loading of resources for Workers
+ https://bugs.webkit.org/show_bug.cgi?id=155886
+
+ Reviewed by Alex Christensen.
+
+ Soup and Mac HTTP backends differ on Content-Length header handling.
+
+ * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: Added.
+
+2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
</ins><span class="cx"> Remove forEach use from Fetch Headers builtin constructor
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=155967
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><ins>+ [Fetch API] Add basic loading of resources for Workers
+ https://bugs.webkit.org/show_bug.cgi?id=155886
+
+ Reviewed by Alex Christensen.
+
+ Updating test expectations as new tests are passing.
+
+ * web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/integrity-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt:
+ * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt:
+
+2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
</ins><span class="cx"> [Fetch API] Update web-platform-test fetch API tests
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=155969
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicacceptheaderworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL Request through fetch should have 'accept' header with value '*/*' promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
</del><ins>+PASS Request through fetch should have 'accept' header with value '*/*'
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicintegrityworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><span class="cx">
</span><del>-FAIL Empty string integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL SHA-256 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL SHA-384 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Multiple integrities: valid stronger than invalid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Multiple integrities: invalid stronger than valid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Multiple integrities: invalid as strong as valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Multiple integrities: both are valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Multiple integrities: both are invalid assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL CORS empty integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL CORS invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+PASS Empty string integrity
+PASS SHA-256 integrity
+PASS SHA-384 integrity
+PASS SHA-512 integrity
+FAIL Invalid integrity assert_unreached: Should have rejected. Reached unreachable code
+PASS Multiple integrities: valid stronger than invalid
+FAIL Multiple integrities: invalid stronger than valid assert_unreached: Should have rejected. Reached unreachable code
+PASS Multiple integrities: invalid as strong as valid
+PASS Multiple integrities: both are valid
+FAIL Multiple integrities: both are invalid assert_unreached: Should have rejected. Reached unreachable code
+FAIL CORS empty integrity promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS CORS invalid integrity
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicmodenocorsworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx">
</span><del>-FAIL Fetch ../resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
</del><ins>+PASS Fetch ../resources/top.txt with no-cors mode
+PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode
+FAIL Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Type error"
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicmodesameoriginworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx">
</span><del>-FAIL Fetch ../resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+PASS Fetch ../resources/top.txt with same-origin mode
+PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode
+PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode
+PASS Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestforbiddenheadersworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,26 +1,26 @@
</span><span class="cx">
</span><del>-FAIL Accept-Charset is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Accept-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Access-Control-Request-Headers is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Access-Control-Request-Method is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Connection is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Content-Length is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Cookie is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Cookie2 is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Date is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL DNT is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Expect is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Host is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Keep-Alive is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Origin is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Referer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL TE is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Trailer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Transfer-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Upgrade is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Via is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Proxy- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Proxy-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Sec- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Sec-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
</del><ins>+PASS Accept-Charset is a forbidden request header
+PASS Accept-Encoding is a forbidden request header
+PASS Access-Control-Request-Headers is a forbidden request header
+PASS Access-Control-Request-Method is a forbidden request header
+PASS Connection is a forbidden request header
+PASS Content-Length is a forbidden request header
+PASS Cookie is a forbidden request header
+PASS Cookie2 is a forbidden request header
+PASS Date is a forbidden request header
+PASS DNT is a forbidden request header
+PASS Expect is a forbidden request header
+PASS Host is a forbidden request header
+PASS Keep-Alive is a forbidden request header
+PASS Origin is a forbidden request header
+PASS Referer is a forbidden request header
+PASS TE is a forbidden request header
+PASS Trailer is a forbidden request header
+PASS Transfer-Encoding is a forbidden request header
+PASS Upgrade is a forbidden request header
+PASS Via is a forbidden request header
+PASS Proxy- is a forbidden request header
+PASS Proxy-Test is a forbidden request header
+PASS Sec- is a forbidden request header
+PASS Sec-Test is a forbidden request header
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,11 +1,11 @@
</span><span class="cx">
</span><del>-FAIL Fetch with GET promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with HEAD promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with PUT without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with PUT with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with POST without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with POST with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with Chicken promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetch with Chicken with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
</del><ins>+FAIL Fetch with GET assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null
+FAIL Fetch with HEAD assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null
+FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Fetch with PUT without body
+PASS Fetch with PUT with body
+PASS Fetch with POST without body
+PASS Fetch with POST with body
+FAIL Fetch with Chicken assert_equals: Request has header content-length: null expected (object) null but got (string) "0"
+PASS Fetch with Chicken with body
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeaboutworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx">
</span><del>-FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetching about:invalid.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching about:config is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Fetching about:invalid.com is KO
+PASS Fetching about:config is KO
</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 (198890 => 198891)</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 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx">
</span><del>-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")
</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="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemedataworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx">
</span><del>-FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
-FAIL Fetching [GET] data:notAdataUrl.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching [POST] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching [HEAD] data:,response%27s%20body is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"
+FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Fetching [GET] data:notAdataUrl.com is KO
+PASS Fetching [POST] data:,response%27s%20body is KO
+PASS Fetching [HEAD] data:,response%27s%20body is KO
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicschemeothersworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,18 +1,18 @@
</span><span class="cx">
</span><del>-FAIL Fetching aaa://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching cap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching cid://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching dav://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching dict://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching dns://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching geo://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching im://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching imap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching ipp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching ldap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching mailto://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching nfs://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching pop://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching rtsp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
-FAIL Fetching snmp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")
</del><ins>+PASS Fetching aaa://localhost:8800/ is KO
+PASS Fetching cap://localhost:8800/ is KO
+PASS Fetching cid://localhost:8800/ is KO
+PASS Fetching dav://localhost:8800/ is KO
+PASS Fetching dict://localhost:8800/ is KO
+PASS Fetching dns://localhost:8800/ is KO
+PASS Fetching geo://localhost:8800/ is KO
+PASS Fetching im://localhost:8800/ is KO
+PASS Fetching imap://localhost:8800/ is KO
+PASS Fetching ipp://localhost:8800/ is KO
+PASS Fetching ldap://localhost:8800/ is KO
+PASS Fetching mailto://localhost:8800/ is KO
+PASS Fetching nfs://localhost:8800/ is KO
+PASS Fetching pop://localhost:8800/ is KO
+PASS Fetching rtsp://localhost:8800/ is KO
+PASS Fetching snmp://localhost:8800/ is KO
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapibasicstreamresponseworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL Stream response's body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"
</del><ins>+FAIL Stream response's body assert_unreached: Body does not exist in response Reached unreachable code
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapibasicrequestheadersworkerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt (0 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+
+FAIL Fetch with GET assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null
+FAIL Fetch with HEAD assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null
+FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: object "TypeError: Type error"
+PASS Fetch with PUT without body
+PASS Fetch with PUT with body
+PASS Fetch with POST without body
+PASS Fetch with POST with body
+PASS Fetch with Chicken
+PASS Fetch with Chicken with body
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/ChangeLog        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><ins>+ [Fetch API] Add basic loading of resources for Workers
+ https://bugs.webkit.org/show_bug.cgi?id=155886
+
+ Reviewed by Alex Christensen.
+
+ Adding impplementation to WorkerGlobalScopeFetch::fetch similarly to DOMWindowFetch::fetch.
+ Refactored code in FetchResponse to share code between the two.
+
+ Updated WorkerThreadableLoader to cope with an ASSERT.
+ The ASSERT ensures that a DocumentThreadableLoader::create returns non null.
+ In our case, it might happen as all cross origin fetch requests are denied at the moment.
+ This leads to calling didFail in DocumentThreadableLoader::create call and DocumentThreadableLoader::create to return null.
+ Updated the ASSERT to ensures that either the load is finished or DocumentThreadableLoader::create does not return null.
+
+ Covered by rebased tests.
+
+ * Modules/fetch/DOMWindowFetch.cpp:
+ (WebCore::DOMWindowFetch::fetch):
+ * Modules/fetch/FetchResponse.cpp:
+ (WebCore::FetchResponse::startFetching):
+ (WebCore::FetchResponse::fetch):
+ * Modules/fetch/FetchResponse.h:
+ * Modules/fetch/WorkerGlobalScopeFetch.cpp:
+ (WebCore::WorkerGlobalScopeFetch::fetch):
+ * Modules/fetch/WorkerGlobalScopeFetch.h:
+ * loader/WorkerThreadableLoader.cpp:
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck):
+ * loader/WorkerThreadableLoader.h:
+
+2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
</ins><span class="cx"> [Fetch API] Move isDisturbed handling to FetchBodyOwner
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=155968
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchDOMWindowFetchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -41,32 +41,14 @@
</span><span class="cx"> {
</span><span class="cx"> if (!window.scriptExecutionContext())
</span><span class="cx"> return;
</span><del>- ScriptExecutionContext& context = *window.scriptExecutionContext();
-
- ExceptionCode ec = 0;
- RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, input, dictionary, ec);
- if (ec) {
- promise.reject(ec);
- return;
- }
- ASSERT(fetchRequest);
- FetchResponse::fetch(context, *fetchRequest, WTFMove(promise));
</del><ins>+ FetchResponse::fetch(*window.scriptExecutionContext(), input, dictionary, WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DOMWindowFetch::fetch(DOMWindow& window, const String& url, const Dictionary& dictionary, DeferredWrapper&& promise)
</span><span class="cx"> {
</span><span class="cx"> if (!window.scriptExecutionContext())
</span><span class="cx"> return;
</span><del>- ScriptExecutionContext& context = *window.scriptExecutionContext();
-
- ExceptionCode ec = 0;
- RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, url, dictionary, ec);
- if (ec) {
- promise.reject(ec);
- return;
- }
- ASSERT(fetchRequest);
- FetchResponse::fetch(context, *fetchRequest, WTFMove(promise));
</del><ins>+ FetchResponse::fetch(*window.scriptExecutionContext(), url, dictionary, WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Dictionary.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "FetchRequest.h"
</ins><span class="cx"> #include "JSFetchResponse.h"
</span><span class="cx"> #include "ScriptExecutionContext.h"
</span><span class="cx">
</span><span class="lines">@@ -153,7 +154,7 @@
</span><span class="cx"> return JSC::jsNull();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void FetchResponse::fetch(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise)
</del><ins>+void FetchResponse::startFetching(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise)
</ins><span class="cx"> {
</span><span class="cx"> Ref<FetchResponse> response = adoptRef(*new FetchResponse(context, Type::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</span><span class="cx">
</span><span class="lines">@@ -165,6 +166,30 @@
</span><span class="cx"> response->m_bodyLoader = Nullopt;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void FetchResponse::fetch(ScriptExecutionContext& context, FetchRequest& input, const Dictionary& dictionary, FetchPromise&& promise)
+{
+ ExceptionCode ec = 0;
+ RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, input, dictionary, ec);
+ if (ec) {
+ promise.reject(ec);
+ return;
+ }
+ ASSERT(fetchRequest);
+ startFetching(context, *fetchRequest, WTFMove(promise));
+}
+
+void FetchResponse::fetch(ScriptExecutionContext& context, const String& url, const Dictionary& dictionary, FetchPromise&& promise)
+{
+ ExceptionCode ec = 0;
+ RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, url, dictionary, ec);
+ if (ec) {
+ promise.reject(ec);
+ return;
+ }
+ ASSERT(fetchRequest);
+ startFetching(context, *fetchRequest, WTFMove(promise));
+}
+
</ins><span class="cx"> void FetchResponse::BodyLoader::didSucceed()
</span><span class="cx"> {
</span><span class="cx"> m_response.m_bodyLoader = Nullopt;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.h (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -55,7 +55,8 @@
</span><span class="cx"> static RefPtr<FetchResponse> redirect(ScriptExecutionContext& context, const String& url, ExceptionCode& ec) { return redirect(context, url, 302, ec); }
</span><span class="cx">
</span><span class="cx"> using FetchPromise = DOMPromise<RefPtr<FetchResponse>, ExceptionCode>;
</span><del>- static void fetch(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&);
</del><ins>+ static void fetch(ScriptExecutionContext&, FetchRequest&, const Dictionary&, FetchPromise&&);
+ static void fetch(ScriptExecutionContext&, const String&, const Dictionary&, FetchPromise&&);
</ins><span class="cx">
</span><span class="cx"> void initializeWith(const Dictionary&, ExceptionCode&);
</span><span class="cx">
</span><span class="lines">@@ -74,6 +75,8 @@
</span><span class="cx">
</span><span class="cx"> FetchResponse(ScriptExecutionContext&, Type, FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&);
</span><span class="cx">
</span><ins>+ static void startFetching(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&);
+
</ins><span class="cx"> // ActiveDOMObject API
</span><span class="cx"> void stop() final;
</span><span class="cx"> const char* activeDOMObjectName() const final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -31,16 +31,23 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx">
</span><ins>+#include "FetchResponse.h"
+#include "WorkerGlobalScope.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope&, FetchRequest&, const Dictionary&, FetchPromise&& promise)
</del><ins>+void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& scope, FetchRequest& input, const Dictionary& dictionary, DeferredWrapper&& promise)
</ins><span class="cx"> {
</span><del>- promise.reject(ASCIILiteral("Fetch is not yet implemented"));
</del><ins>+ if (!scope.scriptExecutionContext())
+ return;
+ FetchResponse::fetch(*scope.scriptExecutionContext(), input, dictionary, WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope&, const String&, const Dictionary&, FetchPromise&& promise)
</del><ins>+void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& scope, const String& url, const Dictionary& dictionary, DeferredWrapper&& promise)
</ins><span class="cx"> {
</span><del>- promise.reject(ASCIILiteral("Fetch is not yet implemented"));
</del><ins>+ if (!scope.scriptExecutionContext())
+ return;
+ FetchResponse::fetch(*scope.scriptExecutionContext(), url, dictionary, WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchWorkerGlobalScopeFetchh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -31,20 +31,19 @@
</span><span class="cx"> #if ENABLE(FETCH_API)
</span><span class="cx">
</span><span class="cx"> #include "JSDOMPromise.h"
</span><ins>+#include <wtf/Forward.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class WorkerGlobalScope;
+class DeferredWrapper;
</ins><span class="cx"> class Dictionary;
</span><span class="cx"> class FetchRequest;
</span><del>-class FetchResponse;
-class ScriptExecutionContext;
-class WorkerGlobalScope;
</del><span class="cx">
</span><span class="cx"> class WorkerGlobalScopeFetch {
</span><span class="cx"> public:
</span><del>- using FetchPromise = DOMPromise<RefPtr<FetchResponse>, String>;
- static void fetch(WorkerGlobalScope&, FetchRequest&, const Dictionary&, FetchPromise&&);
- static void fetch(WorkerGlobalScope&, const String&, const Dictionary&, FetchPromise&&);
</del><ins>+ static void fetch(WorkerGlobalScope&, FetchRequest&, const Dictionary&, DeferredWrapper&&);
+ static void fetch(WorkerGlobalScope&, const String&, const Dictionary&, DeferredWrapper&&);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> // will return a 0 value. Either this should return 0 or the other code path should do a callback with
</span><span class="cx"> // a failure.
</span><span class="cx"> m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, std::unique_ptr<ContentSecurityPolicy>(contentSecurityPolicyCopy));
</span><del>- ASSERT(m_mainThreadLoader);
</del><ins>+ ASSERT(m_mainThreadLoader || m_loadingFinished);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -193,6 +193,7 @@
</span><span class="cx">
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier, double finishTime)
</span><span class="cx"> {
</span><ins>+ m_loadingFinished = true;
</ins><span class="cx"> RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper;
</span><span class="cx"> m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, identifier, finishTime] (ScriptExecutionContext& context) {
</span><span class="cx"> ASSERT_UNUSED(context, context.isWorkerGlobalScope());
</span><span class="lines">@@ -202,6 +203,7 @@
</span><span class="cx">
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFail(const ResourceError& error)
</span><span class="cx"> {
</span><ins>+ m_loadingFinished = true;
</ins><span class="cx"> RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper;
</span><span class="cx"> ResourceError* capturedError = new ResourceError(error.copy());
</span><span class="cx"> if (!m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, capturedError] (ScriptExecutionContext& context) {
</span><span class="lines">@@ -214,6 +216,7 @@
</span><span class="cx">
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck(const ResourceError& error)
</span><span class="cx"> {
</span><ins>+ m_loadingFinished = true;
</ins><span class="cx"> RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper;
</span><span class="cx"> ResourceError* capturedError = new ResourceError(error.copy());
</span><span class="cx"> if (!m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, capturedError] (ScriptExecutionContext& context) {
</span><span class="lines">@@ -226,6 +229,7 @@
</span><span class="cx">
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck()
</span><span class="cx"> {
</span><ins>+ m_loadingFinished = true;
</ins><span class="cx"> RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper;
</span><span class="cx"> m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper] (ScriptExecutionContext& context) {
</span><span class="cx"> ASSERT_UNUSED(context, context.isWorkerGlobalScope());
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.h (198890 => 198891)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.h        2016-03-31 10:31:28 UTC (rev 198890)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.h        2016-03-31 11:05:11 UTC (rev 198891)
</span><span class="lines">@@ -111,6 +111,7 @@
</span><span class="cx">
</span><span class="cx"> // Only to be used on the main thread.
</span><span class="cx"> RefPtr<ThreadableLoader> m_mainThreadLoader;
</span><ins>+ bool m_loadingFinished { false };
</ins><span class="cx">
</span><span class="cx"> // ThreadableLoaderClientWrapper is to be used on the worker context thread.
</span><span class="cx"> // The ref counting is done on either thread.
</span></span></pre>
</div>
</div>
</body>
</html>