intercept-cross-document-same-origin.html (735B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/get-host-info.sub.js"></script> 5 <script> 6 async_test(t => { 7 let target_url = location.href + "?1"; 8 navigation.onnavigate = t.step_func_done(e => { 9 assert_true(e.cancelable); 10 assert_true(e.canIntercept); 11 assert_false(e.userInitiated); 12 assert_false(e.hashChange); 13 e.intercept({ handler: async () => { 14 await Promise.resolve(); 15 t.step_func_done(() => assert_equals(location.href, target_url)); 16 }}); 17 }); 18 19 window.onload = t.step_func(() => location.href = target_url); 20 }, "event.intercept() intercepts a same-origin cross-document navigation"); 21 </script>