forked from mirrors/gecko-dev
Bug 1778112 - Move dom/base/test/jsmodules/ to use mjs files, rather than defining sourceType for ESLint. r=allstarschh
Differential Revision: https://phabricator.services.mozilla.com/D183372
This commit is contained in:
parent
602952a200
commit
5eeac4e3f9
124 changed files with 269 additions and 231 deletions
|
|
@ -136,9 +136,10 @@ dom/serviceworkers/test/file_js_cache.js
|
|||
|
||||
# Intentional broken files
|
||||
dom/base/test/file_js_cache_syntax_error.js
|
||||
dom/base/test/jsmodules/test_scriptNotParsedAsModule.html
|
||||
dom/base/test/jsmodules/test_syntaxError.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorAsync.html
|
||||
dom/base/test/jsmodules/module_badSyntax.js
|
||||
dom/base/test/jsmodules/module_badSyntax.mjs
|
||||
dom/base/test/jsmodules/test_syntaxErrorInline.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html
|
||||
dom/base/test/test_bug687859.html
|
||||
|
|
|
|||
|
|
@ -1111,9 +1111,10 @@ dom/serviceworkers/test/file_js_cache.js
|
|||
|
||||
# Intentional broken files
|
||||
dom/base/test/file_js_cache_syntax_error.js
|
||||
dom/base/test/jsmodules/test_scriptNotParsedAsModule.html
|
||||
dom/base/test/jsmodules/test_syntaxError.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorAsync.html
|
||||
dom/base/test/jsmodules/module_badSyntax.js
|
||||
dom/base/test/jsmodules/module_badSyntax.mjs
|
||||
dom/base/test/jsmodules/test_syntaxErrorInline.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html
|
||||
dom/base/test/test_bug687859.html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
// eslint-plugin-html doesn't automatically detect module sections in
|
||||
// html files. Enable these as a module here. JavaScript files can use
|
||||
// the mjs extension.
|
||||
files: ["*.html"],
|
||||
parserOptions: {
|
||||
sourceType: "module",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
module_setRan.js
|
||||
module_testSyntax.js
|
||||
module_badSyntax.js
|
||||
module_simpleImport.js
|
||||
module_simpleExport.js
|
||||
module_badImport.js
|
||||
module_simple1.js
|
||||
module_simple2.js
|
||||
module_simple3.js
|
||||
module_cyclic1.js
|
||||
module_cyclic2.js
|
||||
module_cyclic3.js
|
||||
module_multiImports.js
|
||||
module_multiLargeImports.js
|
||||
module_setRan.mjs
|
||||
module_testSyntax.mjs
|
||||
module_badSyntax.mjs
|
||||
module_simpleImport.mjs
|
||||
module_simpleExport.mjs
|
||||
module_badImport.mjs
|
||||
module_simple1.mjs
|
||||
module_simple2.mjs
|
||||
module_simple3.mjs
|
||||
module_cyclic1.mjs
|
||||
module_cyclic2.mjs
|
||||
module_cyclic3.mjs
|
||||
module_multiImports.mjs
|
||||
module_multiLargeImports.mjs
|
||||
script_simple2.js
|
||||
module_large1.js
|
||||
module_large2.js
|
||||
module_large3.js
|
||||
module_extractIntroType.js
|
||||
module_large1.mjs
|
||||
module_large2.mjs
|
||||
module_large3.mjs
|
||||
module_extractIntroType.mjs
|
||||
iframe_extractIntroType.html
|
||||
module_missingImport.js
|
||||
module_missingImport.mjs
|
||||
|
||||
[test_moduleScriptsRun.html]
|
||||
[test_moduleParsedAsModule.html]
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
throw "Shouldn't load file bad/module_2.js";
|
||||
1
dom/base/test/jsmodules/importmaps/bad/module_2.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/bad/module_2.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
throw "Shouldn't load file bad/module_2.mjs";
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import {} from "../circular_depdendency.js";
|
||||
|
||||
export function exportedFunction() {
|
||||
throw "Wrong version of function called";
|
||||
}
|
||||
|
||||
throw "Shouldn't laod file bad/module_3.js";
|
||||
8
dom/base/test/jsmodules/importmaps/bad/module_3.mjs
Normal file
8
dom/base/test/jsmodules/importmaps/bad/module_3.mjs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
|
||||
import {} from "../circular_depdendency.mjs";
|
||||
|
||||
export function exportedFunction() {
|
||||
throw "Wrong version of function called";
|
||||
}
|
||||
|
||||
throw "Shouldn't laod file bad/module_3.mjs";
|
||||
|
|
@ -1 +0,0 @@
|
|||
throw "Shouldn't load file bad/module_4.js";
|
||||
1
dom/base/test/jsmodules/importmaps/bad/module_4.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/bad/module_4.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
throw "Shouldn't load file bad/module_4.mjs";
|
||||
|
|
@ -1 +0,0 @@
|
|||
throw "Shouldn't load file bad/module_7.js";
|
||||
1
dom/base/test/jsmodules/importmaps/bad/module_7.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/bad/module_7.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
throw "Shouldn't load file bad/module_7.mjs";
|
||||
|
|
@ -2,16 +2,16 @@
|
|||
support-files =
|
||||
external_importMap.js
|
||||
insert_a_base_element.js
|
||||
module_simpleImportMap.js
|
||||
module_simpleImportMap_dir.js
|
||||
module_simpleImportMap_remap.js
|
||||
module_simpleImportMap_remap_https.js
|
||||
module_simpleExport.js
|
||||
module_sortedImportMap.js
|
||||
scope1/module_simpleExport.js
|
||||
scope1/module_simpleImportMap.js
|
||||
scope1/scope2/module_simpleExport.js
|
||||
scope1/scope2/module_simpleImportMap.js
|
||||
module_simpleImportMap.mjs
|
||||
module_simpleImportMap_dir.mjs
|
||||
module_simpleImportMap_remap.mjs
|
||||
module_simpleImportMap_remap_https.mjs
|
||||
module_simpleExport.mjs
|
||||
module_sortedImportMap.mjs
|
||||
scope1/module_simpleExport.mjs
|
||||
scope1/module_simpleImportMap.mjs
|
||||
scope1/scope2/module_simpleExport.mjs
|
||||
scope1/scope2/module_simpleImportMap.mjs
|
||||
prefs =
|
||||
dom.importMaps.enabled=true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
// Should be remapped to good/module_3.js.
|
||||
import { exportedFunction } from "./bad/module_3.js";
|
||||
|
||||
if (exportedFunction()) {
|
||||
success("circular_dependency.js");
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// Should be remapped to good/module_3.mjs.
|
||||
import { exportedFunction } from "./bad/module_3.mjs";
|
||||
|
||||
if (exportedFunction()) {
|
||||
success("circular_dependency.mjs");
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
success("good/module_0.js");
|
||||
1
dom/base/test/jsmodules/importmaps/good/module_0.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/good/module_0.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
success("good/module_0.mjs");
|
||||
|
|
@ -1 +0,0 @@
|
|||
success("good/module_1.js");
|
||||
1
dom/base/test/jsmodules/importmaps/good/module_1.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/good/module_1.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
success("good/module_1.mjs");
|
||||
|
|
@ -1 +0,0 @@
|
|||
success("good/module_2.js");
|
||||
1
dom/base/test/jsmodules/importmaps/good/module_2.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/good/module_2.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
success("good/module_2.mjs");
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import {} from "../circular_dependency.js";
|
||||
|
||||
export function exportedFunction() {
|
||||
return true;
|
||||
}
|
||||
6
dom/base/test/jsmodules/importmaps/good/module_3.mjs
Normal file
6
dom/base/test/jsmodules/importmaps/good/module_3.mjs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import {} from "../circular_dependency.mjs";
|
||||
|
||||
export function exportedFunction() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
success("good/module_4.js");
|
||||
1
dom/base/test/jsmodules/importmaps/good/module_4.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/good/module_4.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
success("good/module_4.mjs");
|
||||
|
|
@ -1 +0,0 @@
|
|||
success("good/module_7.js");
|
||||
1
dom/base/test/jsmodules/importmaps/good/module_7.mjs
Normal file
1
dom/base/test/jsmodules/importmaps/good/module_7.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
success("good/module_7.mjs");
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
module_importMap_with_external_script_0.js
|
||||
module_importMap_with_external_script_1.js
|
||||
module_importMap_with_external_script_2.js
|
||||
module_importMap_with_external_script_3.js
|
||||
module_importMap_with_external_script_4.js
|
||||
module_importMap_with_external_script_5.js
|
||||
module_importMap_with_external_script_5.js^headers^
|
||||
module_importMap_with_external_script_6.js
|
||||
module_importMap_with_external_script_6.js^headers^
|
||||
module_importMap_with_external_script_7.js
|
||||
bad/module_2.js
|
||||
bad/module_3.js
|
||||
bad/module_4.js
|
||||
bad/module_7.js
|
||||
good/module_0.js
|
||||
good/module_1.js
|
||||
good/module_2.js
|
||||
good/module_3.js
|
||||
good/module_4.js
|
||||
good/module_7.js
|
||||
circular_dependency.js
|
||||
module_importMap_with_external_script_0.mjs
|
||||
module_importMap_with_external_script_1.mjs
|
||||
module_importMap_with_external_script_2.mjs
|
||||
module_importMap_with_external_script_3.mjs
|
||||
module_importMap_with_external_script_4.mjs
|
||||
module_importMap_with_external_script_5.mjs
|
||||
module_importMap_with_external_script_5.mjs^headers^
|
||||
module_importMap_with_external_script_6.mjs
|
||||
module_importMap_with_external_script_6.mjs^headers^
|
||||
module_importMap_with_external_script_7.mjs
|
||||
bad/module_2.mjs
|
||||
bad/module_3.mjs
|
||||
bad/module_4.mjs
|
||||
bad/module_7.mjs
|
||||
good/module_0.mjs
|
||||
good/module_1.mjs
|
||||
good/module_2.mjs
|
||||
good/module_3.mjs
|
||||
good/module_4.mjs
|
||||
good/module_7.mjs
|
||||
circular_dependency.mjs
|
||||
prefs =
|
||||
dom.importMaps.enabled=true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
// Bareword specifier should be mapped to ./good/module_0.js.
|
||||
import {} from "bare";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Bareword specifier should be mapped to ./good/module_0.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
|
||||
import {} from "bare";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Missing file ./bad/module_1.js should be mapped to ./good/module_1.js.
|
||||
import {} from "./bad/module_1.js";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Missing file ./bad/module_1.mjs should be mapped to ./good/module_1.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
|
||||
import {} from "./bad/module_1.mjs";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Existing file ./bad/module_2.js should be mapped to ./good/module_2.js.
|
||||
import {} from "./bad/module_2.js";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_2.mjs should be mapped to ./good/module_2.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import {} from "./bad/module_2.mjs";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Existing file ./bad/module_3.js should be mapped to ./good/module_3.js.
|
||||
import {} from "./bad/module_3.js";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import {} from "./bad/module_3.mjs";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Existing file ./bad/module_4.js should be mapped to ./good/module_4.js.
|
||||
import {} from "./bad/module_4.js";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_4.mjs should be mapped to ./good/module_4.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import {} from "./bad/module_4.mjs";
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
// Existing file ./bad/module_3.js should be mapped to ./good/module_3.js.
|
||||
//import {} from "./bad/module_3.js";
|
||||
throw "Error: script_5.js";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
HTTP 301 Moved Permanently
|
||||
Location: module_importMap_with_external_script_4.js
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
|
||||
//import {} from "./bad/module_3.mjs";
|
||||
throw "Error: script_5.mjs";
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
HTTP 301 Moved Permanently
|
||||
Location: module_importMap_with_external_script_4.mjs
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
// Existing file ./bad/module_3.js should be mapped to ./good/module_3.js.
|
||||
//import {} from "./bad/module_3.js";
|
||||
throw "Error: script_6.js";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
HTTP 301 Moved Permanently
|
||||
Location: module_importMap_with_external_script_5.js
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
|
||||
//import {} from "./bad/module_3.mjs";
|
||||
throw "Error: script_6.mjs";
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
HTTP 301 Moved Permanently
|
||||
Location: module_importMap_with_external_script_5.mjs
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Existing file ./bad/module_7.js should be mapped to ./good/module_4.js.
|
||||
import {} from "./bad/module_7.js";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Existing file ./bad/module_7.mjs should be mapped to ./good/module_4.mjs.
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import {} from "./bad/module_7.mjs";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "simple";
|
||||
result = x;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "simple";
|
||||
|
||||
result = x;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "dir/module_simpleExport.js";
|
||||
result_dir = x + 1;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "dir/module_simpleExport.mjs";
|
||||
|
||||
result_dir = x + 1;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "./module.js";
|
||||
result_remap = x + 2;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "./module.mjs";
|
||||
|
||||
result_remap = x + 2;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "https://example.com/module.js";
|
||||
result_remap_https = x + 3;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "https://example.com/module.mjs";
|
||||
|
||||
result_remap_https = x + 3;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import { x } from "scope1/scope2/module_simpleExport.js";
|
||||
import { x as y } from "scope1/scope2/scope3/scope4/module_simpleExport.js";
|
||||
sorted_result = x;
|
||||
sorted_result2 = y;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/* eslint-disable import/no-unresolved */
|
||||
import { x } from "scope1/scope2/module_simpleExport.mjs";
|
||||
import { x as y } from "scope1/scope2/scope3/scope4/module_simpleExport.mjs";
|
||||
|
||||
sorted_result = x;
|
||||
sorted_result2 = y;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "simple";
|
||||
result_scope1 = x;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "simple";
|
||||
|
||||
result_scope1 = x;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "simple";
|
||||
result_scope2 = x;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { x } from "simple";
|
||||
|
||||
result_scope2 = x;
|
||||
|
|
@ -9,17 +9,17 @@
|
|||
<!--There is a dynamic import before the import map tag, so the import map-->
|
||||
<!--cannot be accepted according to the spec.-->
|
||||
<!--And because the import map is rejected, so the module specifier-->
|
||||
<!--"./module_simpleExport.js" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.js".-->
|
||||
<!--"./module_simpleExport.mjs" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.mjs".-->
|
||||
|
||||
<script>
|
||||
import("./module_simpleExport.js");
|
||||
import("./module_simpleExport.mjs");
|
||||
</script>
|
||||
|
||||
<script type="importmap" onerror='importMapError()'>
|
||||
{
|
||||
"imports": {
|
||||
"./module_simpleExport.js": "./scope1/module_simpleExport.js"
|
||||
"./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
|
||||
function testLoaded() {
|
||||
import("./module_simpleExport.js").then((ns) => {
|
||||
import("./module_simpleExport.mjs").then((ns) => {
|
||||
ok(ns.x == 42, 'Check simple imported value result: ' + ns.x);
|
||||
ok(hasError, "onerror of the import map should be called.");
|
||||
}).catch((e) => {
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"bare": "./good/module_0.js",
|
||||
"./bad/module_1.js": "./good/module_1.js",
|
||||
"./bad/module_2.js": "./good/module_2.js",
|
||||
"./bad/module_3.js": "./good/module_3.js",
|
||||
"./bad/module_4.js": "./good/module_4.js",
|
||||
"./bad/module_7.js": "./good/module_7.js"
|
||||
"bare": "./good/module_0.mjs",
|
||||
"./bad/module_1.mjs": "./good/module_1.mjs",
|
||||
"./bad/module_2.mjs": "./good/module_2.mjs",
|
||||
"./bad/module_3.mjs": "./good/module_3.mjs",
|
||||
"./bad/module_4.mjs": "./good/module_4.mjs",
|
||||
"./bad/module_7.mjs": "./good/module_7.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -27,36 +27,36 @@
|
|||
<!--
|
||||
Test bareword import (not supported before import map installed).
|
||||
-->
|
||||
<script type="module" src="module_importMap_with_external_script_0.js"></script>
|
||||
<script type="module" src="module_importMap_with_external_script_0.mjs"></script>
|
||||
|
||||
<!--
|
||||
Test mapping from missing resource to existing resource (not found before
|
||||
import map installed).
|
||||
-->
|
||||
<script type="module" src="module_importMap_with_external_script_1.js"></script>
|
||||
<script type="module" src="module_importMap_with_external_script_1.mjs"></script>
|
||||
|
||||
<!--
|
||||
Test mapping from one existing resource to another (would load wrong resource before
|
||||
import map installed).
|
||||
-->
|
||||
<script type="module" src="module_importMap_with_external_script_2.js"></script>
|
||||
<script type="module" src="module_importMap_with_external_script_2.mjs"></script>
|
||||
|
||||
<!--
|
||||
Test mapping from one existing resource to another with circular dependency.
|
||||
-->
|
||||
<script type="module" src="module_importMap_with_external_script_3.js"></script>
|
||||
<script type="module" src="module_importMap_with_external_script_3.mjs"></script>
|
||||
|
||||
<!--
|
||||
Test with redirect, script_6.js -> script_5.js -> script_4.js.
|
||||
Test with redirect, script_6.mjs -> script_5.mjs -> script_4.mjs.
|
||||
We redirect twice here, as sometimes one redirect can't reproduce the crash
|
||||
from bug 1835468.
|
||||
-->
|
||||
<script type="module" src="module_importMap_with_external_script_6.js"></script>
|
||||
<script type="module" src="module_importMap_with_external_script_6.mjs"></script>
|
||||
|
||||
<!--
|
||||
Test with async attribute
|
||||
-->
|
||||
<script type="module" async src="module_importMap_with_external_script_7.js"></script>
|
||||
<script type="module" async src="module_importMap_with_external_script_7.mjs"></script>
|
||||
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"simple": "./module_simpleExport.js"
|
||||
"simple": "./module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<script type="module">
|
||||
ok(import.meta.resolve("simple") ==
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.js",
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs",
|
||||
"calling import.meta.resolve with a specifier from import map.");
|
||||
wasRun = true;
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ console.registerListener(listener);
|
|||
<!--There is an inline module before the import map tag, so the import map-->
|
||||
<!--cannot be accepted according to the spec.-->
|
||||
<!--And because the import map is rejected, so the module specifier-->
|
||||
<!--"./module_simpleExport.js" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.js".-->
|
||||
<!--"./module_simpleExport.mjs" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.mjs".-->
|
||||
|
||||
<script type="module">
|
||||
</script>
|
||||
|
|
@ -33,7 +33,7 @@ console.registerListener(listener);
|
|||
<script type="importmap" onerror='importMapError()'>
|
||||
{
|
||||
"imports": {
|
||||
"./module_simpleExport.js": "./scope1/module_simpleExport.js"
|
||||
"./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -47,7 +47,7 @@ console.registerListener(listener);
|
|||
}
|
||||
|
||||
function testLoaded() {
|
||||
import("./module_simpleExport.js").then((ns) => {
|
||||
import("./module_simpleExport.mjs").then((ns) => {
|
||||
ok(ns.x == 42, 'Check simple imported value result: ' + ns.x);
|
||||
ok(hasError, "onerror of the import map should be called.");
|
||||
ok(gotMsg, "Should have got the console warning.");
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<base href="chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/">
|
||||
|
||||
<!--
|
||||
With the <base> element, the correct "module_simpleExport.js" should be mapped
|
||||
to "scope1/module_simpleExport.js", instead of "./module_simpleExport.js".
|
||||
With the <base> element, the correct "module_simpleExport.mjs" should be mapped
|
||||
to "scope1/module_simpleExport.mjs", instead of "./module_simpleExport.mjs".
|
||||
-->
|
||||
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"simple": "./module_simpleExport.js"
|
||||
"simple": "./module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -28,7 +28,7 @@ to "scope1/module_simpleExport.js", instead of "./module_simpleExport.js".
|
|||
result2 = x;
|
||||
</script>
|
||||
|
||||
<script type="module" src="module_simpleImportMap.js"></script>
|
||||
<script type="module" src="module_simpleImportMap.mjs"></script>
|
||||
|
||||
<script>
|
||||
var result_scope1, result2;
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<script src="insert_a_base_element.js"></script>
|
||||
|
||||
<!--
|
||||
With the <base> element, the correct "module_simpleExport.js" should be mapped
|
||||
to "scope1/module_simpleExport.js", instead of "./module_simpleExport.js".
|
||||
With the <base> element, the correct "module_simpleExport.mjs" should be mapped
|
||||
to "scope1/module_simpleExport.mjs", instead of "./module_simpleExport.mjs".
|
||||
-->
|
||||
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"simple": "./module_simpleExport.js"
|
||||
"simple": "./module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -28,7 +28,7 @@ to "scope1/module_simpleExport.js", instead of "./module_simpleExport.js".
|
|||
result2 = x;
|
||||
</script>
|
||||
|
||||
<script type="module" src="module_simpleImportMap.js"></script>
|
||||
<script type="module" src="module_simpleImportMap.mjs"></script>
|
||||
|
||||
<script>
|
||||
var result_scope1, result2;
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
<!--There is a module load before the import map tag, so the import map cannot-->
|
||||
<!--be accepted according to the spec.-->
|
||||
<!--And because the import map is rejected, so the module specifier-->
|
||||
<!--"./module_simpleExport.js" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.js".-->
|
||||
<!--"./module_simpleExport.mjs" won't be remapped to-->
|
||||
<!--"./scope1/module_simpleExport.mjs".-->
|
||||
|
||||
<script src="./module_simpleExport.js" type="module">
|
||||
<script src="./module_simpleExport.mjs" type="module">
|
||||
</script>
|
||||
|
||||
<script type="importmap" onerror='importMapError()'>
|
||||
{
|
||||
"imports": {
|
||||
"./module_simpleExport.js": "./scope1/module_simpleExport.js"
|
||||
"./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
|
||||
function testLoaded() {
|
||||
import("./module_simpleExport.js").then((ns) => {
|
||||
import("./module_simpleExport.mjs").then((ns) => {
|
||||
ok(ns.x == 42, 'Check simple imported value result: ' + ns.x);
|
||||
ok(hasError, "onerror of the import map should be called.");
|
||||
}).catch((e) => {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ console.registerListener(listener);
|
|||
<script type="importmap" onerror='importMapError1()'>
|
||||
{
|
||||
"imports": {
|
||||
"./module_simpleExport.js": "./scope1/module_simpleExport.js"
|
||||
"./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -33,7 +33,7 @@ console.registerListener(listener);
|
|||
<script type="importmap" onerror='importMapError2()'>
|
||||
{
|
||||
"imports": {
|
||||
"./module_simpleExport.js": "./scope1/module_simpleExport.js"
|
||||
"./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -50,7 +50,7 @@ console.registerListener(listener);
|
|||
}
|
||||
|
||||
function testLoaded() {
|
||||
import("./module_simpleExport.js").then((ns) => {
|
||||
import("./module_simpleExport.mjs").then((ns) => {
|
||||
ok(ns.x == 84, 'Check simple imported value result: ' + ns.x);
|
||||
ok(hasError, "onerror of the import map should be called.");
|
||||
ok(gotMsg, "Should have got the console warning.");
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"simple": "./module_simpleExport.js",
|
||||
"simple": "./module_simpleExport.mjs",
|
||||
"dir/": "/content/chrome/dom/base/test/jsmodules/importmaps/",
|
||||
"./module.js": "/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.js",
|
||||
"https://example.com/module.js": "./module_simpleExport.js"
|
||||
"./module.mjs": "/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs",
|
||||
"https://example.com/module.mjs": "./module_simpleExport.mjs"
|
||||
},
|
||||
"scopes": {
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/": {
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.js"
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.mjs"
|
||||
},
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/": {
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.js"
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,24 +39,24 @@
|
|||
|
||||
import("simple").then((ns) => {
|
||||
ok(ns.x == 42, 'Check simple imported value result: ' + ns.x);
|
||||
return import("dir/module_simpleExport.js");
|
||||
return import("dir/module_simpleExport.mjs");
|
||||
}).then((ns) => {
|
||||
ok(ns.x == 42, 'Check dir imported value result: ' + ns.x);
|
||||
return import("./module.js");
|
||||
return import("./module.mjs");
|
||||
}).then((ns) => {
|
||||
ok(ns.x == 42, 'Check remap imported value result: ' + ns.x);
|
||||
return import("https://example.com/module.js");
|
||||
return import("https://example.com/module.mjs");
|
||||
}).then((ns) => {
|
||||
ok(ns.x == 42, 'Check remap https imported value result: ' + ns.x);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="module_simpleImportMap.js"></script>
|
||||
<script type="module" src="module_simpleImportMap_dir.js"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap.js"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap_https.js"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap_https.js"></script>
|
||||
<script type="module" src="scope1/module_simpleImportMap.js"></script>
|
||||
<script type="module" src="scope1/scope2/module_simpleImportMap.js"></script>
|
||||
<script type="module" src="module_simpleImportMap.mjs"></script>
|
||||
<script type="module" src="module_simpleImportMap_dir.mjs"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap.mjs"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap_https.mjs"></script>
|
||||
<script type="module" src="module_simpleImportMap_remap_https.mjs"></script>
|
||||
<script type="module" src="scope1/module_simpleImportMap.mjs"></script>
|
||||
<script type="module" src="scope1/scope2/module_simpleImportMap.mjs"></script>
|
||||
<body onload='testLoaded()'></body>
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ https://html.spec.whatwg.org/multipage/webappapis.html#sorting-and-normalizing-s
|
|||
},
|
||||
"scopes": {
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/": {
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.js"
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.mjs"
|
||||
},
|
||||
"chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/": {
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.js"
|
||||
"simple": "/content/chrome/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.mjs"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -57,6 +57,6 @@ https://html.spec.whatwg.org/multipage/webappapis.html#sorting-and-normalizing-s
|
|||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="module_sortedImportMap.js"></script>
|
||||
<script type="module" src="scope1/scope2/module_simpleImportMap.js"></script>
|
||||
<script type="module" src="module_sortedImportMap.mjs"></script>
|
||||
<script type="module" src="scope1/scope2/module_simpleImportMap.mjs"></script>
|
||||
<body onload='testLoaded()'></body>
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
import "invalid specifier";
|
||||
2
dom/base/test/jsmodules/module_badImport.mjs
Normal file
2
dom/base/test/jsmodules/module_badImport.mjs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/* eslint-disable import/no-unassigned-import, import/no-unresolved */
|
||||
import "invalid specifier";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { func2 } from "./module_cyclic2.js";
|
||||
import { func2 } from "./module_cyclic2.mjs";
|
||||
|
||||
export function func1(x, y) {
|
||||
if (x <= 0) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { func3 } from "./module_cyclic3.js";
|
||||
import { func3 } from "./module_cyclic3.mjs";
|
||||
|
||||
export function func2(x, y) {
|
||||
if (x <= 0) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { func1 } from "./module_cyclic1.js";
|
||||
import { func1 } from "./module_cyclic1.mjs";
|
||||
|
||||
export function func3(x, y) {
|
||||
if (x <= 0) {
|
||||
|
|
@ -1 +0,0 @@
|
|||
import { missing } from "./module_simple1.js";
|
||||
1
dom/base/test/jsmodules/module_missingImport.mjs
Normal file
1
dom/base/test/jsmodules/module_missingImport.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
import { missing } from "./module_simple1.mjs";
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import "./module_simple1.js";
|
||||
import "./module_simple2.js";
|
||||
import "./module_simple3.js";
|
||||
results.push(4);
|
||||
6
dom/base/test/jsmodules/module_multiImports.mjs
Normal file
6
dom/base/test/jsmodules/module_multiImports.mjs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* eslint-disable import/no-unassigned-import */
|
||||
import "./module_simple1.mjs";
|
||||
import "./module_simple2.mjs";
|
||||
import "./module_simple3.mjs";
|
||||
|
||||
results.push(4);
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import "./module_large1.js";
|
||||
import "./module_large2.js";
|
||||
import "./module_large3.js";
|
||||
results.push(4);
|
||||
6
dom/base/test/jsmodules/module_multiLargeImports.mjs
Normal file
6
dom/base/test/jsmodules/module_multiLargeImports.mjs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* eslint-disable import/no-unassigned-import */
|
||||
import "./module_large1.mjs";
|
||||
import "./module_large2.mjs";
|
||||
import "./module_large3.mjs";
|
||||
|
||||
results.push(4);
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import { x } from "./module_simpleExport.js";
|
||||
result = x;
|
||||
3
dom/base/test/jsmodules/module_simpleImport.mjs
Normal file
3
dom/base/test/jsmodules/module_simpleImport.mjs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { x } from "./module_simpleExport.mjs";
|
||||
|
||||
result = x;
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
results.push(1);
|
||||
</script>
|
||||
<script type="module" async>
|
||||
import "./module_simple2.js";
|
||||
import "./module_simple2.mjs";
|
||||
</script>
|
||||
<script type="module" async>
|
||||
results.push(3);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue