Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="i" src="/common/blank.html"></iframe>
<script>
promise_test(async t => {
await new Promise(resolve => window.onload = resolve);
let beforeunloadCount = 0;
i.contentWindow.onbeforeunload = () => beforeunloadCount++;
i.contentWindow.navigation.onnavigate = e => e.intercept();
await i.contentWindow.navigation.navigate("?intercepted").finished;
assert_equals(i.contentWindow.location.search, "?intercepted");
assert_equals(beforeunloadCount, 0, "beforeunload must not fire");
}, "navigate() whose navigate event is intercepted does not fire beforeunload");
</script>