navigate-history-back-cross-document.html (1371B)
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 let target_key = i.contentWindow.navigation.currentEntry.key; 9 let target_id = i.contentWindow.navigation.currentEntry.id; 10 i.contentWindow.navigation.navigate("?foo"); 11 i.onload = t.step_func(() => { 12 i.contentWindow.navigation.onnavigate = t.step_func_done(e => { 13 assert_equals(e.navigationType, "traverse"); 14 assert_false(e.cancelable); 15 assert_false(e.canIntercept); 16 assert_false(e.userInitiated); 17 assert_false(e.hashChange); 18 assert_equals(e.downloadRequest, null); 19 assert_equals(new URL(e.destination.url).pathname, "/common/blank.html"); 20 assert_false(e.destination.sameDocument); 21 assert_equals(e.destination.key, target_key); 22 assert_equals(e.destination.id, target_id); 23 assert_equals(e.destination.index, 0); 24 assert_equals(e.formData, null); 25 assert_equals(e.info, undefined); 26 assert_equals(e.sourceElement, null); 27 }); 28 assert_true(i.contentWindow.navigation.canGoBack); 29 i.contentWindow.history.back(); 30 }) 31 }); 32 }, "navigate event for history.back() - cross-document"); 33 </script>