Blocked redirected main resource requests need descriptive errors
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 May 2016 17:43:04 +0000 (17:43 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 May 2016 17:43:04 +0000 (17:43 +0000)
commit86721e9df7fe14d65ee89782f96001998dff06ce
treeb37efc08d2c10dae453e7e2f0e1f102588e622c9
parent031411b2b53be6b6dccc3acff71e652090141b64
Blocked redirected main resource requests need descriptive errors
https://bugs.webkit.org/show_bug.cgi?id=156828
rdar://problem/25711316

Reviewed by Daniel Bates.

Source/WebCore:

Test: http/tests/contentextensions/main-resource-redirect-error.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource):
Call cancelMainResourceLoad() so that InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame()
is called to be consistent with blocked redirected main resource requests.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
(WebCore::ResourceLoader::blockedError):
(WebCore::ResourceLoader::blockedByContentBlockerError):
(WebCore::ResourceLoader::cannotShowURLError):
* loader/ResourceLoader.h:
Use a blockedByContentBlockerError() instead of a cannotShowURLError() when we blocked the load.

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
Print out the error type to make sure we have the most descriptive error type.

LayoutTests:

* http/tests/contentextensions/block-everything-if-domain-expected.txt:
Updated because the page no longer loads because the main resource was blocked.
* http/tests/contentextensions/block-everything-unless-domain-expected.txt:
* http/tests/contentextensions/block-everything-unless-domain.html:
Updated test because about:blank is no longer loaded when the main resource fails to load.
* http/tests/contentextensions/main-resource-expected.txt:
Update to reflect new behavior of calling didFailProvisionalLoadWithError instead of just didFailLoadingWithError.
* http/tests/contentextensions/main-resource-redirect-error-expected.txt: Added.
* http/tests/contentextensions/main-resource-redirect-error.html: Added.
* http/tests/contentextensions/main-resource-redirect-error.html.json: Added.
* http/tests/contentextensions/main-resource.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt
LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt
LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html
LayoutTests/http/tests/contentextensions/main-resource-expected.txt
LayoutTests/http/tests/contentextensions/main-resource-redirect-error-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html.json [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/main-resource.html
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp