evaluation-error-2.html (1313B)
1 <!DOCTYPE html> 2 <title>Handling of evaluation errors, 2</title> 3 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 setup({allow_uncaught_exception: true}); 8 9 window.log = []; 10 11 window.addEventListener("error", ev => log.push(ev.error)); 12 window.addEventListener("unhandledrejection", unreachable); 13 14 const test_load = async_test( 15 "Test that ill-founded cyclic dependencies cause ReferenceError " + 16 "during evaluation, which leads to error events on window, and that " + 17 "exceptions are remembered.\n"); 18 window.addEventListener("load", test_load.step_func_done(ev => { 19 const exn = log[1]; 20 assert_array_equals(log, 21 ["cycle-tdz-access-a", exn, "load", exn, "load", exn, "load"]); 22 assert_equals(exn.constructor, ReferenceError); 23 })); 24 25 function logLoad() { log.push("load"); } 26 27 function unreachable() { log.push("unexpected"); } 28 </script> 29 <script type="module" src="cycle-tdz-access.js" async onerror="unreachable()" 30 onload="logLoad()"></script> 31 <script type="module" src="cycle-tdz-access.js" nomodule onerror="unreachable()" 32 onload="logLoad()"></script> 33 <script type="module" src="cycle-tdz-access.js" onerror="unreachable()" 34 onload="logLoad()"></script>