test_linkErrorInCommon1.html (1046B)
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 // eslint-disable-next-line no-unused-vars 27 import { missing } from "./module_simple1.mjs"; 28 /* global runCount */ 29 runCount++; 30 </script> 31 <script type="module"> 32 // eslint-disable-next-line no-unused-vars 33 import { missing } from "./module_simple1.mjs"; 34 /* global runCount */ 35 runCount++; 36 </script> 37 <body onload='testError()'></body>