navigate-form-with-target.html (1247B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="iframe" name="i" src="/common/blank.html"></iframe> 5 <form id="form" method="post" action="foo.html" target="i"></form> 6 <script> 7 async_test(t => { 8 window.onload = t.step_func(() => { 9 navigation.onnavigate = t.unreached_func("onnavigate should not have fired in source window"); 10 11 iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { 12 assert_equals(e.navigationType, "push"); 13 assert_true(e.cancelable); 14 assert_true(e.canIntercept); 15 assert_false(e.userInitiated); 16 assert_false(e.hashChange); 17 assert_equals(e.downloadRequest, null); 18 assert_equals(new URL(e.destination.url).pathname, 19 "/navigation-api/navigate-event/foo.html"); 20 assert_false(e.destination.sameDocument); 21 assert_equals(e.destination.key, ""); 22 assert_equals(e.destination.id, ""); 23 assert_equals(e.destination.index, -1); 24 assert_not_equals(e.formData, null); 25 assert_equals(e.sourceElement, form); 26 }); 27 form.submit(); 28 }); 29 }, "<form> submission with a target fires navigate event in target window but not source"); 30 </script>