cross-document-getState.html (881B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="/common/blank.html"></iframe> 5 <script> 6 async_test(t => { 7 window.onload = t.step_func(() => { 8 i.contentWindow.navigation.updateCurrentEntry({ state: { data: "value" } }); 9 assert_equals(i.contentWindow.navigation.entries().length, 1); 10 i.contentWindow.location.href = "?1"; 11 i.onload = t.step_func_done(() => { 12 assert_equals(i.contentWindow.navigation.entries().length, 2); 13 assert_equals(i.contentWindow.navigation.currentEntry.index, 1); 14 assert_not_equals(i.contentWindow.navigation.entries()[0].getState(), undefined); 15 assert_equals(i.contentWindow.navigation.entries()[0].getState().data, "value"); 16 }); 17 }); 18 }, "entry.getState() still works for a non-current cross-document entry"); 19 </script>