diff options
Diffstat (limited to 'js/src/tests/non262/module')
-rw-r--r-- | js/src/tests/non262/module/await-restricted-nested.js | 6 | ||||
-rw-r--r-- | js/src/tests/non262/module/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1488117-empty.js | 3 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1488117-import-namespace.js | 3 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1488117.js | 14 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1689499-a.js | 5 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1689499-b.js | 6 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1689499-c.js | 8 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1689499-x.js | 3 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1689499.js | 23 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1693261-async.mjs | 7 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1693261-c1.mjs | 6 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1693261-c2.mjs | 6 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1693261-x.mjs | 6 | ||||
-rw-r--r-- | js/src/tests/non262/module/bug1693261.js | 33 | ||||
-rw-r--r-- | js/src/tests/non262/module/module-export-name-star.js | 12 | ||||
-rw-r--r-- | js/src/tests/non262/module/shell.js | 0 |
17 files changed, 141 insertions, 0 deletions
diff --git a/js/src/tests/non262/module/await-restricted-nested.js b/js/src/tests/non262/module/await-restricted-nested.js new file mode 100644 index 0000000000..277b3a3489 --- /dev/null +++ b/js/src/tests/non262/module/await-restricted-nested.js @@ -0,0 +1,6 @@ +// |reftest| error:SyntaxError module + +// 'await' is always a keyword when parsing modules. +function f() { + await; +} diff --git a/js/src/tests/non262/module/browser.js b/js/src/tests/non262/module/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/non262/module/browser.js diff --git a/js/src/tests/non262/module/bug1488117-empty.js b/js/src/tests/non262/module/bug1488117-empty.js new file mode 100644 index 0000000000..8972f99fc7 --- /dev/null +++ b/js/src/tests/non262/module/bug1488117-empty.js @@ -0,0 +1,3 @@ +// |reftest| skip -- support file + +// Intentionally left empty. diff --git a/js/src/tests/non262/module/bug1488117-import-namespace.js b/js/src/tests/non262/module/bug1488117-import-namespace.js new file mode 100644 index 0000000000..bfb2c68577 --- /dev/null +++ b/js/src/tests/non262/module/bug1488117-import-namespace.js @@ -0,0 +1,3 @@ +// |reftest| skip -- support file + +import* as ns from "./bug1488117.js"; diff --git a/js/src/tests/non262/module/bug1488117.js b/js/src/tests/non262/module/bug1488117.js new file mode 100644 index 0000000000..0ffe959545 --- /dev/null +++ b/js/src/tests/non262/module/bug1488117.js @@ -0,0 +1,14 @@ +// |reftest| module + +// Load and instantiate "bug1488117-import-namespace.js". "bug1488117-import-namespace.js" +// contains an |import*| request for the current module, which triggers GetModuleNamespace for +// this module. GetModuleNamespace calls GetExportedNames on the current module, which in turn +// resolves and calls GetExportedNames on all |export*| entries. +// And that means HostResolveImportedModule is called for "bug1488117-empty.js" before +// InnerModuleInstantiation for "bug1488117.js" has resolved that module file. + +import "./bug1488117-import-namespace.js"; +export* from "./bug1488117-empty.js"; + +if (typeof reportCompare === "function") + reportCompare(0, 0); diff --git a/js/src/tests/non262/module/bug1689499-a.js b/js/src/tests/non262/module/bug1689499-a.js new file mode 100644 index 0000000000..8607cf8b23 --- /dev/null +++ b/js/src/tests/non262/module/bug1689499-a.js @@ -0,0 +1,5 @@ +// |reftest| skip -- support file + +import B from "./bug1689499-b.js"; +import C from "./bug1689499-c.js"; +export default "A"; diff --git a/js/src/tests/non262/module/bug1689499-b.js b/js/src/tests/non262/module/bug1689499-b.js new file mode 100644 index 0000000000..7374e2d4ba --- /dev/null +++ b/js/src/tests/non262/module/bug1689499-b.js @@ -0,0 +1,6 @@ +// |reftest| skip -- support file + +import A from "./bug1689499-a.js"; +if (true) await 0; +export default "B"; + diff --git a/js/src/tests/non262/module/bug1689499-c.js b/js/src/tests/non262/module/bug1689499-c.js new file mode 100644 index 0000000000..f13d0fd30f --- /dev/null +++ b/js/src/tests/non262/module/bug1689499-c.js @@ -0,0 +1,8 @@ +// |reftest| skip -- support file + +import A from "./bug1689499-a.js"; +if (true) await 0; +export default "C"; +throw Error("FAIL"); + + diff --git a/js/src/tests/non262/module/bug1689499-x.js b/js/src/tests/non262/module/bug1689499-x.js new file mode 100644 index 0000000000..dba2f6dd1e --- /dev/null +++ b/js/src/tests/non262/module/bug1689499-x.js @@ -0,0 +1,3 @@ +// |reftest| skip -- support file +import B from "./bug1689499-b.js"; +export default "X"; diff --git a/js/src/tests/non262/module/bug1689499.js b/js/src/tests/non262/module/bug1689499.js new file mode 100644 index 0000000000..859cd6f64f --- /dev/null +++ b/js/src/tests/non262/module/bug1689499.js @@ -0,0 +1,23 @@ +// |reftest| skip-if(!xulRuntime.shell) module async -- needs drainJobQueue + +async function test() { + try { + await import("./bug1689499-a.js"); + throw new Error("import should have failed"); + } catch (exc) { + assertEq(exc.message, "FAIL"); + } + + try { + await import("./bug1689499-x.js"); + throw new Error("import should have failed"); + } catch (exc) { + assertEq(exc.message, "FAIL"); + } + + if (typeof reportCompare === "function") + reportCompare(0, 0); +} + +test(); +drainJobQueue(); diff --git a/js/src/tests/non262/module/bug1693261-async.mjs b/js/src/tests/non262/module/bug1693261-async.mjs new file mode 100644 index 0000000000..bc345e0b4c --- /dev/null +++ b/js/src/tests/non262/module/bug1693261-async.mjs @@ -0,0 +1,7 @@ +// |reftest| skip -- support file +if (globalThis.testArray === undefined) { + globalThis.testArray = []; +} +globalThis.testArray.push("async 1"); +await 0; +globalThis.testArray.push("async 2"); diff --git a/js/src/tests/non262/module/bug1693261-c1.mjs b/js/src/tests/non262/module/bug1693261-c1.mjs new file mode 100644 index 0000000000..31f42d027e --- /dev/null +++ b/js/src/tests/non262/module/bug1693261-c1.mjs @@ -0,0 +1,6 @@ +// |reftest| skip -- support file +import "./bug1693261-async.mjs"; +if (globalThis.testArray === undefined) { + globalThis.testArray = []; +} +globalThis.testArray.push("c1"); diff --git a/js/src/tests/non262/module/bug1693261-c2.mjs b/js/src/tests/non262/module/bug1693261-c2.mjs new file mode 100644 index 0000000000..e5ceb3079d --- /dev/null +++ b/js/src/tests/non262/module/bug1693261-c2.mjs @@ -0,0 +1,6 @@ +// |reftest| skip -- support file +import "./bug1693261-async.mjs"; +if (globalThis.testArray === undefined) { + globalThis.testArray = []; +} +globalThis.testArray.push("c2"); diff --git a/js/src/tests/non262/module/bug1693261-x.mjs b/js/src/tests/non262/module/bug1693261-x.mjs new file mode 100644 index 0000000000..4c73867e58 --- /dev/null +++ b/js/src/tests/non262/module/bug1693261-x.mjs @@ -0,0 +1,6 @@ +// |reftest| skip -- support file +import "./bug1693261-c1.mjs"; +if (globalThis.testArray === undefined) { + globalThis.testArray = []; +} +globalThis.testArray.push("x"); diff --git a/js/src/tests/non262/module/bug1693261.js b/js/src/tests/non262/module/bug1693261.js new file mode 100644 index 0000000000..c80a61c473 --- /dev/null +++ b/js/src/tests/non262/module/bug1693261.js @@ -0,0 +1,33 @@ +// |reftest| skip-if(!xulRuntime.shell) module async -- needs drainJobQueue + +import "./bug1693261-c1.mjs"; +import "./bug1693261-c2.mjs"; +import "./bug1693261-x.mjs"; +if (globalThis.testArray === undefined) { + globalThis.testArray = []; +} +globalThis.testArray.push("index"); + +function assertEqArray(actual, expected) { + if (actual.length != expected.length) { + throw new Error( + "array lengths not equal: got " + + JSON.stringify(actual) + ", expected " + JSON.stringify(expected)); + } + + for (var i = 0; i < actual.length; ++i) { + if (actual[i] != expected[i]) { + throw new Error( + "arrays not equal at element " + i + ": got " + + JSON.stringify(actual) + ", expected " + JSON.stringify(expected)); + } + } +} + +assertEqArray(globalThis.testArray, [ + 'async 1', 'async 2', 'c1', 'c2', 'x', 'index' +]) + +drainJobQueue(); +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/non262/module/module-export-name-star.js b/js/src/tests/non262/module/module-export-name-star.js new file mode 100644 index 0000000000..6b93ba12cc --- /dev/null +++ b/js/src/tests/non262/module/module-export-name-star.js @@ -0,0 +1,12 @@ +// |reftest| module + +var x = "ok"; + +export {x as "*"}; + +import {"*" as y} from "./module-export-name-star.js" + +assertEq(y, "ok"); + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/non262/module/shell.js b/js/src/tests/non262/module/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/non262/module/shell.js |