DocumentThreadableLoader should report an error when getting a null CachedResource
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Aug 2016 07:25:15 +0000 (07:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Aug 2016 07:25:15 +0000 (07:25 +0000)
commitc7c07909b49f20d314cda735b2bb49ed8bcba4c2
treeb9763b7600a5389346b82b4150d92465154967af
parent00ee9bd5f78e00eed1b5aa2a625b65d432e68894
DocumentThreadableLoader should report an error when getting a null CachedResource
https://bugs.webkit.org/show_bug.cgi?id=160444

Patch by Youenn Fablet <youenn@apple.com> on 2016-08-05
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/event-error-expected.txt:
* web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt:
* web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt:
* web-platform-tests/fetch/api/cors/cors-cookies-expected.txt:
* web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt:

Source/WebCore:

Covered by existing and rebased tests.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest): Calling didFail with an AccessControl error if unable to have a CachedResource.
The resource error type AccessControl is important as it indicates to some clients that they should not retry loading the same resource (EventSource notably).
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest): Removed handling of ThreadableLoader::create returning null.
This should be handled in didFail callback. This allows aligning behavior of
WorkerThreadableLoaderi::MainThreadBridge and XMLHttpRequest as ThreadableLoader clients.
(WebCore::XMLHttpRequest::didFail): Handle the case of didFail being called synchronously from ThreadableLoader::create.
In that case, use a timer to dispatch network events asynchronously.

LayoutTests:

* fast/frames/frame-unload-crash.html:
* http/tests/contentextensions/async-xhr-onerror-expected.txt:
* http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt:
* http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt:
* http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt:
* http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/frames/frame-unload-crash-expected.txt
LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt
LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt
LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt
LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt
LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/event-error-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/xml/XMLHttpRequest.cpp