Title: [229579] trunk/LayoutTests
Revision
229579
Author
cdu...@apple.com
Date
2018-03-13 11:07:30 -0700 (Tue, 13 Mar 2018)

Log Message

fast/loader/_javascript_-url-iframe-remove-on-navigate.html is flaky with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183588

Reviewed by Alex Christensen.

The test was setting the frame's src to a _javascript_ URL in a setTimeout(0), expecting the
navigation policy delegate to have already completed. However, with asynchronous policy
delegates, this is not necessarily the case. Therefore, we now wait for the beforeunload
event to be fired at the window, since this indicates a policy decision has been made and
we are actually navigating.

I checked that this test was printing the "FAIL" alert in both Firefox and Chrome before
this change.

* fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate-expected.txt: Added.
* fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate.html: Added.
* fast/loader/_javascript_-url-iframe-remove-on-navigate.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229578 => 229579)


--- trunk/LayoutTests/ChangeLog	2018-03-13 17:16:28 UTC (rev 229578)
+++ trunk/LayoutTests/ChangeLog	2018-03-13 18:07:30 UTC (rev 229579)
@@ -1,3 +1,23 @@
+2018-03-13  Chris Dumez  <cdu...@apple.com>
+
+        fast/loader/_javascript_-url-iframe-remove-on-navigate.html is flaky with async policy delegates
+        https://bugs.webkit.org/show_bug.cgi?id=183588
+
+        Reviewed by Alex Christensen.
+
+        The test was setting the frame's src to a _javascript_ URL in a setTimeout(0), expecting the
+        navigation policy delegate to have already completed. However, with asynchronous policy
+        delegates, this is not necessarily the case. Therefore, we now wait for the beforeunload
+        event to be fired at the window, since this indicates a policy decision has been made and
+        we are actually navigating.
+
+        I checked that this test was printing the "FAIL" alert in both Firefox and Chrome before
+        this change.
+
+        * fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate-expected.txt: Added.
+        * fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate.html: Added.
+        * fast/loader/_javascript_-url-iframe-remove-on-navigate.html:
+
 2018-03-13  Ross Kirsling  <ross.kirsl...@sony.com>
 
         [Win] Layout Test fast/html/menuitem-element.html is failing.

Added: trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate-expected.txt (0 => 229579)


--- trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate-expected.txt	2018-03-13 18:07:30 UTC (rev 229579)
@@ -0,0 +1,2 @@
+Blocked access to external URL http://does.not.exist/
+PASS - _javascript_ URL blocked without crashing.

Added: trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate.html (0 => 229579)


--- trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate-async-delegate.html	2018-03-13 18:07:30 UTC (rev 229579)
@@ -0,0 +1,22 @@
+<iframe src="" id="target"></iframe>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    if (testRunner.setShouldDecideNavigationPolicyAfterDelay)
+        testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
+}
+
+let frame = document.getElementById("target");
+frame.contentWindow._onbeforeunload_ = function() {
+    setTimeout(function() {
+        frame.src = ""
+    }, 0);
+};
+
+window.addEventListener("load", function() {
+    document.write("PASS - _javascript_ URL blocked without crashing.");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+</script>

Modified: trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html (229578 => 229579)


--- trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html	2018-03-13 17:16:28 UTC (rev 229578)
+++ trunk/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html	2018-03-13 18:07:30 UTC (rev 229579)
@@ -5,13 +5,16 @@
     testRunner.waitUntilDone();
 }
 
-setTimeout(function() {
-        document.getElementById("target").src = ""
+let frame = document.getElementById("target");
+frame.contentWindow._onbeforeunload_ = function() {
+    setTimeout(function() {
+        frame.src = ""
     }, 0);
+};
 
 window.addEventListener("load", function() {
-        document.write("PASS - _javascript_ URL blocked without crashing.");
-        if (window.testRunner)
-            testRunner.notifyDone();
-    }, false);
+    document.write("PASS - _javascript_ URL blocked without crashing.");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
 </script>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to