location-crossdocument-sameorigin.html (1193B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 5 <iframe id="i" src="/common/blank.html"></iframe> 6 7 <script> 8 async_test(t => { 9 i.contentWindow.navigation.onnavigate = t.step_func_done(e => { 10 assert_equals(e.navigationType, "push", "navigationType"); 11 assert_true(e.cancelable, "cancelable"); 12 assert_true(e.canIntercept, "canIntercept"); 13 assert_false(e.userInitiated, "userInitiated"); 14 assert_false(e.hashChange, "hashChange"); 15 assert_equals(e.formData, null, "formData"); 16 assert_equals(e.destination.url, i.src + "?foo", "destination.url"); 17 assert_false(e.destination.sameDocument, "destination.sameDocument"); 18 assert_equals(e.destination.key, "", "destination.key"); 19 assert_equals(e.destination.id, "", "destination.id"); 20 assert_equals(e.destination.index, -1, "destination.index"); 21 }); 22 23 navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window"); 24 window.onload = t.step_func(() => i.contentWindow.location.href = "/common/blank.html?foo"); 25 }, "using location.href to navigate cross-document targeting a same-origin window"); 26 </script>