instantiation-error-4.html (1149B)
1 <!DOCTYPE html> 2 <title>Handling of instantiation errors, 4</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 const test_load = async_test( 11 "Test that loading a graph in which a module is already " + 12 "errored results in an error."); 13 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, 4, 'Log length'); 21 assert_equals(log[1], 1); 22 assert_equals(log[3], 2); 23 assert_not_equals(log[0], log[2], 24 'Instantiation error objects for different root scripts'); 25 })); 26 27 function unreachable() { log.push("unexpected"); } 28 </script> 29 <script type="module" src="./instantiation-error-4a.js" 30 onerror="unreachable()" onload="log.push(1)"></script> 31 <script type="module" src="./instantiation-error-4d.js" 32 onerror="unreachable()" onload="log.push(2)"></script>