2 <script src=
"/resources/testharness.js"></script>
3 <script src=
"/resources/testharnessreport.js"></script>
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);
31 }, "navigation.traverseTo() should work in an iframe that started at a data: url");