Changeset 198891 in webkit
- Timestamp:
- Mar 31, 2016 4:05:11 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198889 r198891 1 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Add basic loading of resources for Workers 4 https://bugs.webkit.org/show_bug.cgi?id=155886 5 6 Reviewed by Alex Christensen. 7 8 Soup and Mac HTTP backends differ on Content-Length header handling. 9 10 * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: Added. 11 1 12 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 13 -
trunk/LayoutTests/imported/w3c/ChangeLog
r198888 r198891 1 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Add basic loading of resources for Workers 4 https://bugs.webkit.org/show_bug.cgi?id=155886 5 6 Reviewed by Alex Christensen. 7 8 Updating test expectations as new tests are passing. 9 10 * web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt: 11 * web-platform-tests/fetch/api/basic/integrity-worker-expected.txt: 12 * web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt: 13 * web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt: 14 * web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt: 15 * web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt: 16 * web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt: 17 * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: 18 * web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt: 19 * web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt: 20 * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: 21 1 22 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 23 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt
r197748 r198891 1 1 2 FAIL Request through fetch should have 'accept' header with value '*/*' promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 2 PASS Request through fetch should have 'accept' header with value '*/*' 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt
r197748 r198891 1 1 2 FAIL Empty string integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 3 FAIL SHA-256 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 4 FAIL SHA-384 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 5 FAIL SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 6 FAIL Invalid integrity assert_ throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")7 FAIL Multiple integrities: valid stronger than invalid promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 8 FAIL Multiple integrities: invalid stronger than valid assert_ throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")9 FAIL Multiple integrities: invalid as strong as valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 10 FAIL Multiple integrities: both are valid promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 11 FAIL Multiple integrities: both are invalid assert_ throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError")12 FAIL CORS empty integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"13 FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: "Fetch is not yet implemented"14 FAIL CORS invalid integrity assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 2 PASS Empty string integrity 3 PASS SHA-256 integrity 4 PASS SHA-384 integrity 5 PASS SHA-512 integrity 6 FAIL Invalid integrity assert_unreached: Should have rejected. Reached unreachable code 7 PASS Multiple integrities: valid stronger than invalid 8 FAIL Multiple integrities: invalid stronger than valid assert_unreached: Should have rejected. Reached unreachable code 9 PASS Multiple integrities: invalid as strong as valid 10 PASS Multiple integrities: both are valid 11 FAIL Multiple integrities: both are invalid assert_unreached: Should have rejected. Reached unreachable code 12 FAIL CORS empty integrity promise_test: Unhandled rejection with value: object "TypeError: Type error" 13 FAIL CORS SHA-512 integrity promise_test: Unhandled rejection with value: object "TypeError: Type error" 14 PASS CORS invalid integrity 15 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt
r198116 r198891 1 1 2 FAIL Fetch ../resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 3 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" 4 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"5 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"2 PASS Fetch ../resources/top.txt with no-cors mode 3 PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode 4 FAIL Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Type error" 5 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" 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt
r198116 r198891 1 1 2 FAIL Fetch ../resources/top.txt with same-origin mode promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 3 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" 4 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") 5 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") 2 PASS Fetch ../resources/top.txt with same-origin mode 3 PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with same-origin mode 4 PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode 5 PASS Fetch http://www.localhost:8800/fetch/api/resources/top.txt with same-origin mode 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt
r197748 r198891 1 1 2 FAIL Accept-Charset is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 3 FAIL Accept-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 4 FAIL Access-Control-Request-Headers is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 5 FAIL Access-Control-Request-Method is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 6 FAIL Connection is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 7 FAIL Content-Length is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 8 FAIL Cookie is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 9 FAIL Cookie2 is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 10 FAIL Date is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 11 FAIL DNT is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 12 FAIL Expect is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 13 FAIL Host is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 14 FAIL Keep-Alive is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 15 FAIL Origin is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 16 FAIL Referer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 17 FAIL TE is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 18 FAIL Trailer is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 19 FAIL Transfer-Encoding is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 20 FAIL Upgrade is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 21 FAIL Via is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 22 FAIL Proxy- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 23 FAIL Proxy-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 24 FAIL Sec- is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 25 FAIL Sec-Test is a forbidden request header promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 2 PASS Accept-Charset is a forbidden request header 3 PASS Accept-Encoding is a forbidden request header 4 PASS Access-Control-Request-Headers is a forbidden request header 5 PASS Access-Control-Request-Method is a forbidden request header 6 PASS Connection is a forbidden request header 7 PASS Content-Length is a forbidden request header 8 PASS Cookie is a forbidden request header 9 PASS Cookie2 is a forbidden request header 10 PASS Date is a forbidden request header 11 PASS DNT is a forbidden request header 12 PASS Expect is a forbidden request header 13 PASS Host is a forbidden request header 14 PASS Keep-Alive is a forbidden request header 15 PASS Origin is a forbidden request header 16 PASS Referer is a forbidden request header 17 PASS TE is a forbidden request header 18 PASS Trailer is a forbidden request header 19 PASS Transfer-Encoding is a forbidden request header 20 PASS Upgrade is a forbidden request header 21 PASS Via is a forbidden request header 22 PASS Proxy- is a forbidden request header 23 PASS Proxy-Test is a forbidden request header 24 PASS Sec- is a forbidden request header 25 PASS Sec-Test is a forbidden request header 26 26 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt
r197748 r198891 1 1 2 FAIL Fetch with GET promise_test: Unhandled rejection with value: "Fetch is not yet implemented"3 FAIL Fetch with HEAD promise_test: Unhandled rejection with value: "Fetch is not yet implemented"4 FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"5 FAIL Fetch with PUT without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 6 FAIL Fetch with PUT with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 7 FAIL Fetch with POST without body promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 8 FAIL Fetch with POST with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 9 FAIL Fetch with Chicken promise_test: Unhandled rejection with value: "Fetch is not yet implemented"10 FAIL Fetch with Chicken with body promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 2 FAIL Fetch with GET assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null 3 FAIL Fetch with HEAD assert_equals: Request has header origin: http://localhost:8800 expected (string) "http://localhost:8800" but got (object) null 4 FAIL Fetch with HEAD with body promise_test: Unhandled rejection with value: object "TypeError: Type error" 5 PASS Fetch with PUT without body 6 PASS Fetch with PUT with body 7 PASS Fetch with POST without body 8 PASS Fetch with POST with body 9 FAIL Fetch with Chicken assert_equals: Request has header content-length: null expected (object) null but got (string) "0" 10 PASS Fetch with Chicken with body 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt
r197748 r198891 1 1 2 FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"3 FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"4 FAIL Fetching about:invalid.com is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 5 FAIL Fetching about:config is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 2 FAIL Fetching about:blank is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" 3 FAIL Fetching about:unicorn is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" 4 PASS Fetching about:invalid.com is KO 5 PASS Fetching about:config is KO 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt
r198888 r198891 1 1 2 FAIL Fetching [GET] URL.createObjectURL(blob) is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented" 3 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") 4 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")2 PASS Fetching [GET] URL.createObjectURL(blob) is OK 3 PASS Fetching [GET] blob:http://www.localhost:8800/ is KO 4 FAIL Fetching [POST] URL.createObjectURL(blob) is KO assert_unreached: Should have rejected. Reached unreachable code 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt
r197748 r198891 1 1 2 FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"3 FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"4 FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: "Fetch is not yet implemented"5 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") 6 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") 7 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") 2 FAIL Fetching data:,response%27s%20body is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" 3 FAIL Fetching data:text/plain;base64,cmVzcG9uc2UncyBib[...] is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" 4 FAIL Fetching data:image/png;base64,cmVzcG9uc2UncyBib2[...] is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" 5 PASS Fetching [GET] data:notAdataUrl.com is KO 6 PASS Fetching [POST] data:,response%27s%20body is KO 7 PASS Fetching [HEAD] data:,response%27s%20body is KO 8 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt
r197748 r198891 1 1 2 FAIL Fetching aaa://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 3 FAIL Fetching cap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 4 FAIL Fetching cid://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 5 FAIL Fetching dav://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 6 FAIL Fetching dict://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 7 FAIL Fetching dns://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 8 FAIL Fetching geo://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 9 FAIL Fetching im://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 10 FAIL Fetching imap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 11 FAIL Fetching ipp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 12 FAIL Fetching ldap://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 13 FAIL Fetching mailto://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 14 FAIL Fetching nfs://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 15 FAIL Fetching pop://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 16 FAIL Fetching rtsp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 17 FAIL Fetching snmp://localhost:8800/ is KO assert_throws: function "function () { throw e }" threw "Fetch is not yet implemented" (undefined) expected object "TypeError" ("TypeError") 2 PASS Fetching aaa://localhost:8800/ is KO 3 PASS Fetching cap://localhost:8800/ is KO 4 PASS Fetching cid://localhost:8800/ is KO 5 PASS Fetching dav://localhost:8800/ is KO 6 PASS Fetching dict://localhost:8800/ is KO 7 PASS Fetching dns://localhost:8800/ is KO 8 PASS Fetching geo://localhost:8800/ is KO 9 PASS Fetching im://localhost:8800/ is KO 10 PASS Fetching imap://localhost:8800/ is KO 11 PASS Fetching ipp://localhost:8800/ is KO 12 PASS Fetching ldap://localhost:8800/ is KO 13 PASS Fetching mailto://localhost:8800/ is KO 14 PASS Fetching nfs://localhost:8800/ is KO 15 PASS Fetching pop://localhost:8800/ is KO 16 PASS Fetching rtsp://localhost:8800/ is KO 17 PASS Fetching snmp://localhost:8800/ is KO 18 18 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt
r197748 r198891 1 1 2 FAIL Stream response's body promise_test: Unhandled rejection with value: "Fetch is not yet implemented"2 FAIL Stream response's body assert_unreached: Body does not exist in response Reached unreachable code 3 3 -
trunk/Source/WebCore/ChangeLog
r198890 r198891 1 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Add basic loading of resources for Workers 4 https://bugs.webkit.org/show_bug.cgi?id=155886 5 6 Reviewed by Alex Christensen. 7 8 Adding impplementation to WorkerGlobalScopeFetch::fetch similarly to DOMWindowFetch::fetch. 9 Refactored code in FetchResponse to share code between the two. 10 11 Updated WorkerThreadableLoader to cope with an ASSERT. 12 The ASSERT ensures that a DocumentThreadableLoader::create returns non null. 13 In our case, it might happen as all cross origin fetch requests are denied at the moment. 14 This leads to calling didFail in DocumentThreadableLoader::create call and DocumentThreadableLoader::create to return null. 15 Updated the ASSERT to ensures that either the load is finished or DocumentThreadableLoader::create does not return null. 16 17 Covered by rebased tests. 18 19 * Modules/fetch/DOMWindowFetch.cpp: 20 (WebCore::DOMWindowFetch::fetch): 21 * Modules/fetch/FetchResponse.cpp: 22 (WebCore::FetchResponse::startFetching): 23 (WebCore::FetchResponse::fetch): 24 * Modules/fetch/FetchResponse.h: 25 * Modules/fetch/WorkerGlobalScopeFetch.cpp: 26 (WebCore::WorkerGlobalScopeFetch::fetch): 27 * Modules/fetch/WorkerGlobalScopeFetch.h: 28 * loader/WorkerThreadableLoader.cpp: 29 (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): 30 (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading): 31 (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail): 32 (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck): 33 (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck): 34 * loader/WorkerThreadableLoader.h: 35 1 36 2016-03-31 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 37 -
trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.cpp
r198833 r198891 42 42 if (!window.scriptExecutionContext()) 43 43 return; 44 ScriptExecutionContext& context = *window.scriptExecutionContext(); 45 46 ExceptionCode ec = 0; 47 RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, input, dictionary, ec); 48 if (ec) { 49 promise.reject(ec); 50 return; 51 } 52 ASSERT(fetchRequest); 53 FetchResponse::fetch(context, *fetchRequest, WTFMove(promise)); 44 FetchResponse::fetch(*window.scriptExecutionContext(), input, dictionary, WTFMove(promise)); 54 45 } 55 46 … … 58 49 if (!window.scriptExecutionContext()) 59 50 return; 60 ScriptExecutionContext& context = *window.scriptExecutionContext(); 61 62 ExceptionCode ec = 0; 63 RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, url, dictionary, ec); 64 if (ec) { 65 promise.reject(ec); 66 return; 67 } 68 ASSERT(fetchRequest); 69 FetchResponse::fetch(context, *fetchRequest, WTFMove(promise)); 51 FetchResponse::fetch(*window.scriptExecutionContext(), url, dictionary, WTFMove(promise)); 70 52 } 71 53 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r198890 r198891 34 34 #include "Dictionary.h" 35 35 #include "ExceptionCode.h" 36 #include "FetchRequest.h" 36 37 #include "JSFetchResponse.h" 37 38 #include "ScriptExecutionContext.h" … … 154 155 } 155 156 156 void FetchResponse:: fetch(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise)157 void FetchResponse::startFetching(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise) 157 158 { 158 159 Ref<FetchResponse> response = adoptRef(*new FetchResponse(context, Type::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse())); … … 164 165 if (!response->m_bodyLoader->start(context, request)) 165 166 response->m_bodyLoader = Nullopt; 167 } 168 169 void FetchResponse::fetch(ScriptExecutionContext& context, FetchRequest& input, const Dictionary& dictionary, FetchPromise&& promise) 170 { 171 ExceptionCode ec = 0; 172 RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, input, dictionary, ec); 173 if (ec) { 174 promise.reject(ec); 175 return; 176 } 177 ASSERT(fetchRequest); 178 startFetching(context, *fetchRequest, WTFMove(promise)); 179 } 180 181 void FetchResponse::fetch(ScriptExecutionContext& context, const String& url, const Dictionary& dictionary, FetchPromise&& promise) 182 { 183 ExceptionCode ec = 0; 184 RefPtr<FetchRequest> fetchRequest = FetchRequest::create(context, url, dictionary, ec); 185 if (ec) { 186 promise.reject(ec); 187 return; 188 } 189 ASSERT(fetchRequest); 190 startFetching(context, *fetchRequest, WTFMove(promise)); 166 191 } 167 192 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.h
r198665 r198891 56 56 57 57 using FetchPromise = DOMPromise<RefPtr<FetchResponse>, ExceptionCode>; 58 static void fetch(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&); 58 static void fetch(ScriptExecutionContext&, FetchRequest&, const Dictionary&, FetchPromise&&); 59 static void fetch(ScriptExecutionContext&, const String&, const Dictionary&, FetchPromise&&); 59 60 60 61 void initializeWith(const Dictionary&, ExceptionCode&); … … 74 75 75 76 FetchResponse(ScriptExecutionContext&, Type, FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&); 77 78 static void startFetching(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&); 76 79 77 80 // ActiveDOMObject API -
trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp
r198833 r198891 32 32 #if ENABLE(FETCH_API) 33 33 34 #include "FetchResponse.h" 35 #include "WorkerGlobalScope.h" 36 34 37 namespace WebCore { 35 38 36 void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& , FetchRequest&, const Dictionary&, FetchPromise&& promise)39 void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& scope, FetchRequest& input, const Dictionary& dictionary, DeferredWrapper&& promise) 37 40 { 38 promise.reject(ASCIILiteral("Fetch is not yet implemented")); 41 if (!scope.scriptExecutionContext()) 42 return; 43 FetchResponse::fetch(*scope.scriptExecutionContext(), input, dictionary, WTFMove(promise)); 39 44 } 40 45 41 void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& , const String&, const Dictionary&, FetchPromise&& promise)46 void WorkerGlobalScopeFetch::fetch(WorkerGlobalScope& scope, const String& url, const Dictionary& dictionary, DeferredWrapper&& promise) 42 47 { 43 promise.reject(ASCIILiteral("Fetch is not yet implemented")); 48 if (!scope.scriptExecutionContext()) 49 return; 50 FetchResponse::fetch(*scope.scriptExecutionContext(), url, dictionary, WTFMove(promise)); 44 51 } 45 52 -
trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h
r198833 r198891 32 32 33 33 #include "JSDOMPromise.h" 34 #include <wtf/Forward.h> 34 35 35 36 namespace WebCore { 36 37 38 class WorkerGlobalScope; 39 class DeferredWrapper; 37 40 class Dictionary; 38 41 class FetchRequest; 39 class FetchResponse;40 class ScriptExecutionContext;41 class WorkerGlobalScope;42 42 43 43 class WorkerGlobalScopeFetch { 44 44 public: 45 using FetchPromise = DOMPromise<RefPtr<FetchResponse>, String>; 46 static void fetch(WorkerGlobalScope&, FetchRequest&, const Dictionary&, FetchPromise&&); 47 static void fetch(WorkerGlobalScope&, const String&, const Dictionary&, FetchPromise&&); 45 static void fetch(WorkerGlobalScope&, FetchRequest&, const Dictionary&, DeferredWrapper&&); 46 static void fetch(WorkerGlobalScope&, const String&, const Dictionary&, DeferredWrapper&&); 48 47 }; 49 48 -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r197551 r198891 113 113 // a failure. 114 114 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, std::unique_ptr<ContentSecurityPolicy>(contentSecurityPolicyCopy)); 115 ASSERT(m_mainThreadLoader );115 ASSERT(m_mainThreadLoader || m_loadingFinished); 116 116 }); 117 117 } … … 194 194 void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier, double finishTime) 195 195 { 196 m_loadingFinished = true; 196 197 RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper; 197 198 m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, identifier, finishTime] (ScriptExecutionContext& context) { … … 203 204 void WorkerThreadableLoader::MainThreadBridge::didFail(const ResourceError& error) 204 205 { 206 m_loadingFinished = true; 205 207 RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper; 206 208 ResourceError* capturedError = new ResourceError(error.copy()); … … 215 217 void WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck(const ResourceError& error) 216 218 { 219 m_loadingFinished = true; 217 220 RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper; 218 221 ResourceError* capturedError = new ResourceError(error.copy()); … … 227 230 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() 228 231 { 232 m_loadingFinished = true; 229 233 RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper = m_workerClientWrapper; 230 234 m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper] (ScriptExecutionContext& context) { -
trunk/Source/WebCore/loader/WorkerThreadableLoader.h
r197563 r198891 112 112 // Only to be used on the main thread. 113 113 RefPtr<ThreadableLoader> m_mainThreadLoader; 114 bool m_loadingFinished { false }; 114 115 115 116 // ThreadableLoaderClientWrapper is to be used on the worker context thread.
Note: See TracChangeset
for help on using the changeset viewer.