compilation-error-2.html (1174B)
1 <!DOCTYPE html> 2 <title>Handling of compilation 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 13 const test_load = async_test( 14 "Test that syntax errors lead to SyntaxError events on window, " + 15 "and that exceptions are remembered."); 16 window.addEventListener("load", test_load.step_func_done(ev => { 17 assert_equals(log.length, 5); 18 assert_equals(log[0].constructor, SyntaxError); 19 assert_true(log.every(exn => exn === log[0])); 20 })); 21 22 function unreachable() { log.push("unexpected"); } 23 </script> 24 <script type="module" src="./syntaxerror-nested.js" onerror="unreachable()"></script> 25 <script type="module" src="./syntaxerror-nested.js" onerror="unreachable()"></script> 26 <script type="module" src="./syntaxerror.js" onerror="unreachable()"></script> 27 <script type="module" src="./syntaxerror-nested.js" onerror="unreachable()"></script> 28 <script type="module" src="./syntaxerror.js" onerror="unreachable()"></script>