2016-05-07 14:46:39 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<meta charset=utf-8>
|
|
|
|
<title>Test syntax errors parsing a module are reported</title>
|
2019-04-15 23:56:58 +03:00
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
2016-05-07 14:46:39 +03:00
|
|
|
<script>
|
|
|
|
var wasRun = false;
|
2017-08-22 12:43:27 +03:00
|
|
|
var errorCount = 0;
|
|
|
|
var syntaxErrorCount = 0;
|
|
|
|
var eventCount = 0;
|
2016-05-07 14:46:39 +03:00
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
window.onerror = handleError;
|
|
|
|
|
|
|
|
function handleError(message, url, line, column, error) {
|
2017-08-22 12:43:27 +03:00
|
|
|
errorCount++;
|
|
|
|
if (error instanceof SyntaxError) {
|
|
|
|
syntaxErrorCount++;
|
|
|
|
}
|
2016-05-07 14:46:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function testError() {
|
|
|
|
ok(!wasRun, 'Check script was not run');
|
2017-08-22 12:43:27 +03:00
|
|
|
ok(errorCount == 1, 'Check that an error was reported');
|
|
|
|
ok(syntaxErrorCount == 1, 'Check that a syntax error was reported');
|
|
|
|
ok(eventCount == 0, 'Check that no error event was fired');
|
2016-05-07 14:46:39 +03:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
</script>
|
2017-08-22 12:43:27 +03:00
|
|
|
<script type="module" src="module_badSyntax.js" onerror="eventCount++"></script>
|
2016-05-07 14:46:39 +03:00
|
|
|
<body onload='testError()'></body>
|