Title: [229449] trunk/LayoutTests
Revision
229449
Author
[email protected]
Date
2018-03-08 21:56:53 -0800 (Thu, 08 Mar 2018)

Log Message

fast/events/before-unload-returnValue.html times out with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183472

Reviewed by Ryosuke Niwa.

Delay setting the beforeunload handler on the iframe until after the initial load
(of resources/onclick.html). With asynchronous policy delegates, the beforeunload
handler was set too early, during the async policy decision for navigating to
"resources/onclick.html". As a result, the beforeunload handler would get called
for the load to "resources/onclick.html", after receiving the navigation policy
decision, which the test does not expect. The test only expects the beforeunload
handler to be called for later navigations to "resources/does-not-exist.html".

* fast/events/before-unload-returnValue-async-delegates-expected.txt: Copied from LayoutTests/fast/events/before-unload-returnValue-expected.txt.
* fast/events/before-unload-returnValue-async-delegates.html: Copied from LayoutTests/fast/events/before-unload-returnValue.html.
* fast/events/before-unload-returnValue-expected.txt:
* fast/events/before-unload-returnValue.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229448 => 229449)


--- trunk/LayoutTests/ChangeLog	2018-03-09 04:55:22 UTC (rev 229448)
+++ trunk/LayoutTests/ChangeLog	2018-03-09 05:56:53 UTC (rev 229449)
@@ -1,5 +1,25 @@
 2018-03-08  Chris Dumez  <[email protected]>
 
+        fast/events/before-unload-returnValue.html times out with async policy delegates
+        https://bugs.webkit.org/show_bug.cgi?id=183472
+
+        Reviewed by Ryosuke Niwa.
+
+        Delay setting the beforeunload handler on the iframe until after the initial load
+        (of resources/onclick.html). With asynchronous policy delegates, the beforeunload
+        handler was set too early, during the async policy decision for navigating to
+        "resources/onclick.html". As a result, the beforeunload handler would get called
+        for the load to "resources/onclick.html", after receiving the navigation policy
+        decision, which the test does not expect. The test only expects the beforeunload
+        handler to be called for later navigations to "resources/does-not-exist.html".
+
+        * fast/events/before-unload-returnValue-async-delegates-expected.txt: Copied from LayoutTests/fast/events/before-unload-returnValue-expected.txt.
+        * fast/events/before-unload-returnValue-async-delegates.html: Copied from LayoutTests/fast/events/before-unload-returnValue.html.
+        * fast/events/before-unload-returnValue-expected.txt:
+        * fast/events/before-unload-returnValue.html:
+
+2018-03-08  Chris Dumez  <[email protected]>
+
         fast/html/marquee-reparent-check.html is flaky with async delegates
         https://bugs.webkit.org/show_bug.cgi?id=183425
 

Copied: trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates-expected.txt (from rev 229448, trunk/LayoutTests/fast/events/before-unload-returnValue-expected.txt) (0 => 229449)


--- trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates-expected.txt	2018-03-09 05:56:53 UTC (rev 229449)
@@ -0,0 +1,12 @@
+Tests the returnValue attribute of the BeforeUnloadEvent.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testEvent.__proto__ is iframe.contentWindow.BeforeUnloadEvent.prototype
+PASS testEvent.returnValue is ""
+PASS testEvent.returnValue is "This is beforeunload from the top level frame."
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates.html (from rev 229448, trunk/LayoutTests/fast/events/before-unload-returnValue.html) (0 => 229449)


--- trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/before-unload-returnValue-async-delegates.html	2018-03-09 05:56:53 UTC (rev 229449)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+    testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
+    if (testRunner.setShouldDecideNavigationPolicyAfterDelay)
+        testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
+}
+
+function test(_iframe) {
+    iframe = _iframe;
+    iframe.contentWindow._onbeforeunload_ = function(event) {
+    if (iframe.done) {
+        finishJSTest();
+        return;
+    }
+    iframe.done = true;
+    testEvent = event;
+    shouldBe("testEvent.__proto__", "iframe.contentWindow.BeforeUnloadEvent.prototype");
+    shouldBeEqualToString("testEvent.returnValue", "");
+    event.returnValue = "This is beforeunload from the top level frame.";
+    shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from the top level frame.");
+
+    setTimeout(function() {
+        if (window.testRunner)
+            testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false);
+        iframe.contentWindow.location.href = ""
+    }, 0);
+    }
+
+    iframe.contentWindow.location.href = ""
+}
+
+</script>
+</head>
+<body>
+<iframe id="iframe" _onload_="test(this)" src=""
+<script>
+description("Tests the returnValue attribute of the BeforeUnloadEvent.");
+self.jsTestIsAsync = true;
+
+</script>
+<script src=""
+</body>
+</html>
+

Modified: trunk/LayoutTests/fast/events/before-unload-returnValue-expected.txt (229448 => 229449)


--- trunk/LayoutTests/fast/events/before-unload-returnValue-expected.txt	2018-03-09 04:55:22 UTC (rev 229448)
+++ trunk/LayoutTests/fast/events/before-unload-returnValue-expected.txt	2018-03-09 05:56:53 UTC (rev 229449)
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS testEvent.__proto__ is testIframe.contentWindow.BeforeUnloadEvent.prototype
+PASS testEvent.__proto__ is iframe.contentWindow.BeforeUnloadEvent.prototype
 PASS testEvent.returnValue is ""
 PASS testEvent.returnValue is "This is beforeunload from the top level frame."
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/events/before-unload-returnValue.html (229448 => 229449)


--- trunk/LayoutTests/fast/events/before-unload-returnValue.html	2018-03-09 04:55:22 UTC (rev 229448)
+++ trunk/LayoutTests/fast/events/before-unload-returnValue.html	2018-03-09 05:56:53 UTC (rev 229449)
@@ -6,29 +6,16 @@
 if (window.testRunner)
     testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
 
-function test(iframe) {
-    iframe.contentWindow.location.href = ""
-}
-
-</script>
-</head>
-<body>
-<iframe id="testIframe" _onload_="test(this)" src=""
-<script>
-description("Tests the returnValue attribute of the BeforeUnloadEvent.");
-self.jsTestIsAsync = true;
-
-var testIframe = document.getElementById("testIframe");
-
-var testEvent;
-testIframe.contentWindow._onbeforeunload_ = function(event) {
-    if (testIframe.done) {
+function test(_iframe) {
+    iframe = _iframe;
+    iframe.contentWindow._onbeforeunload_ = function(event) {
+    if (iframe.done) {
         finishJSTest();
         return;
     }
-    testIframe.done = true;
+    iframe.done = true;
     testEvent = event;
-    shouldBe("testEvent.__proto__", "testIframe.contentWindow.BeforeUnloadEvent.prototype");
+    shouldBe("testEvent.__proto__", "iframe.contentWindow.BeforeUnloadEvent.prototype");
     shouldBeEqualToString("testEvent.returnValue", "");
     event.returnValue = "This is beforeunload from the top level frame.";
     shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from the top level frame.");
@@ -36,10 +23,22 @@
     setTimeout(function() {
         if (window.testRunner)
             testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false);
-        testIframe.contentWindow.location.href = ""
+        iframe.contentWindow.location.href = ""
     }, 0);
+    }
+
+    iframe.contentWindow.location.href = ""
 }
+
 </script>
+</head>
+<body>
+<iframe id="iframe" _onload_="test(this)" src=""
+<script>
+description("Tests the returnValue attribute of the BeforeUnloadEvent.");
+self.jsTestIsAsync = true;
+
+</script>
 <script src=""
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to