Add SPI for reloading without content blockers
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Oct 2015 20:03:14 +0000 (20:03 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Oct 2015 20:03:14 +0000 (20:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150058
rdar://problem/22742222

Reviewed by Sam Weinig.

Source/WebCore:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::reloadWithOverrideEncoding):
(WebCore::FrameLoader::reload):
* loader/FrameLoader.h:
* page/Page.h:
(WebCore::Page::userContentController):
(WebCore::Page::userContentExtensionsEnabled): Deleted.
(WebCore::Page::setUserContentExtensionsEnabled): Deleted.
* replay/UserInputBridge.cpp:
(WebCore::UserInputBridge::loadRequest):
(WebCore::UserInputBridge::reloadFrame):
(WebCore::UserInputBridge::stopLoadingFrame):
* replay/UserInputBridge.h:
Pass a bool from the reloadWithoutContentBlockers call to the DocumentLoader,
which stores the state of whether the content blockers are enabled or not.
Remove the state from the Page and copying the state from the Page to the DocumentLoader
because that caused issues with the content blockers being re-enabled at the wrong time.

Source/WebKit2:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageTryClose):
(WKPageSetUserContentExtensionsEnabled):
(WKPageSupportsTextEncoding):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController reload]):
(-[WKBrowsingContextController reloadFromOrigin]):
(-[WKBrowsingContextController applicationNameForUserAgent]):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView _setUserContentExtensionsEnabled:]):
(-[WKWebView _userContentExtensionsEnabled]):
(-[WKWebView _webProcessIdentifier]):
(-[WKWebView _killWebContentProcess]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _killWebContentProcessAndResetState]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkit_web_view_reload):
(webkit_web_view_reload_bypass_cache):
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stopLoading):
(WebKit::WebPageProxy::reload):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
(WebKit::WebPageProxy::setUserContentExtensionsEnabled): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::userContentExtensionsEnabled): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldDispatchFakeMouseMoveEvents):
(WebKit::WebPage::setDefersLoading):
(WebKit::WebPage::reload):
(WebKit::WebPage::goForward):
(WebKit::WebPage::createDocumentLoader):
(WebKit::WebPage::setShouldScaleViewToFitDocument):
(WebKit::WebPage::imageOrMediaDocumentSizeChanged):
(WebKit::WebPage::setUserContentExtensionsEnabled): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformConfigureViewForTest):

LayoutTests:

* http/tests/contentextensions/disable-blocker-expected.txt: Removed.
* http/tests/contentextensions/disable-blocker.html: Removed.
* http/tests/contentextensions/disable-blocker.html.json: Removed.
_userContentExtensionsEnabled is going to be removed, and its functionality is what this test tested.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191063 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt [deleted file]
LayoutTests/http/tests/contentextensions/disable-blocker.html [deleted file]
LayoutTests/http/tests/contentextensions/disable-blocker.html.json [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/page/Page.h
Source/WebCore/replay/UserInputBridge.cpp
Source/WebCore/replay/UserInputBridge.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/WebFrameProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Tools/ChangeLog
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/mac/TestControllerMac.mm

index 35aa5ca..b91b53c 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-14  Alex Christensen  <achristensen@webkit.org>
+
+        Add SPI for reloading without content blockers
+        https://bugs.webkit.org/show_bug.cgi?id=150058
+        rdar://problem/22742222
+
+        Reviewed by Sam Weinig.
+
+        * http/tests/contentextensions/disable-blocker-expected.txt: Removed.
+        * http/tests/contentextensions/disable-blocker.html: Removed.
+        * http/tests/contentextensions/disable-blocker.html.json: Removed.
+        _userContentExtensionsEnabled is going to be removed, and its functionality is what this test tested.
+
 2015-10-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         REGRESSION(r53318): background-repeat: space with gradients doesn't render correctly
diff --git a/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt b/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt
deleted file mode 100644 (file)
index 5a1b73d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CONSOLE MESSAGE: line 12: status: 0, readyState:1, responseText: 
-CONSOLE MESSAGE: line 12: status: 200, readyState:2, responseText: 
-CONSOLE MESSAGE: line 12: status: 200, readyState:3, responseText: 
-CONSOLE MESSAGE: line 12: status: 200, readyState:4, responseText: This page should load.
-<script>
-    console.log("This page should load.");
-</script>
-
-This page should load successfully. The content blocker is disabled in WebKitTestRunner before loading the page.
diff --git a/LayoutTests/http/tests/contentextensions/disable-blocker.html b/LayoutTests/http/tests/contentextensions/disable-blocker.html
deleted file mode 100644 (file)
index 488330a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<head>
-<script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-function sendRequest()
-{
-    var xhr = new XMLHttpRequest();
-    xhr.onreadystatechange = function() {
-        console.log("status: " + xhr.status + ", readyState:" + xhr.readyState + ", responseText: " + xhr.responseText);
-        if (xhr.readyState == 4) {
-            testRunner.notifyDone();
-        }
-    }
-    
-    xhr.open("GET", "resources/should-load.html", true);
-       xhr.send();
-}
-</script>
-</head>
-<body onload="sendRequest()">
-This page should load successfully.  The content blocker is disabled in WebKitTestRunner before loading the page.
-</body>
diff --git a/LayoutTests/http/tests/contentextensions/disable-blocker.html.json b/LayoutTests/http/tests/contentextensions/disable-blocker.html.json
deleted file mode 100644 (file)
index 3a56bdf..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[
-    {
-        "action": {
-            "type": "block"
-        },
-        "trigger": {
-            "url-filter": ".*"
-        }
-    }
-]
index e3a0c6e..6db5533 100644 (file)
@@ -1,3 +1,29 @@
+2015-10-14  Alex Christensen  <achristensen@webkit.org>
+
+        Add SPI for reloading without content blockers
+        https://bugs.webkit.org/show_bug.cgi?id=150058
+        rdar://problem/22742222
+
+        Reviewed by Sam Weinig.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::reloadWithOverrideEncoding):
+        (WebCore::FrameLoader::reload):
+        * loader/FrameLoader.h:
+        * page/Page.h:
+        (WebCore::Page::userContentController):
+        (WebCore::Page::userContentExtensionsEnabled): Deleted.
+        (WebCore::Page::setUserContentExtensionsEnabled): Deleted.
+        * replay/UserInputBridge.cpp:
+        (WebCore::UserInputBridge::loadRequest):
+        (WebCore::UserInputBridge::reloadFrame):
+        (WebCore::UserInputBridge::stopLoadingFrame):
+        * replay/UserInputBridge.h:
+        Pass a bool from the reloadWithoutContentBlockers call to the DocumentLoader, 
+        which stores the state of whether the content blockers are enabled or not.
+        Remove the state from the Page and copying the state from the Page to the DocumentLoader
+        because that caused issues with the content blockers being re-enabled at the wrong time.
+
 2015-10-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Rename JSDOMWrapper to JSDOMObject and JSDOMWrapperWithImplementation to JSDOMWrapper
index 9cb61a8..3fef111 100644 (file)
@@ -1564,7 +1564,7 @@ void FrameLoader::reloadWithOverrideEncoding(const String& encoding)
     loadWithDocumentLoader(loader.ptr(), FrameLoadType::Reload, 0, AllowNavigationToInvalidURL::Yes);
 }
 
-void FrameLoader::reload(bool endToEndReload)
+void FrameLoader::reload(bool endToEndReload, bool contentBlockersEnabled)
 {
     if (!m_documentLoader)
         return;
@@ -1585,6 +1585,8 @@ void FrameLoader::reload(bool endToEndReload)
     Ref<DocumentLoader> loader = m_client.createDocumentLoader(initialRequest, defaultSubstituteDataForURL(initialRequest.url()));
     applyShouldOpenExternalURLsPolicyToNewDocumentLoader(loader, m_documentLoader->shouldOpenExternalURLsPolicyToPropagate());
 
+    loader->setUserContentExtensionsEnabled(contentBlockersEnabled);
+    
     ResourceRequest& request = loader->request();
 
     // FIXME: We don't have a mechanism to revalidate the main resource without reloading at the moment.
index 0fc54d3..dcbc72c 100644 (file)
@@ -123,7 +123,7 @@ public:
     WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy);
     void submitForm(PassRefPtr<FormSubmission>);
 
-    WEBCORE_EXPORT void reload(bool endToEndReload = false);
+    WEBCORE_EXPORT void reload(bool endToEndReload = false, bool contentBlockersEnabled = true);
     WEBCORE_EXPORT void reloadWithOverrideEncoding(const String& overrideEncoding);
 
     void open(CachedFrameBase&);
index 51e4360..7350661 100644 (file)
@@ -428,9 +428,6 @@ public:
     UserContentController* userContentController() { return m_userContentController.get(); }
     WEBCORE_EXPORT void setUserContentController(UserContentController*);
 
-    bool userContentExtensionsEnabled() const { return m_userContentExtensionsEnabled; }
-    void setUserContentExtensionsEnabled(bool enabled) { m_userContentExtensionsEnabled = enabled; }
-
     VisitedLinkStore& visitedLinkStore();
     WEBCORE_EXPORT void setVisitedLinkStore(Ref<VisitedLinkStore>&&);
 
@@ -636,7 +633,6 @@ private:
 
     MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
     
-    bool m_userContentExtensionsEnabled { true };
     bool m_allowsMediaDocumentInlinePlayback { false };
 };
 
index bc7d1ba..1d48d40 100644 (file)
@@ -242,9 +242,9 @@ void UserInputBridge::loadRequest(const FrameLoadRequest& request, InputSource)
     m_page.mainFrame().loader().load(request);
 }
 
-void UserInputBridge::reloadFrame(Frame* frame, bool endToEndReload, InputSource)
+void UserInputBridge::reloadFrame(Frame* frame, bool endToEndReload, bool contentBlockersEnabled, InputSource)
 {
-    frame->loader().reload(endToEndReload);
+    frame->loader().reload(endToEndReload, contentBlockersEnabled);
 }
 
 void UserInputBridge::stopLoadingFrame(Frame* frame, InputSource)
index d1faa66..0903882 100644 (file)
@@ -89,7 +89,7 @@ public:
 
     // Navigation APIs.
     WEBCORE_EXPORT void loadRequest(const FrameLoadRequest&, InputSource source = InputSource::User);
-    WEBCORE_EXPORT void reloadFrame(Frame*, bool endToEndReload, InputSource source = InputSource::User);
+    WEBCORE_EXPORT void reloadFrame(Frame*, bool endToEndReload, bool contentBlockersEnabled, InputSource = InputSource::User);
     WEBCORE_EXPORT void stopLoadingFrame(Frame*, InputSource source = InputSource::User);
     WEBCORE_EXPORT bool tryClosePage(InputSource source = InputSource::User);
 
index b721b7f..bf2f34b 100644 (file)
@@ -1,3 +1,62 @@
+2015-10-14  Alex Christensen  <achristensen@webkit.org>
+
+        Add SPI for reloading without content blockers
+        https://bugs.webkit.org/show_bug.cgi?id=150058
+        rdar://problem/22742222
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageReload):
+        (WKPageReloadWithoutContentBlockers):
+        (WKPageReloadFromOrigin):
+        (WKPageTryClose):
+        (WKPageSetUserContentExtensionsEnabled):
+        (WKPageSupportsTextEncoding):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController reload]):
+        (-[WKBrowsingContextController reloadFromOrigin]):
+        (-[WKBrowsingContextController applicationNameForUserAgent]):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView reload]):
+        (-[WKWebView reloadFromOrigin]):
+        (-[WKWebView _setUserContentExtensionsEnabled:]):
+        (-[WKWebView _userContentExtensionsEnabled]):
+        (-[WKWebView _webProcessIdentifier]):
+        (-[WKWebView _killWebContentProcess]):
+        (-[WKWebView _reloadWithoutContentBlockers]):
+        (-[WKWebView _killWebContentProcessAndResetState]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkit_web_view_reload):
+        (webkit_web_view_reload_bypass_cache):
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::stopLoading):
+        (WebKit::WebPageProxy::reload):
+        (WebKit::WebPageProxy::creationParameters):
+        (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
+        (WebKit::WebPageProxy::setUserContentExtensionsEnabled): Deleted.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::userContentExtensionsEnabled): Deleted.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shouldDispatchFakeMouseMoveEvents):
+        (WebKit::WebPage::setDefersLoading):
+        (WebKit::WebPage::reload):
+        (WebKit::WebPage::goForward):
+        (WebKit::WebPage::createDocumentLoader):
+        (WebKit::WebPage::setShouldScaleViewToFitDocument):
+        (WebKit::WebPage::imageOrMediaDocumentSizeChanged):
+        (WebKit::WebPage::setUserContentExtensionsEnabled): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2015-10-14  Simon Fraser  <simon.fraser@apple.com>
 
         Change GraphicsContext image-drawing functions to take references
index c3fcec3..9f8e348 100644 (file)
@@ -84,7 +84,6 @@ void WebPageCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
 #endif
     encoder << appleMailPaginationQuirkEnabled;
     encoder << shouldScaleViewToFitDocument;
-    encoder << userContentExtensionsEnabled;
 }
 
 bool WebPageCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebPageCreationParameters& parameters)
@@ -189,9 +188,6 @@ bool WebPageCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebPageCre
     if (!decoder.decode(parameters.shouldScaleViewToFitDocument))
         return false;
 
-    if (!decoder.decode(parameters.userContentExtensionsEnabled))
-        return false;
-
     return true;
 }
 
index b5a0410..f0ea190 100644 (file)
@@ -130,7 +130,6 @@ struct WebPageCreationParameters {
 #endif
     bool appleMailPaginationQuirkEnabled;
     bool shouldScaleViewToFitDocument;
-    bool userContentExtensionsEnabled;
 };
 
 } // namespace WebKit
index 79b9c8b..42ee85a 100644 (file)
@@ -228,12 +228,23 @@ void WKPageStopLoading(WKPageRef pageRef)
 
 void WKPageReload(WKPageRef pageRef)
 {
-    toImpl(pageRef)->reload(false);
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = true;
+    toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled);
+}
+
+void WKPageReloadWithoutContentBlockers(WKPageRef pageRef)
+{
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = false;
+    toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 void WKPageReloadFromOrigin(WKPageRef pageRef)
 {
-    toImpl(pageRef)->reload(true);
+    const bool reloadFromOrigin = true;
+    const bool contentBlockersEnabled = true;
+    toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 bool WKPageTryClose(WKPageRef pageRef)
@@ -363,7 +374,7 @@ void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef)
 
 void WKPageSetUserContentExtensionsEnabled(WKPageRef pageRef, bool enabled)
 {
-    toImpl(pageRef)->setUserContentExtensionsEnabled(enabled);
+    // FIXME: Remove this function once it is no longer used.
 }
 
 bool WKPageSupportsTextEncoding(WKPageRef pageRef)
index ec1e6da..5f3c850 100644 (file)
@@ -83,6 +83,7 @@ WK_EXPORT void WKPageLoadWebArchiveDataWithUserData(WKPageRef page, WKDataRef we
 
 WK_EXPORT void WKPageStopLoading(WKPageRef page);
 WK_EXPORT void WKPageReload(WKPageRef page);
+WK_EXPORT void WKPageReloadWithoutContentBlockers(WKPageRef page);
 WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page);
 
 WK_EXPORT bool WKPageTryClose(WKPageRef page);
index 70eb23c..5bbbad6 100644 (file)
@@ -187,12 +187,16 @@ static HashMap<WebPageProxy*, WKBrowsingContextController *>& browsingContextCon
 
 - (void)reload
 {
-    _page->reload(false);
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = true;
+    _page->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 - (void)reloadFromOrigin
 {
-    _page->reload(true);
+    const bool reloadFromOrigin = true;
+    const bool contentBlockersEnabled = true;
+    _page->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 - (NSString *)applicationNameForUserAgent
index a3c0a6d..60453f8 100644 (file)
@@ -563,7 +563,9 @@ static bool shouldAllowPictureInPictureMediaPlayback()
 
 - (WKNavigation *)reload
 {
-    auto navigation = _page->reload(false);
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = true;
+    auto navigation = _page->reload(reloadFromOrigin, contentBlockersEnabled);
     if (!navigation)
         return nil;
 
@@ -572,7 +574,9 @@ static bool shouldAllowPictureInPictureMediaPlayback()
 
 - (WKNavigation *)reloadFromOrigin
 {
-    auto navigation = _page->reload(true);
+    const bool reloadFromOrigin = true;
+    const bool contentBlockersEnabled = true;
+    auto navigation = _page->reload(reloadFromOrigin, contentBlockersEnabled);
     if (!navigation)
         return nil;
 
@@ -2026,12 +2030,13 @@ static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOff
 
 - (void)_setUserContentExtensionsEnabled:(BOOL)userContentExtensionsEnabled
 {
-    _page->setUserContentExtensionsEnabled(userContentExtensionsEnabled);
+    // This is kept for binary compatibility with iOS 9.
 }
 
 - (BOOL)_userContentExtensionsEnabled
 {
-    return _page->userContentExtensionsEnabled();
+    // This is kept for binary compatibility with iOS 9.
+    return true;
 }
 
 - (pid_t)_webProcessIdentifier
@@ -2047,6 +2052,17 @@ static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOff
     _page->process().terminate();
 }
 
+- (WKNavigation *)_reloadWithoutContentBlockers
+{
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = false;
+    auto navigation = _page->reload(reloadFromOrigin, contentBlockersEnabled);
+    if (!navigation)
+        return nil;
+    
+    return [wrapper(*navigation.release().leakRef()) autorelease];
+}
+
 - (void)_killWebContentProcessAndResetState
 {
     _page->terminateProcess();
index 16ddfb8..bfee888 100644 (file)
@@ -187,6 +187,8 @@ typedef NS_ENUM(NSInteger, _WKImmediateActionType) {
 - (id)_immediateActionAnimationControllerForHitTestResult:(_WKHitTestResult *)hitTestResult withType:(_WKImmediateActionType)type userData:(id<NSSecureCoding>)userData;
 #endif
 
+- (WKNavigation *)_reloadWithoutContentBlockers WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
 - (void)_killWebContentProcessAndResetState;
 
 - (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
index f99c763..49d4111 100644 (file)
@@ -2474,7 +2474,9 @@ void webkit_web_view_reload(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    getPage(webView)->reload(false);
+    const bool reloadFromOrigin = false;
+    const bool contentBlockersEnabled = true;
+    getPage(webView)->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 /**
@@ -2488,7 +2490,9 @@ void webkit_web_view_reload_bypass_cache(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    getPage(webView)->reload(true);
+    const bool reloadFromOrigin = true;
+    const bool contentBlockersEnabled = true;
+    getPage(webView)->reload(reloadFromOrigin, contentBlockersEnabled);
 }
 
 /**
index 496c0ee..15b8e28 100644 (file)
@@ -247,8 +247,11 @@ bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const WebCore::Resou
     RefPtr<WebPageProxy> page { m_page };
     ASSERT(page);
     m_contentFilterUnblockHandler.requestUnblockAsync([page](bool unblocked) {
-        if (unblocked)
-            page->reload(false);
+        if (unblocked) {
+            const bool reloadFromOrigin = false;
+            const bool contentBlockersEnabled = true;
+            page->reload(reloadFromOrigin, contentBlockersEnabled);
+        }
     });
     return true;
 }
index 300e879..9627c60 100644 (file)
@@ -1048,7 +1048,7 @@ void WebPageProxy::stopLoading()
     m_process->responsivenessTimer()->start();
 }
 
-RefPtr<API::Navigation> WebPageProxy::reload(bool reloadFromOrigin)
+RefPtr<API::Navigation> WebPageProxy::reload(bool reloadFromOrigin, bool contentBlockersEnabled)
 {
     SandboxExtension::Handle sandboxExtensionHandle;
 
@@ -1068,7 +1068,7 @@ RefPtr<API::Navigation> WebPageProxy::reload(bool reloadFromOrigin)
     
     auto navigation = m_navigationState->createReloadNavigation();
 
-    m_process->send(Messages::WebPage::Reload(navigation->navigationID(), reloadFromOrigin, sandboxExtensionHandle), m_pageID);
+    m_process->send(Messages::WebPage::Reload(navigation->navigationID(), reloadFromOrigin, contentBlockersEnabled, sandboxExtensionHandle), m_pageID);
     m_process->responsivenessTimer()->start();
 
     return WTF::move(navigation);
@@ -5167,7 +5167,6 @@ WebPageCreationParameters WebPageProxy::creationParameters()
     parameters.appleMailPaginationQuirkEnabled = false;
 #endif
     parameters.shouldScaleViewToFitDocument = m_shouldScaleViewToFitDocument;
-    parameters.userContentExtensionsEnabled = m_userContentExtensionsEnabled;
 
     return parameters;
 }
@@ -6103,17 +6102,4 @@ void WebPageProxy::setShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocu
     m_process->send(Messages::WebPage::SetShouldScaleViewToFitDocument(shouldScaleViewToFitDocument), m_pageID);
 }
 
-void WebPageProxy::setUserContentExtensionsEnabled(bool userContentExtensionsEnabled)
-{
-    if (m_userContentExtensionsEnabled == userContentExtensionsEnabled)
-        return;
-
-    m_userContentExtensionsEnabled = userContentExtensionsEnabled;
-
-    if (!isValid())
-        return;
-
-    m_process->send(Messages::WebPage::SetUserContentExtensionsEnabled(userContentExtensionsEnabled), m_pageID);
-}
-
 } // namespace WebKit
index e1511b7..c306fd5 100644 (file)
@@ -362,7 +362,7 @@ public:
     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
 
     void stopLoading();
-    RefPtr<API::Navigation> reload(bool reloadFromOrigin);
+    RefPtr<API::Navigation> reload(bool reloadFromOrigin, bool contentBlockersEnabled);
 
     RefPtr<API::Navigation> goForward();
     RefPtr<API::Navigation> goBack();
@@ -650,9 +650,6 @@ public:
     void scaleView(double scale);
     void setShouldScaleViewToFitDocument(bool);
     
-    bool userContentExtensionsEnabled() { return m_userContentExtensionsEnabled; }
-    void setUserContentExtensionsEnabled(bool);
-
     float deviceScaleFactor() const;
     void setIntrinsicDeviceScaleFactor(float);
     void setCustomDeviceScaleFactor(float);
@@ -1770,8 +1767,6 @@ private:
     bool m_requiresTargetMonitoring { false };
 #endif
 
-    bool m_userContentExtensionsEnabled { true };
-
 #if PLATFORM(IOS)
     bool m_hasDeferredStartAssistingNode { false };
     std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
index e68cdfe..e868a40 100644 (file)
@@ -520,8 +520,6 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     if (parameters.viewScaleFactor != 1)
         scaleView(parameters.viewScaleFactor);
 
-    m_page->setUserContentExtensionsEnabled(parameters.userContentExtensionsEnabled);
-
 #if PLATFORM(IOS)
     m_page->settings().setContentDispositionAttachmentSandboxEnabled(true);
 #endif
@@ -1164,7 +1162,7 @@ void WebPage::setDefersLoading(bool defersLoading)
     m_page->setDefersLoading(defersLoading);
 }
 
-void WebPage::reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle& sandboxExtensionHandle)
+void WebPage::reload(uint64_t navigationID, bool reloadFromOrigin, bool contentBlockersEnabled, const SandboxExtension::Handle& sandboxExtensionHandle)
 {
     SendStopResponsivenessTimer stopper(this);
 
@@ -1172,7 +1170,7 @@ void WebPage::reload(uint64_t navigationID, bool reloadFromOrigin, const Sandbox
     m_pendingNavigationID = navigationID;
 
     m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
-    corePage()->userInputBridge().reloadFrame(m_mainFrame->coreFrame(), reloadFromOrigin);
+    corePage()->userInputBridge().reloadFrame(m_mainFrame->coreFrame(), reloadFromOrigin, contentBlockersEnabled);
 }
 
 void WebPage::goForward(uint64_t navigationID, uint64_t backForwardItemID)
@@ -4903,8 +4901,6 @@ Ref<DocumentLoader> WebPage::createDocumentLoader(Frame& frame, const ResourceRe
             documentLoader->setNavigationID(m_pendingNavigationID);
             m_pendingNavigationID = 0;
         }
-        if (frame.page())
-            documentLoader->setUserContentExtensionsEnabled(frame.page()->userContentExtensionsEnabled());
     }
 
     return WTF::move(documentLoader);
@@ -5005,14 +5001,6 @@ void WebPage::setShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocument)
     m_drawingArea->setShouldScaleViewToFitDocument(shouldScaleViewToFitDocument);
 }
 
-void WebPage::setUserContentExtensionsEnabled(bool userContentExtensionsEnabled)
-{
-    if (!m_page)
-        return;
-
-    m_page->setUserContentExtensionsEnabled(userContentExtensionsEnabled);
-}
-
 void WebPage::imageOrMediaDocumentSizeChanged(const IntSize& newSize)
 {
     send(Messages::WebPageProxy::ImageOrMediaDocumentSizeChanged(newSize));
index 91967e7..15386ab 100644 (file)
@@ -982,7 +982,7 @@ private:
     void loadPlainTextString(const String&, const UserData&);
     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
-    void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
+    void reload(uint64_t navigationID, bool reloadFromOrigin, bool contentBlockersEnabled, const SandboxExtension::Handle&);
     void goForward(uint64_t navigationID, uint64_t);
     void goBack(uint64_t navigationID, uint64_t);
     void goToBackForwardItem(uint64_t navigationID, uint64_t);
@@ -1160,7 +1160,6 @@ private:
     void clearWheelEventTestTrigger();
 
     void setShouldScaleViewToFitDocument(bool);
-    void setUserContentExtensionsEnabled(bool);
 
     void pageStoppedScrolling();
 
index 56b121c..be71933 100644 (file)
@@ -132,7 +132,7 @@ messages -> WebPage LegacyReceiver {
     LoadWebArchiveData(IPC::DataReference webArchiveData, WebKit::UserData userData)
     NavigateToPDFLinkWithSimulatedClick(String url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint)
 
-    Reload(uint64_t navigationID, bool reloadFromOrigin, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+    Reload(uint64_t navigationID, bool reloadFromOrigin, bool contentBlockersEnabled, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     StopLoading()
 
     StopLoadingFrame(uint64_t frameID)
@@ -428,7 +428,6 @@ messages -> WebPage LegacyReceiver {
 
     ClearWheelEventTestTrigger()
     SetShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocument)
-    SetUserContentExtensionsEnabled(bool userContentExtensionsEnabled)
 
 #if ENABLE(VIDEO) && USE(GSTREAMER)
     DidEndRequestInstallMissingMediaPlugins(uint32_t result)
index 0eb01a0..49c18e2 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-14  Alex Christensen  <achristensen@webkit.org>
+
+        Add SPI for reloading without content blockers
+        https://bugs.webkit.org/show_bug.cgi?id=150058
+        rdar://problem/22742222
+
+        Reviewed by Sam Weinig.
+
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::cocoaResetStateToConsistentValues):
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::TestController::platformConfigureViewForTest):
+
 2015-10-14  Mark Lam  <mark.lam@apple.com>
 
         Rename some JSC option names to be more uniform.
index bcde74a..d231b5e 100644 (file)
@@ -120,10 +120,8 @@ void TestController::cocoaResetStateToConsistentValues()
     platformRunUntil(doneRemoving, 0);
     [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
 
-    if (PlatformWebView* webView = mainWebView()) {
+    if (PlatformWebView* webView = mainWebView())
         [webView->platformView().configuration.userContentController _removeAllUserContentFilters];
-        webView->platformView()._userContentExtensionsEnabled = true;
-    }
 #endif
 }
 
index 467d724..cefdacf 100644 (file)
@@ -123,11 +123,6 @@ void TestController::platformConfigureViewForTest(const TestInvocation& test)
         doneCompiling = true;
     }];
     platformRunUntil(doneCompiling, 0);
-
-    // This is for http/tests/contentextensions/disable-blocker.html
-    if (!test.urlContains("disable-blocker"))
-        return;
-    mainWebView()->platformView()._userContentExtensionsEnabled = false;
 #endif
 }