Apply ContentExtension actions after redirects.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 17:45:12 +0000 (17:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 17:45:12 +0000 (17:45 +0000)
commitbea6a3daebe555deeab39bb9060bc22b1df66bf5
treedf73cd60cd087ecbaf276ed417d3847c734780c4
parent85df6bd92f50b60efcb42f3550d90f111ddb44e6
Apply ContentExtension actions after redirects.
<rdar://problem/20062613> and https://bugs.webkit.org/show_bug.cgi?id=143055

Reviewed by Alex Christensen.

Source/WebCore:

Tests: http/tests/contentextensions/loading/main-resource-redirect-blocked.php
       http/tests/contentextensions/subresource-redirect-blocked.html

This patch moves the "run a URL against the content extension" code from CachedResourceLoader to
the ContentExtensionsBackend.

That allows it to be shared between the CachedResourceLoader where loads are initiated and
ResourceLoader where redirects are handled.

* contentextensions/ContentExtension.cpp:
(WebCore::ContentExtensions::ContentExtension::globalDisplayNoneStyleSheet):

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::displayNoneCSSRule):
* contentextensions/ContentExtensionsBackend.h:

* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):

* loader/ResourceLoadInfo.h:

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::ResourceLoader):
(WebCore::ResourceLoader::willSendRequest):
* loader/ResourceLoader.h:

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::SubresourceLoader):

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):

* page/UserContentController.cpp:
(WebCore::UserContentController::processContentExtensionRulesForLoad):
(WebCore::UserContentController::actionsForResourceLoad): Deleted.
(WebCore::UserContentController::globalDisplayNoneStyleSheet): Deleted.
(WebCore::UserContentController::displayNoneCSSRule): Deleted.
* page/UserContentController.h:

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame): Dump the fact that the load error is kWKErrorCodeCannotShowURL
  which is specifically interesting to a new test.

LayoutTests:

* http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt: Added.
* http/tests/contentextensions/loading/main-resource-redirect-blocked.php: Added.
* http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json: Added.
* http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html: Added.
* http/tests/contentextensions/resources/subresource-redirect.php: Added.
* http/tests/contentextensions/subresource-redirect-blocked-expected.txt: Added.
* http/tests/contentextensions/subresource-redirect-blocked.html: Added.
* http/tests/contentextensions/subresource-redirect-blocked.html.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/loading/main-resource-redirect-blocked.php.json [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/loading/resources/main-resource-redirect-blocked-target.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/resources/subresource-redirect.php [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/subresource-redirect-blocked-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/subresource-redirect-blocked.html.json [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/ContentExtension.cpp
Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
Source/WebCore/contentextensions/ContentExtensionsBackend.h
Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
Source/WebCore/loader/ResourceLoadInfo.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/UserContentController.cpp
Source/WebCore/page/UserContentController.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp