intercept-handler-null-or-undefined.html (700B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 async_test(t => { 6 navigation.onnavigate = t.step_func_done(e => { 7 assert_throws_js(TypeError, () => e.intercept({ handler: null })); 8 }); 9 10 location.href = "#1"; 11 assert_equals(location.hash, "#1"); 12 }, "event.intercept() should throw if the handler is null"); 13 14 async_test(t => { 15 navigation.onnavigatesuccess = t.step_func_done(e => {}); 16 navigation.onnavigate = e => e.intercept({ handler: undefined }); 17 18 location.href = "#2"; 19 assert_equals(location.hash, "#2"); 20 }, "event.intercept() should not throw if the handler is explicit undefined"); 21 </script>