summaryrefslogtreecommitdiffstats
path: root/dom/base/test/jsmodules/test_import_errorMessage.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/test/jsmodules/test_import_errorMessage.html')
-rw-r--r--dom/base/test/jsmodules/test_import_errorMessage.html40
1 files changed, 19 insertions, 21 deletions
diff --git a/dom/base/test/jsmodules/test_import_errorMessage.html b/dom/base/test/jsmodules/test_import_errorMessage.html
index 6ab0b1dd74..2330b46dd9 100644
--- a/dom/base/test/jsmodules/test_import_errorMessage.html
+++ b/dom/base/test/jsmodules/test_import_errorMessage.html
@@ -8,40 +8,38 @@
let count = 0;
window.onerror = function (event, src, lineno, colno, error) {
- info("window.onerror :" + error.message);
+ info("window.onerror: message: " + error.message);
+ info("window.onerror: src: " + src);
ok(error instanceof SyntaxError, "Should be a SyntaxError.");
- // import_no_indirect_export.mjs and import_ambiguous_indirect_export.mjs
- // are related to indirect import/export.
- if (count < 2) {
- ok(error.message.match("indirect"), "Should contain 'indirect'");
- }
-
- // import_ambiguous_indirect_export.mjs and import_ambiguous.mjs both
- // have ambiguous import/export.
- if (count % 2 === 1) {
- ok(error.message.match("ambiguous"), "Should contain 'ambiguous'");
- }
-
- if (count === 2) {
- ok(!error.message.match("ambiguous") && !error.message.match("indirect"),
- "Should NOT contain 'indirect' nor 'ambiguous'");
+ if (src.match("no_indirect_export.mjs") ||
+ src.match("import_no_export.mjs")) {
+ ok(error.message.match("doesn't provide an export named"));
+ } else if(src.match("export_ambiguous.mjs") ||
+ src.match("import_ambiguous_export_star.mjs") ||
+ src.match("import_ambiguous_export.mjs") ||
+ src.match("import_ambiguous.mjs")) {
+ ok(error.message.match("contains ambiguous star export"));
+ } else if (src.match("import_circular_1.mjs")) {
+ ok(error.message.match("contains circular import"));
+ } else {
+ ok(false, "unknown src " + src);
}
count++;
};
function testLoaded() {
- ok(count === 4, "Should have 4 SynaxErrors thrown.");
+ ok(count === 7, "Should have 7 SynaxErrors thrown.");
SimpleTest.finish();
}
+
</script>
-<!--
-In window.onerror will test the error messages, so if the order is changed,
-the code in window.onerror should be updated as well.
--->
<script type="module" src="import_no_indirect_export.mjs"></script>
<script type="module" src="import_ambiguous_indirect_export.mjs"></script>
+<script type="module" src="import_ambiguous_export_star.mjs"></script>
+<script type="module" src="import_ambiguous_export.mjs"></script>
<script type="module" src="import_no_export.mjs"></script>
<script type="module" src="import_ambiguous.mjs"></script>
+<script type="module" src="import_circular.mjs"></script>
<body onload='testLoaded()'></body>