Skip to content
Permalink
Browse files
fast/loader/javascript-url-iframe-remove-on-navigate.html is flaky wi…
…th 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:


Canonical link: https://commits.webkit.org/199265@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Mar 13, 2018
1 parent d293c82 commit 63b9c1f9521dda3047de58d7671a740da32172d2
@@ -1,3 +1,23 @@
2018-03-13 Chris Dumez <cdumez@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.kirsling@sony.com>

[Win] Layout Test fast/html/menuitem-element.html is failing.
@@ -0,0 +1,2 @@
Blocked access to external URL http://does.not.exist/
PASS - Javascript URL blocked without crashing.
@@ -0,0 +1,22 @@
<iframe src="http://does.not.exist/" 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 = "javascript:alert('FAIL')";
}, 0);
};

window.addEventListener("load", function() {
document.write("PASS - Javascript URL blocked without crashing.");
if (window.testRunner)
testRunner.notifyDone();
}, false);
</script>
@@ -5,13 +5,16 @@
testRunner.waitUntilDone();
}

setTimeout(function() {
document.getElementById("target").src = "javascript:alert('FAIL')";
let frame = document.getElementById("target");
frame.contentWindow.onbeforeunload = function() {
setTimeout(function() {
frame.src = "javascript:alert('FAIL')";
}, 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>

0 comments on commit 63b9c1f

Please sign in to comment.