test_linkErrorInCommon2.html (934B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test handling of a link error in a common module</title> 4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 5 <script> 6 var runCount = 0; 7 var hadSyntaxError = false; 8 9 SimpleTest.waitForExplicitFinish(); 10 window.onerror = handleError; 11 12 function handleError(message, url, line, column, error) { 13 if (error instanceof SyntaxError) { 14 hadSyntaxError = true; 15 } 16 } 17 18 // eslint-disable-next-line no-unused-vars 19 function testError() { 20 ok(runCount == 0, 'Check no modules were executed'); 21 ok(hadSyntaxError, 'Check that an error was reported'); 22 SimpleTest.finish(); 23 } 24 </script> 25 <script type="module"> 26 import "./module_missingImport.mjs"; 27 /* global runCount */ 28 runCount++; 29 </script> 30 <script type="module"> 31 import "./module_missingImport.mjs"; 32 /* global runCount */ 33 runCount++; 34 </script> 35 <body onload='testError()'></body>