test_moduleNotFound.html (729B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test what happens when a top-level module is not found</title> 4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 5 <script> 6 var errorCount = 0; 7 var eventCount = 0; 8 9 SimpleTest.waitForExplicitFinish(); 10 11 window.onerror = function(_message, _url, _line, _column, _error) { 12 errorCount++; 13 } 14 15 // eslint-disable-next-line no-unused-vars 16 function testError() { 17 ok(eventCount == 1, 'Check that an error event was fired'); 18 ok(errorCount == 0, 'Check that no error was reported'); 19 SimpleTest.finish(); 20 } 21 </script> 22 <script type="module" src="./nonExistentModule.mjs" onerror="eventCount++"> 23 </script> 24 <body onload='testError()'></body>