Diff
Modified: trunk/LayoutTests/ChangeLog (200460 => 200461)
--- trunk/LayoutTests/ChangeLog 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/ChangeLog 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,3 +1,23 @@
+2016-05-04 Alex Christensen <[email protected]>
+
+ Blocked redirected main resource requests need descriptive errors
+ https://bugs.webkit.org/show_bug.cgi?id=156828
+ rdar://problem/25711316
+
+ Reviewed by Daniel Bates.
+
+ * http/tests/contentextensions/block-everything-if-domain-expected.txt:
+ Updated because the page no longer loads because the main resource was blocked.
+ * http/tests/contentextensions/block-everything-unless-domain-expected.txt:
+ * http/tests/contentextensions/block-everything-unless-domain.html:
+ Updated test because about:blank is no longer loaded when the main resource fails to load.
+ * http/tests/contentextensions/main-resource-expected.txt:
+ Update to reflect new behavior of calling didFailProvisionalLoadWithError instead of just didFailLoadingWithError.
+ * http/tests/contentextensions/main-resource-redirect-error-expected.txt: Added.
+ * http/tests/contentextensions/main-resource-redirect-error.html: Added.
+ * http/tests/contentextensions/main-resource-redirect-error.html.json: Added.
+ * http/tests/contentextensions/main-resource.html:
+
2016-05-04 Daniel Bates <[email protected]>
CSP: Perform case sensitive match against path portion of source _expression_ URL that ends in '/'
Modified: trunk/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt (200460 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,6 +1 @@
CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-everything-if-domain.html from loading a resource from http://127.0.0.1:8000/contentextensions/block-everything-if-domain.html
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
Modified: trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt (200460 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,5 +1,4 @@
-CONSOLE MESSAGE: line 18: http://127.0.0.1:8000/contentextensions/resources/block-everything-unless-domain-helper.html
CONSOLE MESSAGE: line 5: helper loaded
CONSOLE MESSAGE: line 7: Content blocker prevented frame displaying http://localhost:8000/contentextensions/resources/should-not-load.html from loading a resource from http://localhost:8000/contentextensions/resources/should-not-load.html
-CONSOLE MESSAGE: line 15: successfully blocked load from localhost
+CONSOLE MESSAGE: line 13: PASS - blocked the load
Modified: trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html (200460 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html 2016-05-05 17:43:04 UTC (rev 200461)
@@ -9,13 +9,12 @@
var maxEventLoopRuns = 50;
function helperLoaded () {
if (!maxEventLoopRuns) {
- console.log("blocking load failed");
+ if (helper.location == "http://127.0.0.1:8000/contentextensions/resources/block-everything-unless-domain-helper.html")
+ console.log("PASS - blocked the load");
+ else
+ console.log("FAIL - loaded blocked URL");
testRunner.notifyDone();
- } else if (helper.location == "about:blank") {
- console.log("successfully blocked load from localhost");
- testRunner.notifyDone();
} else {
- console.log(helper.location);
setTimeout(helperLoaded, 1);
maxEventLoopRuns--;
}
Modified: trunk/LayoutTests/http/tests/contentextensions/main-resource-expected.txt (200460 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/main-resource-expected.txt 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/http/tests/contentextensions/main-resource-expected.txt 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,5 +1,8 @@
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
http://127.0.0.1:8000/contentextensions/main-resource.html - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/resources/should-not-load.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/should-not-load.html
-http://127.0.0.1:8000/contentextensions/resources/should-not-load.html - didFailLoadingWithError: <NSError domain WebKitErrorDomain, code 104, failing URL "http://127.0.0.1:8000/contentextensions/resources/should-not-load.html">
-http://127.0.0.1:8000/contentextensions/resources/should-not-load.html - didFinishLoading
-
+main frame - didFailProvisionalLoadWithError
+main frame - (kWKErrorCodeFrameLoadBlockedByContentBlocker)
Added: trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error-expected.txt (0 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error-expected.txt 2016-05-05 17:43:04 UTC (rev 200461)
@@ -0,0 +1,9 @@
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+http://127.0.0.1:8000/contentextensions/main-resource-redirect-error.html - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/resources/redirect.php?url="" - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/resources/redirect.php?url="" main document URL http://127.0.0.1:8000/resources/redirect.php?url="" http method GET> redirectResponse (null)
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/resources/should-not-load.html from loading a resource from http://127.0.0.1:8000/resources/should-not-load.html
+main frame - didFailProvisionalLoadWithError
+main frame - (kWKErrorCodeFrameLoadBlockedByContentBlocker)
Added: trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html (0 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html 2016-05-05 17:43:04 UTC (rev 200461)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<script>
+if (window.testRunner) {
+ testRunner.dumpResourceLoadCallbacks();
+ testRunner.dumpFrameLoadCallbacks();
+ testRunner.dumpAsText();
+ testRunner.queueLoad("/resources/redirect.php?url=""
+}
+</script>
Added: trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html.json (0 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html.json (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/main-resource-redirect-error.html.json 2016-05-05 17:43:04 UTC (rev 200461)
@@ -0,0 +1,10 @@
+[
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter": "/should-not-load"
+ }
+ }
+]
Modified: trunk/LayoutTests/http/tests/contentextensions/main-resource.html (200460 => 200461)
--- trunk/LayoutTests/http/tests/contentextensions/main-resource.html 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/LayoutTests/http/tests/contentextensions/main-resource.html 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,6 +1,7 @@
<script>
if (window.testRunner) {
testRunner.dumpResourceLoadCallbacks();
+ testRunner.dumpFrameLoadCallbacks();
testRunner.dumpAsText();
testRunner.queueLoad("resources/should-not-load.html");
}
Modified: trunk/Source/WebCore/ChangeLog (200460 => 200461)
--- trunk/Source/WebCore/ChangeLog 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Source/WebCore/ChangeLog 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,3 +1,25 @@
+2016-05-04 Alex Christensen <[email protected]>
+
+ Blocked redirected main resource requests need descriptive errors
+ https://bugs.webkit.org/show_bug.cgi?id=156828
+ rdar://problem/25711316
+
+ Reviewed by Daniel Bates.
+
+ Test: http/tests/contentextensions/main-resource-redirect-error.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::startLoadingMainResource):
+ Call cancelMainResourceLoad() so that InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame()
+ is called to be consistent with blocked redirected main resource requests.
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::willSendRequestInternal):
+ (WebCore::ResourceLoader::blockedError):
+ (WebCore::ResourceLoader::blockedByContentBlockerError):
+ (WebCore::ResourceLoader::cannotShowURLError):
+ * loader/ResourceLoader.h:
+ Use a blockedByContentBlockerError() instead of a cannotShowURLError() when we blocked the load.
+
2016-05-05 Zan Dobersek <[email protected]>
Fix assertions in debug builds for the GTK+ port.
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (200460 => 200461)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1504,10 +1504,8 @@
#if ENABLE(CONTENT_EXTENSIONS)
if (m_mainResource && m_mainResource->errorOccurred() && m_frame->page() && m_mainResource->resourceError().domain() == ContentExtensions::WebKitContentBlockerDomain) {
- m_identifierForLoadWithoutResourceLoader = m_frame->page()->progress().createUniqueIdentifier();
- frameLoader()->notifier().assignIdentifierToInitialRequest(m_identifierForLoadWithoutResourceLoader, this, request);
- frameLoader()->notifier().dispatchDidFailLoading(this, m_identifierForLoadWithoutResourceLoader, frameLoader()->blockedByContentBlockerError(m_request));
- m_mainResource = nullptr;
+ cancelMainResourceLoad(frameLoader()->blockedByContentBlockerError(m_request));
+ return;
}
#endif
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (200460 => 200461)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2016-05-05 17:43:04 UTC (rev 200461)
@@ -346,8 +346,11 @@
if (frameLoader()) {
Page* page = frameLoader()->frame().page();
if (page && m_documentLoader) {
- if (page->userContentProvider().processContentExtensionRulesForLoad(request, m_resourceType, *m_documentLoader) == ContentExtensions::BlockedStatus::Blocked)
+ if (page->userContentProvider().processContentExtensionRulesForLoad(request, m_resourceType, *m_documentLoader) == ContentExtensions::BlockedStatus::Blocked) {
request = { };
+ didFail(blockedByContentBlockerError());
+ return;
+ }
}
}
#endif
@@ -603,6 +606,11 @@
return frameLoader()->client().blockedError(m_request);
}
+ResourceError ResourceLoader::blockedByContentBlockerError()
+{
+ return frameLoader()->client().blockedByContentBlockerError(m_request);
+}
+
ResourceError ResourceLoader::cannotShowURLError()
{
return frameLoader()->client().cannotShowURLError(m_request);
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (200460 => 200461)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2016-05-05 17:43:04 UTC (rev 200461)
@@ -84,6 +84,7 @@
WEBCORE_EXPORT void cancel(const ResourceError&);
WEBCORE_EXPORT ResourceError cancelledError();
ResourceError blockedError();
+ ResourceError blockedByContentBlockerError();
ResourceError cannotShowURLError();
virtual void setDefersLoading(bool);
Modified: trunk/Tools/ChangeLog (200460 => 200461)
--- trunk/Tools/ChangeLog 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Tools/ChangeLog 2016-05-05 17:43:04 UTC (rev 200461)
@@ -1,3 +1,15 @@
+2016-05-04 Alex Christensen <[email protected]>
+
+ Blocked redirected main resource requests need descriptive errors
+ https://bugs.webkit.org/show_bug.cgi?id=156828
+ rdar://problem/25711316
+
+ Reviewed by Daniel Bates.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
+ Print out the error type to make sure we have the most descriptive error type.
+
2016-05-05 Enrique Ocaña González <[email protected]>
[GStreamer] Bump internal jhbuild versions to 1.8.0 and patches to support MSE
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (200460 => 200461)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-05-05 17:41:11 UTC (rev 200460)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-05-05 17:43:04 UTC (rev 200461)
@@ -697,8 +697,11 @@
if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks()) {
dumpLoadEvent(frame, "didFailProvisionalLoadWithError");
- if (WKErrorGetErrorCode(error) == kWKErrorCodeCannotShowURL)
+ auto code = WKErrorGetErrorCode(error);
+ if (code == kWKErrorCodeCannotShowURL)
dumpLoadEvent(frame, "(kWKErrorCodeCannotShowURL)");
+ else if (code == kWKErrorCodeFrameLoadBlockedByContentBlocker)
+ dumpLoadEvent(frame, "(kWKErrorCodeFrameLoadBlockedByContentBlocker)");
}
frameDidChangeLocation(frame);