Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (191457 => 191458)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-10-22 18:35:12 UTC (rev 191458)
@@ -1,3 +1,19 @@
+2015-10-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r190510. rdar://problem/22900764
+
+ 2015-10-02 Alex Christensen <achristen...@webkit.org>
+
+ Reloading without content blockers doesn’t apply to resource loads after the main frame finishes
+ https://bugs.webkit.org/show_bug.cgi?id=149430
+ rdar://problem/22742222
+
+ Reviewed by Geoffrey Garen.
+
+ * http/tests/contentextensions/disable-blocker-expected.txt: Added.
+ * http/tests/contentextensions/disable-blocker.html: Added.
+ * http/tests/contentextensions/disable-blocker.html.json: Added.
+
2015-10-16 Matthew Hanson <matthew_han...@apple.com>
Merge r190752. rdar://problem/23110932
Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt (0 => 191458)
--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker-expected.txt 2015-10-22 18:35:12 UTC (rev 191458)
@@ -0,0 +1,9 @@
+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.
Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html (0 => 191458)
--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html 2015-10-22 18:35:12 UTC (rev 191458)
@@ -0,0 +1,25 @@
+<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>
Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html.json (0 => 191458)
--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html.json (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/disable-blocker.html.json 2015-10-22 18:35:12 UTC (rev 191458)
@@ -0,0 +1,10 @@
+[
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter": ".*"
+ }
+ }
+]
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-22 18:35:12 UTC (rev 191458)
@@ -1,3 +1,39 @@
+2015-10-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r190510. rdar://problem/22900764
+
+ 2015-10-02 Alex Christensen <achristen...@webkit.org>
+
+ Reloading without content blockers doesn't apply to resource loads after the main frame finishes
+ https://bugs.webkit.org/show_bug.cgi?id=149430
+ rdar://problem/22742222
+
+ Reviewed by Geoffrey Garen.
+
+ Test: http/tests/contentextensions/disable-blocker.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::loadResource):
+ * loader/DocumentLoader.h:
+ (WebCore::DocumentLoader::userContentExtensionsEnabled):
+ (WebCore::DocumentLoader::setUserContentExtensionsEnabled):
+ Store and use the state of whether content blockers are enabled or not on the DocumentLoader
+ so that it stays constant for a document's entire life. This state comes from the Page when
+ making the DocumentLoader in WebKit2.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadResourceSynchronously):
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::willSendRequestInternal):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::open):
+ * page/UserContentController.cpp:
+ (WebCore::UserContentController::removeAllUserContentExtensions):
+ (WebCore::UserContentController::processContentExtensionRulesForLoad):
+ (WebCore::UserContentController::actionsForResourceLoad):
+ * page/UserContentController.h:
+
2015-10-16 Matthew Hanson <matthew_han...@apple.com>
Merge r190752. rdar://problem/23110932
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -1207,7 +1207,7 @@
DocumentLoader* documentLoader = frame->loader().documentLoader();
if (page->userContentController() && documentLoader)
- page->userContentController()->processContentExtensionRulesForLoad(*page, request, ResourceType::Media, *documentLoader);
+ page->userContentController()->processContentExtensionRulesForLoad(request, ResourceType::Media, *documentLoader);
if (request.isNull()) {
mediaLoadingFailed(MediaPlayer::FormatError);
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/DocumentLoader.h (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/DocumentLoader.h 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/DocumentLoader.h 2015-10-22 18:35:12 UTC (rev 191458)
@@ -226,6 +226,9 @@
void stopLoadingPlugIns();
void stopLoadingSubresources();
+ bool userContentExtensionsEnabled() const { return m_userContentExtensionsEnabled; }
+ void setUserContentExtensionsEnabled(bool enabled) { m_userContentExtensionsEnabled = enabled; }
+
void addSubresourceLoader(ResourceLoader*);
void removeSubresourceLoader(ResourceLoader*);
WEBCORE_EXPORT void addPlugInStreamLoader(ResourceLoader*);
@@ -450,6 +453,7 @@
HashMap<String, RefPtr<StyleSheetContents>> m_pendingNamedContentExtensionStyleSheets;
HashMap<String, Vector<std::pair<String, uint32_t>>> m_pendingContentExtensionDisplayNoneSelectors;
#endif
+ bool m_userContentExtensionsEnabled { true };
#ifndef NDEBUG
bool m_hasEverBeenAttached { false };
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/FrameLoader.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/FrameLoader.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/FrameLoader.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -2713,7 +2713,7 @@
if (m_documentLoader) {
if (auto* page = m_frame.page()) {
if (auto* controller = page->userContentController())
- controller->processContentExtensionRulesForLoad(*page, newRequest, ResourceType::Raw, *m_documentLoader);
+ controller->processContentExtensionRulesForLoad(newRequest, ResourceType::Raw, *m_documentLoader);
}
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/ResourceLoader.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/ResourceLoader.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/ResourceLoader.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -310,7 +310,7 @@
if (page && m_documentLoader) {
auto* userContentController = page->userContentController();
if (userContentController)
- userContentController->processContentExtensionRulesForLoad(*page, request, m_resourceType, *m_documentLoader);
+ userContentController->processContentExtensionRulesForLoad(request, m_resourceType, *m_documentLoader);
}
}
#endif
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -515,7 +515,7 @@
#if ENABLE(CONTENT_EXTENSIONS)
if (frame() && frame()->mainFrame().page() && frame()->mainFrame().page()->userContentController() && m_documentLoader)
- frame()->mainFrame().page()->userContentController()->processContentExtensionRulesForLoad(*frame()->mainFrame().page(), request.mutableResourceRequest(), toResourceType(type), *m_documentLoader);
+ frame()->mainFrame().page()->userContentController()->processContentExtensionRulesForLoad(request.mutableResourceRequest(), toResourceType(type), *m_documentLoader);
if (request.mutableResourceRequest().isNull())
return nullptr;
Modified: branches/safari-601.1.46-branch/Source/WebCore/page/DOMWindow.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/page/DOMWindow.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/page/DOMWindow.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -2172,9 +2172,10 @@
if (firstFrame->document()
&& firstFrame->mainFrame().page()
&& firstFrame->mainFrame().page()->userContentController()
- && firstFrame->mainFrame().document()) {
+ && firstFrame->mainFrame().document()
+ && firstFrame->mainFrame().document()->loader()) {
ResourceLoadInfo resourceLoadInfo = {firstFrame->document()->completeURL(urlString), firstFrame->mainFrame().document()->url(), ResourceType::Popup};
- Vector<ContentExtensions::Action> actions = firstFrame->mainFrame().page()->userContentController()->actionsForResourceLoad(*firstFrame->mainFrame().page(), resourceLoadInfo);
+ Vector<ContentExtensions::Action> actions = firstFrame->mainFrame().page()->userContentController()->actionsForResourceLoad(resourceLoadInfo, *firstFrame->mainFrame().document()->loader());
for (const ContentExtensions::Action& action : actions) {
if (action.type() == ContentExtensions::ActionType::BlockLoad)
return nullptr;
Modified: branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -28,6 +28,7 @@
#include "DOMWrapperWorld.h"
#include "Document.h"
+#include "DocumentLoader.h"
#include "MainFrame.h"
#include "Page.h"
#include "ResourceLoadInfo.h"
@@ -204,23 +205,23 @@
m_contentExtensionBackend->removeAllContentExtensions();
}
-void UserContentController::processContentExtensionRulesForLoad(Page& page, ResourceRequest& request, ResourceType resourceType, DocumentLoader& initiatingDocumentLoader)
+void UserContentController::processContentExtensionRulesForLoad(ResourceRequest& request, ResourceType resourceType, DocumentLoader& initiatingDocumentLoader)
{
if (!m_contentExtensionBackend)
return;
- if (!page.userContentExtensionsEnabled())
+ if (!initiatingDocumentLoader.userContentExtensionsEnabled())
return;
m_contentExtensionBackend->processContentExtensionRulesForLoad(request, resourceType, initiatingDocumentLoader);
}
-Vector<ContentExtensions::Action> UserContentController::actionsForResourceLoad(Page& page, const ResourceLoadInfo& resourceLoadInfo)
+Vector<ContentExtensions::Action> UserContentController::actionsForResourceLoad(const ResourceLoadInfo& resourceLoadInfo, DocumentLoader& initiatingDocumentLoader)
{
if (!m_contentExtensionBackend)
return Vector<ContentExtensions::Action>();
- if (!page.userContentExtensionsEnabled())
+ if (!initiatingDocumentLoader.userContentExtensionsEnabled())
return Vector<ContentExtensions::Action>();
return m_contentExtensionBackend->actionsForResourceLoad(resourceLoadInfo);
Modified: branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.h (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.h 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebCore/page/UserContentController.h 2015-10-22 18:35:12 UTC (rev 191458)
@@ -92,8 +92,8 @@
WEBCORE_EXPORT void removeUserContentExtension(const String& name);
WEBCORE_EXPORT void removeAllUserContentExtensions();
- void processContentExtensionRulesForLoad(Page&, ResourceRequest&, ResourceType, DocumentLoader& initiatingDocumentLoader);
- Vector<ContentExtensions::Action> actionsForResourceLoad(Page&, const ResourceLoadInfo&);
+ void processContentExtensionRulesForLoad(ResourceRequest&, ResourceType, DocumentLoader& initiatingDocumentLoader);
+ Vector<ContentExtensions::Action> actionsForResourceLoad(const ResourceLoadInfo&, DocumentLoader& initiatingDocumentLoader);
#endif
private:
Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-22 18:35:12 UTC (rev 191458)
@@ -1,3 +1,20 @@
+2015-10-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r190510. rdar://problem/22900764
+
+ 2015-10-02 Alex Christensen <achristen...@webkit.org>
+
+ Reloading without content blockers doesn't apply to resource loads after the main frame finishes
+ https://bugs.webkit.org/show_bug.cgi?id=149430
+ rdar://problem/22742222
+
+ Reviewed by Geoffrey Garen.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::createDocumentLoader):
+ Copy the state of whether content extensions are disabled from the Page to the DocumentLoader
+ when making a DocumentLoader.
+
2015-10-20 Alexey Proskuryakov <a...@apple.com>
Build fix.
Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (191457 => 191458)
--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-10-22 18:35:12 UTC (rev 191458)
@@ -4912,9 +4912,13 @@
{
RefPtr<WebDocumentLoader> documentLoader = WebDocumentLoader::create(request, substituteData);
- if (m_pendingNavigationID && frame.isMainFrame()) {
- documentLoader->setNavigationID(m_pendingNavigationID);
- m_pendingNavigationID = 0;
+ if (frame.isMainFrame()) {
+ if (m_pendingNavigationID) {
+ documentLoader->setNavigationID(m_pendingNavigationID);
+ m_pendingNavigationID = 0;
+ }
+ if (frame.page())
+ documentLoader->setUserContentExtensionsEnabled(frame.page()->userContentExtensionsEnabled());
}
return documentLoader.release();
Modified: branches/safari-601.1.46-branch/Tools/ChangeLog (191457 => 191458)
--- branches/safari-601.1.46-branch/Tools/ChangeLog 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Tools/ChangeLog 2015-10-22 18:35:12 UTC (rev 191458)
@@ -1,3 +1,21 @@
+2015-10-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r190510. rdar://problem/22900764
+
+ 2015-10-02 Alex Christensen <achristen...@webkit.org>
+
+ Reloading without content blockers doesn't apply to resource loads after the main frame finishes
+ https://bugs.webkit.org/show_bug.cgi?id=149430
+ rdar://problem/22742222
+
+ Reviewed by Geoffrey Garen.
+
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::cocoaResetStateToConsistentValues):
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::platformConfigureViewForTest):
+ Test what happens when you disable content blockers from the SPI.
+
2015-10-15 Matthew Hanson <matthew_han...@apple.com>
Rollout r188486. rdar://problem/22707497
Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm (191457 => 191458)
--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2015-10-22 18:00:29 UTC (rev 191457)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2015-10-22 18:35:12 UTC (rev 191458)
@@ -35,6 +35,7 @@
#import <WebKit/WKPageGroup.h>
#import <WebKit/WKStringCF.h>
#import <WebKit/WKURLCF.h>
+#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/_WKUserContentExtensionStore.h>
#import <WebKit/_WKUserContentExtensionStorePrivate.h>
#import <mach-o/dyld.h>
@@ -135,6 +136,11 @@
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
}