instantiation-error-3.html (1405B)
1 <!DOCTYPE html> 2 <title>Handling of instantiation errors, 3</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 const test_load = async_test( 10 "Test that unresolvable cycles lead to SyntaxError events on window " + 11 "and load events on script"); 12 13 window.log = []; 14 window.addEventListener("error", ev => { 15 test_load.step(() => assert_equals(ev.error.constructor, SyntaxError)); 16 log.push(ev.message); 17 }); 18 19 window.addEventListener("load", test_load.step_func_done(ev => { 20 assert_equals(log.length, 6, 'Log length'); 21 assert_equals(log[1], 1); 22 assert_equals(log[3], 2); 23 assert_equals(log[5], 3); 24 assert_not_equals(log[0], log[2], 25 'Instantiation error objects for different root scripts'); 26 assert_equals(log[0], log[4], 27 'Instantiation error objects for the same root script'); 28 })); 29 30 function unreachable() { log.push("unexpected"); } 31 </script> 32 <script type="module" src="./cycle-unresolvable.js" 33 onerror="unreachable()" onload="log.push(1)" nomodule></script> 34 <script type="module" src="./cycle-unresolvable-a.js" 35 onerror="unreachable()" onload="log.push(2)"></script> 36 <script type="module" src="./cycle-unresolvable.js" 37 onerror="unreachable()" onload="log.push(3)"></script>