Add SPI to inform applications of WKContentRuleList actions
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 20:23:46 +0000 (20:23 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 20:23:46 +0000 (20:23 +0000)
commite18aa3c16fb42d12e1810a702337fe756b342bf6
tree7d29905bf2e883e072e32df13aee94e5259babdb
parent23ec277ad51fdc3581ec0aaba5e46da38eee9cac
Add SPI to inform applications of WKContentRuleList actions
https://bugs.webkit.org/show_bug.cgi?id=195965
<rdar://problem/42664365>

Reviewed by Geoff Garen.

Source/WebCore:

We already had SPI to inform the application of notifications.
In order to inform it about other actions, I needed to put them in a different structure.
Basically, instead of a Vector<Action> I use a Vector<Vector<Action>> that contains the same actions.
That way we can give one callback per WKContentRuleList.

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::connect):
* WebCore.xcodeproj/project.pbxproj:
* contentextensions/ContentExtensionActions.h:
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::loadEncodedRules):
* contentextensions/ContentExtensionRule.cpp:
(WebCore::ContentExtensions::Action::isolatedCopy const):
* contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::Action::operator== const):
(WebCore::ContentExtensions::Action::setExtensionIdentifier): Deleted.
(WebCore::ContentExtensions::Action::extensionIdentifier const): Deleted.
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForPingLoad):
(WebCore::ContentExtensions::applyResultsToRequest):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): Deleted.
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad): Deleted.
(WebCore::ContentExtensions::applyBlockedStatusToRequest): Deleted.
* contentextensions/ContentExtensionsBackend.h:
* contentextensions/ContentRuleListResults.h: Added.
(WebCore::ContentRuleListResults::Result::shouldNotifyApplication const):
(WebCore::ContentRuleListResults::shouldNotifyApplication const):
(WebCore::ContentRuleListResults::encode const):
(WebCore::ContentRuleListResults::decode):
(WebCore::ContentRuleListResults::Result::encode const):
(WebCore::ContentRuleListResults::Result::decode):
(WebCore::ContentRuleListResults::Summary::encode const):
(WebCore::ContentRuleListResults::Summary::decode):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::subresourcesAllowReuse const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/PingLoader.cpp:
(WebCore::processContentRuleListsForLoad):
(WebCore::PingLoader::loadImage):
(WebCore::PingLoader::sendPing):
(WebCore::PingLoader::sendViolationReport):
(WebCore::processContentExtensionRulesForLoad): Deleted.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::applyResults):
(WebCore::CachedResourceRequest::applyBlockedStatus): Deleted.
* loader/cache/CachedResourceRequest.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::contentRuleListNotification):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::open):
* page/UserContentProvider.cpp:
(WebCore::UserContentProvider::processContentRuleListsForLoad):
(WebCore::UserContentProvider::actionsForResourceLoad):
(WebCore::UserContentProvider::processContentExtensionRulesForLoad): Deleted.
* page/UserContentProvider.h:

Source/WebKit:

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRequest):
(WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
(WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
* NetworkProcess/NetworkLoadChecker.h:
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::contentRuleListNotification):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::contentRuleListNotification):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contentRuleListNotification):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentRuleListNotification):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::allActionsForResourceLoad):
(TestWebKitAPI::testRequest):
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm:
(Notification::description):
(Notification::operator== const):
(toVector):
(-[ContentRuleListNotificationDelegate _webView:URL:contentRuleListIdentifiers:notifications:]):
(-[ContentRuleListNotificationDelegate _webView:contentRuleListWithIdentifier:performedActionOnURL:blockedLoad:blockedCookies:madeHTTPS:notifications:]):
(makeContentRuleList):
(TEST):
(makeWarnContentRuleList): Deleted.

LayoutTests:

* http/tests/contentextensions/popups-expected.txt:
Because popups now use UserContentProvider.processContentRuleListsForLoad like everything else,
it now prints messages to the debug console.  That is a desired improvement, so expectations are updated accordingly.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
58 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/popups-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocketChannel.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/contentextensions/ContentExtensionActions.h
Source/WebCore/contentextensions/ContentExtensionCompiler.cpp
Source/WebCore/contentextensions/ContentExtensionParser.cpp
Source/WebCore/contentextensions/ContentExtensionRule.cpp
Source/WebCore/contentextensions/ContentExtensionRule.h
Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
Source/WebCore/contentextensions/ContentExtensionsBackend.h
Source/WebCore/contentextensions/ContentRuleListResults.h [new file with mode: 0644]
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/PingLoader.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/UserContentProvider.cpp
Source/WebCore/page/UserContentProvider.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp
Source/WebKit/NetworkProcess/NetworkLoadChecker.h
Source/WebKit/Shared/API/APIObject.h
Source/WebKit/Shared/Cocoa/APIObject.mm
Source/WebKit/Sources.txt
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/APIContentRuleListAction.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/APIContentRuleListAction.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/APINavigationClient.h
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKContentRuleListAction.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/Cocoa/_WKContentRuleListAction.mm [new file with mode: 0644]
Source/WebKit/UIProcess/API/Cocoa/_WKContentRuleListActionInternal.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
Tools/ChangeLog
Tools/Scripts/webkitpy/common/system/abstractexecutive.py
Tools/Scripts/webkitpy/common/system/executive.py
Tools/Scripts/webkitpy/common/system/executive_mock.py
Tools/Scripts/webkitpy/common/system/executive_unittest.py
Tools/Scripts/webkitpy/port/darwin.py
Tools/Scripts/webkitpy/port/leakdetector.py
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp
Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm