Title: [191063] trunk
Revision
191063
Author
achristen...@apple.com
Date
2015-10-14 13:03:14 -0700 (Wed, 14 Oct 2015)

Log Message

Add SPI for reloading without content blockers
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.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191062 => 191063)


--- trunk/LayoutTests/ChangeLog	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/LayoutTests/ChangeLog	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1,3 +1,16 @@
+2015-10-14  Alex Christensen  <achristen...@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  <sabouhall...@apple.com>
 
         REGRESSION(r53318): background-repeat: space with gradients doesn't render correctly

Deleted: trunk/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt (191062 => 191063)


--- trunk/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt	2015-10-14 20:03:14 UTC (rev 191063)
@@ -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.

Deleted: trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html (191062 => 191063)


--- trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html	2015-10-14 20:03:14 UTC (rev 191063)
@@ -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>

Deleted: trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html.json (191062 => 191063)


--- trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html.json	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/LayoutTests/http/tests/contentextensions/disable-blocker.html.json	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1,10 +0,0 @@
-[
-    {
-        "action": {
-            "type": "block"
-        },
-        "trigger": {
-            "url-filter": ".*"
-        }
-    }
-]

Modified: trunk/Source/WebCore/ChangeLog (191062 => 191063)


--- trunk/Source/WebCore/ChangeLog	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/ChangeLog	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1,3 +1,29 @@
+2015-10-14  Alex Christensen  <achristen...@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.fab...@crf.canon.fr>
 
         Rename JSDOMWrapper to JSDOMObject and JSDOMWrapperWithImplementation to JSDOMWrapper

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (191062 => 191063)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1564,7 +1564,7 @@
     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 @@
     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.

Modified: trunk/Source/WebCore/loader/FrameLoader.h (191062 => 191063)


--- trunk/Source/WebCore/loader/FrameLoader.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -123,7 +123,7 @@
     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&);

Modified: trunk/Source/WebCore/page/Page.h (191062 => 191063)


--- trunk/Source/WebCore/page/Page.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/page/Page.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -428,9 +428,6 @@
     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 @@
 
     MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
     
-    bool m_userContentExtensionsEnabled { true };
     bool m_allowsMediaDocumentInlinePlayback { false };
 };
 

Modified: trunk/Source/WebCore/replay/UserInputBridge.cpp (191062 => 191063)


--- trunk/Source/WebCore/replay/UserInputBridge.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/replay/UserInputBridge.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -242,9 +242,9 @@
     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)

Modified: trunk/Source/WebCore/replay/UserInputBridge.h (191062 => 191063)


--- trunk/Source/WebCore/replay/UserInputBridge.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebCore/replay/UserInputBridge.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -89,7 +89,7 @@
 
     // 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);
 

Modified: trunk/Source/WebKit2/ChangeLog (191062 => 191063)


--- trunk/Source/WebKit2/ChangeLog	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1,3 +1,62 @@
+2015-10-14  Alex Christensen  <achristen...@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.fra...@apple.com>
 
         Change GraphicsContext image-drawing functions to take references

Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp (191062 => 191063)


--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -84,7 +84,6 @@
 #endif
     encoder << appleMailPaginationQuirkEnabled;
     encoder << shouldScaleViewToFitDocument;
-    encoder << userContentExtensionsEnabled;
 }
 
 bool WebPageCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebPageCreationParameters& parameters)
@@ -189,9 +188,6 @@
     if (!decoder.decode(parameters.shouldScaleViewToFitDocument))
         return false;
 
-    if (!decoder.decode(parameters.userContentExtensionsEnabled))
-        return false;
-
     return true;
 }
 

Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.h (191062 => 191063)


--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -130,7 +130,6 @@
 #endif
     bool appleMailPaginationQuirkEnabled;
     bool shouldScaleViewToFitDocument;
-    bool userContentExtensionsEnabled;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -228,12 +228,23 @@
 
 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 WKPageSetUserContentExtensionsEnabled(WKPageRef pageRef, bool enabled)
 {
-    toImpl(pageRef)->setUserContentExtensionsEnabled(enabled);
+    // FIXME: Remove this function once it is no longer used.
 }
 
 bool WKPageSupportsTextEncoding(WKPageRef pageRef)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -83,6 +83,7 @@
 
 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);

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2015-10-14 20:03:14 UTC (rev 191063)
@@ -187,12 +187,16 @@
 
 - (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

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-10-14 20:03:14 UTC (rev 191063)
@@ -563,7 +563,9 @@
 
 - (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 @@
 
 - (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 @@
 
 - (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 @@
     _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();

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -187,6 +187,8 @@
 - (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;

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -2474,7 +2474,9 @@
 {
     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 @@
 {
     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);
 }
 
 /**

Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -247,8 +247,11 @@
     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;
 }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1048,7 +1048,7 @@
     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 @@
     
     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 @@
     parameters.appleMailPaginationQuirkEnabled = false;
 #endif
     parameters.shouldScaleViewToFitDocument = m_shouldScaleViewToFitDocument;
-    parameters.userContentExtensionsEnabled = m_userContentExtensionsEnabled;
 
     return parameters;
 }
@@ -6103,17 +6102,4 @@
     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

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (191062 => 191063)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -362,7 +362,7 @@
     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 @@
     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 @@
     bool m_requiresTargetMonitoring { false };
 #endif
 
-    bool m_userContentExtensionsEnabled { true };
-
 #if PLATFORM(IOS)
     bool m_hasDeferredStartAssistingNode { false };
     std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (191062 => 191063)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-10-14 20:03:14 UTC (rev 191063)
@@ -520,8 +520,6 @@
     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 @@
     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 @@
     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 @@
             documentLoader->setNavigationID(m_pendingNavigationID);
             m_pendingNavigationID = 0;
         }
-        if (frame.page())
-            documentLoader->setUserContentExtensionsEnabled(frame.page()->userContentExtensionsEnabled());
     }
 
     return WTF::move(documentLoader);
@@ -5005,14 +5001,6 @@
     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));

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (191062 => 191063)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-10-14 20:03:14 UTC (rev 191063)
@@ -982,7 +982,7 @@
     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 @@
     void clearWheelEventTestTrigger();
 
     void setShouldScaleViewToFitDocument(bool);
-    void setUserContentExtensionsEnabled(bool);
 
     void pageStoppedScrolling();
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (191062 => 191063)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-10-14 20:03:14 UTC (rev 191063)
@@ -132,7 +132,7 @@
     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 @@
 
     ClearWheelEventTestTrigger()
     SetShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocument)
-    SetUserContentExtensionsEnabled(bool userContentExtensionsEnabled)
 
 #if ENABLE(VIDEO) && USE(GSTREAMER)
     DidEndRequestInstallMissingMediaPlugins(uint32_t result)

Modified: trunk/Tools/ChangeLog (191062 => 191063)


--- trunk/Tools/ChangeLog	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Tools/ChangeLog	2015-10-14 20:03:14 UTC (rev 191063)
@@ -1,3 +1,16 @@
+2015-10-14  Alex Christensen  <achristen...@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....@apple.com>
 
         Rename some JSC option names to be more uniform.

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (191062 => 191063)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2015-10-14 20:03:14 UTC (rev 191063)
@@ -120,10 +120,8 @@
     platformRunUntil(doneRemoving, 0);
     [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions];
 
-    if (PlatformWebView* webView = mainWebView()) {
+    if (PlatformWebView* webView = mainWebView())
         [webView->platformView().configuration.userContentController _removeAllUserContentFilters];
-        webView->platformView()._userContentExtensionsEnabled = true;
-    }
 #endif
 }
 

Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (191062 => 191063)


--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2015-10-14 19:52:24 UTC (rev 191062)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2015-10-14 20:03:14 UTC (rev 191063)
@@ -123,11 +123,6 @@
         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
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to