test_import_errorMessage2.html (1080B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test to get the filename of the requested module after it has been evaluated</title> 4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 5 <script> 6 SimpleTest.waitForExplicitFinish(); 7 8 let count = 0; 9 10 window.onerror = function (event, src, lineno, colno, error) { 11 info("window.onerror: message: " + error.message); 12 info("window.onerror: src: " + src); 13 ok(error instanceof SyntaxError, "Should be a SyntaxError."); 14 15 if (src.match("module_e.mjs")) { 16 ok(error.message.match("contains ambiguous star export")); 17 } else { 18 ok(false, "unknown src " + src); 19 } 20 count++; 21 }; 22 23 // eslint-disable-next-line no-unused-vars 24 function testLoaded() { 25 ok(count === 1, "Should have 1 SynaxError thrown."); 26 SimpleTest.finish(); 27 } 28 29 </script> 30 31 <!--module_c.mjs will be evaluated here--> 32 <script type="module" src="module_d.mjs"></script> 33 34 <!--module_c.mjs will be linked again here--> 35 <script type="module" src="module_e.mjs"></script> 36 <body onload='testLoaded()'></body>