Bug 1760181 [wpt PR 33182] - App history API to navigation API rename (2/n), a=testonly
[gecko.git] / testing / web-platform / tests / navigation-api / navigation-methods / traverseTo-after-data-url.html
blob0b21a741d3017b71fe26acd586faddbf3c5802b7
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <body>
5 <script>
6 async_test(t => {
7 let i = document.createElement("iframe");
8 i.src = "data:text/html,";
9 document.body.appendChild(i);
10 let start_length = history.length;
12 // Wait for after the load event so that the navigation doesn't get converted
13 // into a replace navigation.
14 window.onload = () => t.step_timeout(() => {
15 i.contentWindow.location = "/common/blank.html";
16 i.onload = () => t.step_timeout(() => {
17 assert_equals(history.length, start_length + 1);
18 assert_equals(i.contentWindow.navigation.entries().length, 1);
19 i.contentWindow.navigation.navigate("#fragment");
20 assert_equals(i.contentWindow.navigation.entries().length, 2);
21 i.contentWindow.navigation.back().committed.then(t.step_func(() => {
22 assert_equals(i.contentWindow.navigation.entries().length, 2);
23 assert_equals(i.contentWindow.navigation.currentEntry.index, 0);
24 return i.contentWindow.navigation.forward().committed;
25 })).then(t.step_func_done(() => {
26 assert_equals(i.contentWindow.navigation.entries().length, 2);
27 assert_equals(i.contentWindow.navigation.currentEntry.index, 1);
28 }));
29 }, 0);
30 }, 0);
31 }, "navigation.traverseTo() should work in an iframe that started at a data: url");
32 </script>
33 </body>