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