From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/base/test/jsmodules/chrome.toml | 12 ++++ dom/base/test/jsmodules/export_star_ambiguous.mjs | 1 + .../test/jsmodules/import_ambiguous_export.mjs | 1 + .../jsmodules/import_ambiguous_export_star.mjs | 1 + dom/base/test/jsmodules/import_circular.mjs | 1 + dom/base/test/jsmodules/import_circular_1.mjs | 1 + dom/base/test/jsmodules/import_no_export.mjs | 2 +- .../test/jsmodules/import_no_indirect_export.mjs | 2 +- .../test/jsmodules/importmaps/classic_script.js | 1 + dom/base/test/jsmodules/importmaps/mochitest.toml | 7 ++ .../test/jsmodules/importmaps/module_chain_1.mjs | 2 + .../test/jsmodules/importmaps/module_chain_2.mjs | 1 + .../module_importMap_with_nonexisting_module.mjs | 4 ++ .../test_dynamic_importMap_load_completes.html | 33 +++++++++ ...est_dynamic_importMap_with_external_script.html | 81 ++++++++++++++++++++++ .../test_importMap_with_nonexisting_module.html | 25 +++++++ dom/base/test/jsmodules/module_a.mjs | 2 + dom/base/test/jsmodules/module_b.mjs | 2 + dom/base/test/jsmodules/module_c.mjs | 3 + dom/base/test/jsmodules/module_d.mjs | 1 + dom/base/test/jsmodules/module_e.mjs | 1 + .../test/jsmodules/test_import_errorMessage.html | 40 +++++------ .../test/jsmodules/test_import_errorMessage2.html | 35 ++++++++++ 23 files changed, 236 insertions(+), 23 deletions(-) create mode 100644 dom/base/test/jsmodules/export_star_ambiguous.mjs create mode 100644 dom/base/test/jsmodules/import_ambiguous_export.mjs create mode 100644 dom/base/test/jsmodules/import_ambiguous_export_star.mjs create mode 100644 dom/base/test/jsmodules/import_circular.mjs create mode 100644 dom/base/test/jsmodules/import_circular_1.mjs create mode 100644 dom/base/test/jsmodules/importmaps/classic_script.js create mode 100644 dom/base/test/jsmodules/importmaps/module_chain_1.mjs create mode 100644 dom/base/test/jsmodules/importmaps/module_chain_2.mjs create mode 100644 dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs create mode 100644 dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html create mode 100644 dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html create mode 100644 dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html create mode 100644 dom/base/test/jsmodules/module_a.mjs create mode 100644 dom/base/test/jsmodules/module_b.mjs create mode 100644 dom/base/test/jsmodules/module_c.mjs create mode 100644 dom/base/test/jsmodules/module_d.mjs create mode 100644 dom/base/test/jsmodules/module_e.mjs create mode 100644 dom/base/test/jsmodules/test_import_errorMessage2.html (limited to 'dom/base/test/jsmodules') diff --git a/dom/base/test/jsmodules/chrome.toml b/dom/base/test/jsmodules/chrome.toml index 82d02ad4df..8b8a614bfb 100644 --- a/dom/base/test/jsmodules/chrome.toml +++ b/dom/base/test/jsmodules/chrome.toml @@ -3,11 +3,21 @@ support-files = [ "ambiguous_export.mjs", "import_ambiguous.mjs", "import_ambiguous_indirect_export.mjs", + "import_ambiguous_export.mjs", + "import_ambiguous_export_star.mjs", + "import_circular.mjs", + "import_circular_1.mjs", "import_no_export.mjs", "import_no_indirect_export.mjs", "exportA1.mjs", "exportA2.mjs", "export_ambiguous.mjs", + "export_star_ambiguous.mjs", + "module_a.mjs", + "module_b.mjs", + "module_c.mjs", + "module_d.mjs", + "module_e.mjs", "module_setRan.mjs", "module_testSyntax.mjs", "module_badSyntax.mjs", @@ -47,6 +57,8 @@ support-files = [ ["test_import_errorMessage.html"] +["test_import_errorMessage2.html"] + ["test_import_meta_resolve.html"] ["test_importedModuleMemoization.html"] diff --git a/dom/base/test/jsmodules/export_star_ambiguous.mjs b/dom/base/test/jsmodules/export_star_ambiguous.mjs new file mode 100644 index 0000000000..35cc979dee --- /dev/null +++ b/dom/base/test/jsmodules/export_star_ambiguous.mjs @@ -0,0 +1 @@ +export * from "./ambiguous_export.mjs"; diff --git a/dom/base/test/jsmodules/import_ambiguous_export.mjs b/dom/base/test/jsmodules/import_ambiguous_export.mjs new file mode 100644 index 0000000000..f5c12ff086 --- /dev/null +++ b/dom/base/test/jsmodules/import_ambiguous_export.mjs @@ -0,0 +1 @@ +import { a } from "./ambiguous_export.mjs"; diff --git a/dom/base/test/jsmodules/import_ambiguous_export_star.mjs b/dom/base/test/jsmodules/import_ambiguous_export_star.mjs new file mode 100644 index 0000000000..1ee2a56d37 --- /dev/null +++ b/dom/base/test/jsmodules/import_ambiguous_export_star.mjs @@ -0,0 +1 @@ +import { a } from "./export_star_ambiguous.mjs"; diff --git a/dom/base/test/jsmodules/import_circular.mjs b/dom/base/test/jsmodules/import_circular.mjs new file mode 100644 index 0000000000..bb3a46bd5e --- /dev/null +++ b/dom/base/test/jsmodules/import_circular.mjs @@ -0,0 +1 @@ +export { a } from "./import_circular_1.mjs"; diff --git a/dom/base/test/jsmodules/import_circular_1.mjs b/dom/base/test/jsmodules/import_circular_1.mjs new file mode 100644 index 0000000000..eb7c038c77 --- /dev/null +++ b/dom/base/test/jsmodules/import_circular_1.mjs @@ -0,0 +1 @@ +export { a } from "./import_circular.mjs"; diff --git a/dom/base/test/jsmodules/import_no_export.mjs b/dom/base/test/jsmodules/import_no_export.mjs index 47cabac557..d989498c88 100644 --- a/dom/base/test/jsmodules/import_no_export.mjs +++ b/dom/base/test/jsmodules/import_no_export.mjs @@ -1 +1 @@ -import x from "./no_export.mjs"; +import { x } from "./no_export.mjs"; diff --git a/dom/base/test/jsmodules/import_no_indirect_export.mjs b/dom/base/test/jsmodules/import_no_indirect_export.mjs index dd1ca847fc..bfcdcedbc5 100644 --- a/dom/base/test/jsmodules/import_no_indirect_export.mjs +++ b/dom/base/test/jsmodules/import_no_indirect_export.mjs @@ -1,2 +1,2 @@ /* eslint-disable import/default */ -import x from "./no_indirect_export.mjs"; +import { a } from "./no_indirect_export.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/classic_script.js b/dom/base/test/jsmodules/importmaps/classic_script.js new file mode 100644 index 0000000000..d7ae0be054 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/classic_script.js @@ -0,0 +1 @@ +// Empty script. diff --git a/dom/base/test/jsmodules/importmaps/mochitest.toml b/dom/base/test/jsmodules/importmaps/mochitest.toml index 4229455722..1f95b155ac 100644 --- a/dom/base/test/jsmodules/importmaps/mochitest.toml +++ b/dom/base/test/jsmodules/importmaps/mochitest.toml @@ -3,6 +3,9 @@ support-files = [ "bug_1865410_module_a.mjs", "bug_1865410_module_b.mjs", "bug_1873417.mjs", + "classic_script.js", + "module_chain_1.mjs", + "module_chain_2.mjs", "module_importMap_with_external_script_0.mjs", "module_importMap_with_external_script_1.mjs", "module_importMap_with_external_script_2.mjs", @@ -13,6 +16,7 @@ support-files = [ "module_importMap_with_external_script_6.mjs", "module_importMap_with_external_script_6.mjs^headers^", "module_importMap_with_external_script_7.mjs", + "module_importMap_with_nonexisting_module.mjs", "bad/module_2.mjs", "bad/module_3.mjs", "bad/module_4.mjs", @@ -31,3 +35,6 @@ support-files = [ ["test_bug_1873417.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"] diff --git a/dom/base/test/jsmodules/importmaps/module_chain_1.mjs b/dom/base/test/jsmodules/importmaps/module_chain_1.mjs new file mode 100644 index 0000000000..d9515fab7f --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_chain_1.mjs @@ -0,0 +1,2 @@ +// eslint-disable-next-line import/no-unassigned-import +import {} from "./module_chain_2.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/module_chain_2.mjs b/dom/base/test/jsmodules/importmaps/module_chain_2.mjs new file mode 100644 index 0000000000..ce12406a76 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_chain_2.mjs @@ -0,0 +1 @@ +loaded = true; diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs new file mode 100644 index 0000000000..4f9981bbe3 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs @@ -0,0 +1,4 @@ +/* eslint-disable import/no-unassigned-import, import/no-unresolved */ +// Bareword specifier should be mapped to ./good/module_0.mjs. +import {} from "bare"; +import * as test from "nonexistingmodule"; diff --git a/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html new file mode 100644 index 0000000000..da354c1ca0 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html @@ -0,0 +1,33 @@ + + + +Test script loading complets when there's a dynamicly inserted import map + + + + + + + + + + + + + + + + + diff --git a/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html new file mode 100644 index 0000000000..b78992fb87 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html @@ -0,0 +1,81 @@ + + + +Test speculative preload of external script doesn't conflict with import map + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html b/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html new file mode 100644 index 0000000000..57cfd5e5a1 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html @@ -0,0 +1,25 @@ + + +Test an import map with an nonexisting module specifier + + + + + + + + diff --git a/dom/base/test/jsmodules/module_a.mjs b/dom/base/test/jsmodules/module_a.mjs new file mode 100644 index 0000000000..0b0c3304ff --- /dev/null +++ b/dom/base/test/jsmodules/module_a.mjs @@ -0,0 +1,2 @@ +export var a = 1; +export var b = 2; diff --git a/dom/base/test/jsmodules/module_b.mjs b/dom/base/test/jsmodules/module_b.mjs new file mode 100644 index 0000000000..79da84736d --- /dev/null +++ b/dom/base/test/jsmodules/module_b.mjs @@ -0,0 +1,2 @@ +export var b = 3; +export var c = 4; diff --git a/dom/base/test/jsmodules/module_c.mjs b/dom/base/test/jsmodules/module_c.mjs new file mode 100644 index 0000000000..5a2a7e3e09 --- /dev/null +++ b/dom/base/test/jsmodules/module_c.mjs @@ -0,0 +1,3 @@ +/* eslint-disable import/export */ +export * from "./module_a.mjs"; +export * from "./module_b.mjs"; diff --git a/dom/base/test/jsmodules/module_d.mjs b/dom/base/test/jsmodules/module_d.mjs new file mode 100644 index 0000000000..04dc02d27a --- /dev/null +++ b/dom/base/test/jsmodules/module_d.mjs @@ -0,0 +1 @@ +import { a } from "./module_c.mjs"; diff --git a/dom/base/test/jsmodules/module_e.mjs b/dom/base/test/jsmodules/module_e.mjs new file mode 100644 index 0000000000..544c424fcb --- /dev/null +++ b/dom/base/test/jsmodules/module_e.mjs @@ -0,0 +1 @@ +import { b } from "./module_c.mjs"; 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(); } + - + + + diff --git a/dom/base/test/jsmodules/test_import_errorMessage2.html b/dom/base/test/jsmodules/test_import_errorMessage2.html new file mode 100644 index 0000000000..ed4227362e --- /dev/null +++ b/dom/base/test/jsmodules/test_import_errorMessage2.html @@ -0,0 +1,35 @@ + + +Test to get the filename of the requested module after it has been evaluated + + + + + + + + + -- cgit v1.2.3