diff options
Diffstat (limited to 'dom/base/test/jsmodules')
10 files changed, 79 insertions, 0 deletions
diff --git a/dom/base/test/jsmodules/importmaps/bug_1893164_module_1.mjs b/dom/base/test/jsmodules/importmaps/bug_1893164_module_1.mjs new file mode 100644 index 0000000000..45894ce609 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1893164_module_1.mjs @@ -0,0 +1,3 @@ +/* eslint-disable import/no-named-default, import/no-unresolved */ +import { default as default_non } from "./non_existing.mjs"; +import { default as default_3 } from "./bug_1893164_module_3.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/bug_1893164_module_2.mjs b/dom/base/test/jsmodules/importmaps/bug_1893164_module_2.mjs new file mode 100644 index 0000000000..e6f5e9f9f0 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1893164_module_2.mjs @@ -0,0 +1,5 @@ +/* eslint-disable import/no-named-default */ +import { default as default_3 } from "./bug_1893164_module_3.mjs"; + +module2_loaded = true; +result = default_3; diff --git a/dom/base/test/jsmodules/importmaps/bug_1893164_module_3.mjs b/dom/base/test/jsmodules/importmaps/bug_1893164_module_3.mjs new file mode 100644 index 0000000000..dbb41f0e1f --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1893164_module_3.mjs @@ -0,0 +1 @@ +export default 3; diff --git a/dom/base/test/jsmodules/importmaps/bug_1894631_module_1.mjs b/dom/base/test/jsmodules/importmaps/bug_1894631_module_1.mjs new file mode 100644 index 0000000000..b0c91fe0cf --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1894631_module_1.mjs @@ -0,0 +1,5 @@ +/* eslint-disable import/no-named-default, import/no-unresolved, import/named */ +import { default as default_2 } from "./bug_1894631_module_2.mjs"; +import { default as default_non } from "./non_existing.mjs"; + +module1_loaded = true; diff --git a/dom/base/test/jsmodules/importmaps/bug_1894631_module_2.mjs b/dom/base/test/jsmodules/importmaps/bug_1894631_module_2.mjs new file mode 100644 index 0000000000..dd17da2abc --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1894631_module_2.mjs @@ -0,0 +1,3 @@ +/* eslint-disable import/no-named-default */ +import { default as default_3 } from "./bug_1894631_module_3.mjs"; +import { default as default_4 } from "./bug_1894631_module_4.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/bug_1894631_module_3.mjs b/dom/base/test/jsmodules/importmaps/bug_1894631_module_3.mjs new file mode 100644 index 0000000000..dbb41f0e1f --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1894631_module_3.mjs @@ -0,0 +1 @@ +export default 3; diff --git a/dom/base/test/jsmodules/importmaps/bug_1894631_module_4.mjs b/dom/base/test/jsmodules/importmaps/bug_1894631_module_4.mjs new file mode 100644 index 0000000000..456ffaafac --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/bug_1894631_module_4.mjs @@ -0,0 +1 @@ +export default 4; diff --git a/dom/base/test/jsmodules/importmaps/mochitest.toml b/dom/base/test/jsmodules/importmaps/mochitest.toml index 1f95b155ac..b71bf21def 100644 --- a/dom/base/test/jsmodules/importmaps/mochitest.toml +++ b/dom/base/test/jsmodules/importmaps/mochitest.toml @@ -3,6 +3,13 @@ support-files = [ "bug_1865410_module_a.mjs", "bug_1865410_module_b.mjs", "bug_1873417.mjs", + "bug_1893164_module_1.mjs", + "bug_1893164_module_2.mjs", + "bug_1893164_module_3.mjs", + "bug_1894631_module_1.mjs", + "bug_1894631_module_2.mjs", + "bug_1894631_module_3.mjs", + "bug_1894631_module_4.mjs", "classic_script.js", "module_chain_1.mjs", "module_chain_2.mjs", @@ -34,7 +41,10 @@ support-files = [ ["test_bug_1873417.html"] +["test_bug_1893164.html"] + ["test_importMap_with_external_script.html"] ["test_importMap_with_nonexisting_module.html"] ["test_dynamic_importMap_with_external_script.html"] ["test_dynamic_importMap_load_completes.html"] +["test_shared_submodules_with_modulepreload.html"] diff --git a/dom/base/test/jsmodules/importmaps/test_bug_1893164.html b/dom/base/test/jsmodules/importmaps/test_bug_1893164.html new file mode 100644 index 0000000000..6c5306b815 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_bug_1893164.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Test module cancel</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script> + var module2_loaded = false, result; + + SimpleTest.waitForExplicitFinish(); + + function testLoaded() { + ok(module2_loaded, 'module_2.mjs should be loaded'); + ok(result == 3, "result should be 3 from module_3.mjs"); + SimpleTest.finish(); + } +</script> + +<script src="./bug_1893164_module_1.mjs" type="module"></script> +<script src="./bug_1893164_module_2.mjs" type="module"></script> + +<body onload='testLoaded()'></body> diff --git a/dom/base/test/jsmodules/importmaps/test_shared_submodules_with_modulepreload.html b/dom/base/test/jsmodules/importmaps/test_shared_submodules_with_modulepreload.html new file mode 100644 index 0000000000..a99582f8d3 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_shared_submodules_with_modulepreload.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Test module cancel won't trigger an assert</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="modulepreload" href="./bug_1894631_module_2.mjs" /> +<link rel="modulepreload" href="./bug_1894631_module_3.mjs" /> +<link rel="modulepreload" href="./non_existing.mjs" /> + +<script src="./bug_1894631_module_1.mjs" type="module" id="module_1"></script> +<script> + var module1_loaded = false; + var module1_error = false; + + SimpleTest.waitForExplicitFinish(); + + const module1 = document.getElementById("module_1"); + module1.addEventListener("error", (event) => { + info("error event"); + module1_error = true; + }); + + function testLoaded() { + ok(module1_error, "module_1.mjs should fire an error event"); + ok(!module1_loaded, "module_1.mjs should not be loaded"); + SimpleTest.finish(); + } +</script> + +<body onload='testLoaded()'> +</body> |