instantiation-error-6.html (1367B)
1 <!DOCTYPE html> 2 <title>Handling of instantiation errors, 6</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 ambiguous star exports lead to an instantiation error " + 15 "and that the correct module is blamed."); 16 // Concretely, instantiation-error-6a.js fails to instantiate because it 17 // requests a name from instantion-error-6b.js that is ambiguous there. 18 // instantiation-error-6b.js itself, however, is fine, and it instantiates 19 // and evaluates successfully. 20 window.addEventListener("load", test_load.step_func_done(ev => { 21 const exn = log[0]; 22 assert_array_equals(log, [ 23 exn, 1, 24 "instantiation-error-6c", 25 "instantiation-error-6d", 26 "instantiation-error-6b", 2 27 ]); 28 assert_equals(exn.constructor, SyntaxError); 29 })); 30 31 function unreachable() { log.push("unexpected"); } 32 </script> 33 <script type="module" src="./instantiation-error-6a.js" 34 onerror="unreachable()" onload="log.push(1)"></script> 35 <script type="module" src="./instantiation-error-6b.js" 36 onerror="unreachable()" onload="log.push(2)"></script>