[Fetch API] Add basic loading of resources for Workers
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Mar 2016 11:05:11 +0000 (11:05 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Mar 2016 11:05:11 +0000 (11:05 +0000)
commit7955a3c4e045dc055596d06278caaa0636a7ed6f
tree71504f35c3df7a16da209a77f65276dae6e8a8f2
parentc7258c28ec8268b1e52240c09fe47b80e3cefa92
[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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-worker-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/DOMWindowFetch.cpp
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.h
Source/WebCore/loader/WorkerThreadableLoader.cpp
Source/WebCore/loader/WorkerThreadableLoader.h