blob: 67f54da48d21252db1d08d71db557275fad14b75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="iframe" src="/common/blank.html"></iframe>
<script>
promise_test(async (t) => {
// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
await new Promise(r => window.onload = () => t.step_timeout(r, 0));
iframe.contentWindow.location.search = "?1";
await new Promise(r => iframe.onload = () => t.step_timeout(r, 0));
const keyFor1 = iframe.contentWindow.navigation.currentEntry.key;
iframe.contentWindow.location.search = "?2";
await new Promise(r => iframe.onload = () => t.step_timeout(r, 0));
iframe.contentWindow.location.search = "?3";
await new Promise(r => iframe.onload = () => t.step_timeout(r, 0));
iframe.contentWindow.navigation.traverseTo(keyFor1);
await new Promise(r => iframe.onload = () => t.step_timeout(r, 0));
assert_equals((new URL(iframe.contentWindow.location.href)).search, "?1");
assert_equals(iframe.contentWindow.navigation.entries().length, 4);
const [, entry2, entry3] = iframe.contentWindow.navigation.entries();
entry2.ondispose = t.unreached_func("entry2 dispose must not fire");
entry2.addEventListener("dispose", t.unreached_func("entry3 dispose must not fire"));
iframe.contentWindow.navigation.navigate("/common/blank.html?fork");
await new Promise(r => iframe.onload = r);
// Test passes if we reached this point with no dispose events firing.
}, "No dispose events are fired due to cross-document forward pruning");
</script>
|