Title: [229286] trunk
Revision
229286
Author
[email protected]
Date
2018-03-05 10:15:48 -0800 (Mon, 05 Mar 2018)

Log Message

imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183297

Patch by Ali Juma <[email protected]> on 2018-03-05
Reviewed by Chris Dumez.

Source/WebCore:

When a FrameLoader's policy document loader is cleared after receiving a navigation policy decision
to not continue loading, we still need to trigger a check for load completion, since this loader or
an ancestor loader may have been in state isLoadingInAPISense only because of the existence of
the just-cleared policy document loader. Without triggering this check, these loaders may never
call WebFrameLoaderClient::dispatchDidFinishLoad.

Test: http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):

LayoutTests:

Add layout test coverage. Copy expectations from the existing sync-policy version of the test.

* http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
* http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html: Added.
* http/wpt/html/semantics/text-level-semantics/the-a-element/resources/a-download-404.html: Added.
* platform/ios-wk2/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
* platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
* platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
* platform/wpe/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229285 => 229286)


--- trunk/LayoutTests/ChangeLog	2018-03-05 18:06:08 UTC (rev 229285)
+++ trunk/LayoutTests/ChangeLog	2018-03-05 18:15:48 UTC (rev 229286)
@@ -1,3 +1,20 @@
+2018-03-05  Ali Juma  <[email protected]>
+
+        imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates
+        https://bugs.webkit.org/show_bug.cgi?id=183297
+
+        Reviewed by Chris Dumez.
+
+        Add layout test coverage. Copy expectations from the existing sync-policy version of the test.
+
+        * http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
+        * http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html: Added.
+        * http/wpt/html/semantics/text-level-semantics/the-a-element/resources/a-download-404.html: Added.
+        * platform/ios-wk2/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
+        * platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
+        * platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt: Added.
+        * platform/wpe/TestExpectations:
+
 2018-03-05  Youenn Fablet  <[email protected]>
 
         Service worker test gardening

Added: trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt (0 => 229286)


--- trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,4 @@
+
+
+PASS Do not navigate to 404 for anchor with download 
+

Added: trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html (0 => 229286)


--- trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Clicking on an &lt;a> element with a download attribute and href that leads to 404 should not navigate</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<script src=""
+<script src=""
+<body>
+<script>
+"use strict";
+if (window.testRunner && testRunner.setShouldDecideNavigationPolicyAfterDelay)
+    testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
+
+async_test(t => {
+    const errorFrame = document.createElement("iframe");
+
+    errorFrame.addEventListener("load", function () {
+        errorFrame.contentWindow.addEventListener(
+            "beforeunload", t.unreached_func("Navigated instead of downloading"));
+
+        errorFrame.contentDocument.querySelector("#error-url").click();
+        t.step_timeout(() => t.done(), 1000);
+    });
+    errorFrame.src = ""
+    document.body.appendChild(errorFrame);
+}, "Do not navigate to 404 for anchor with download");
+</script>
+</body>

Added: trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/resources/a-download-404.html (0 => 229286)


--- trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/resources/a-download-404.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/html/semantics/text-level-semantics/the-a-element/resources/a-download-404.html	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,2 @@
+<!doctype html>
+<a id="error-url" href="" download="html.html">Click me</a>

Added: trunk/LayoutTests/platform/ios-wk2/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt (0 => 229286)


--- trunk/LayoutTests/platform/ios-wk2/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 21: TypeError: null is not an object (evaluating 'errorFrame.contentDocument.querySelector("#error-url").click')
+
+
+FAIL Do not navigate to 404 for anchor with download assert_unreached: Navigated instead of downloading Reached unreachable code
+

Added: trunk/LayoutTests/platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt (0 => 229286)


--- trunk/LayoutTests/platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 21: TypeError: null is not an object (evaluating 'errorFrame.contentDocument.querySelector("#error-url").click')
+
+
+FAIL Do not navigate to 404 for anchor with download assert_unreached: Navigated instead of downloading Reached unreachable code
+

Added: trunk/LayoutTests/platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt (0 => 229286)


--- trunk/LayoutTests/platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt	2018-03-05 18:15:48 UTC (rev 229286)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 21: TypeError: null is not an object (evaluating 'errorFrame.contentDocument.querySelector("#error-url").click')
+
+
+FAIL Do not navigate to 404 for anchor with download assert_unreached: Navigated instead of downloading Reached unreachable code
+

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (229285 => 229286)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2018-03-05 18:06:08 UTC (rev 229285)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2018-03-05 18:15:48 UTC (rev 229286)
@@ -334,6 +334,7 @@
 webkit.org/b/180645 imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html [ Failure ]
 webkit.org/b/180648 imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click.html [ Timeout ]
 webkit.org/b/180648 imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html [ Failure ]
+webkit.org/b/180648 http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html [ Failure ]
 webkit.org/b/178576 imported/w3c/web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https.html [ Failure ]
 webkit.org/b/178576 imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-agent-formalism/canblock-serviceworker.https.html [ Failure ]
 

Modified: trunk/Source/WebCore/ChangeLog (229285 => 229286)


--- trunk/Source/WebCore/ChangeLog	2018-03-05 18:06:08 UTC (rev 229285)
+++ trunk/Source/WebCore/ChangeLog	2018-03-05 18:15:48 UTC (rev 229286)
@@ -1,3 +1,21 @@
+2018-03-05  Ali Juma  <[email protected]>
+
+        imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates
+        https://bugs.webkit.org/show_bug.cgi?id=183297
+
+        Reviewed by Chris Dumez.
+
+        When a FrameLoader's policy document loader is cleared after receiving a navigation policy decision
+        to not continue loading, we still need to trigger a check for load completion, since this loader or
+        an ancestor loader may have been in state isLoadingInAPISense only because of the existence of
+        the just-cleared policy document loader. Without triggering this check, these loaders may never
+        call WebFrameLoaderClient::dispatchDidFinishLoad.
+
+        Test: http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+
 2018-03-04  Yusuke Suzuki  <[email protected]>
 
         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (229285 => 229286)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-03-05 18:06:08 UTC (rev 229285)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-03-05 18:15:48 UTC (rev 229286)
@@ -3159,6 +3159,7 @@
             clientRedirectCancelledOrFinished(false);
 
         setPolicyDocumentLoader(nullptr);
+        checkLoadComplete();
 
         // If the navigation request came from the back/forward menu, and we punt on it, we have the 
         // problem that we have optimistically moved the b/f cursor already, so move it back. For sanity,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to