diff --git a/source b/source
index 234caa8a2f8..79148642b9a 100644
--- a/source
+++ b/source
@@ -91374,14 +91374,12 @@ document.querySelector("button").addEventListener("click", bound);
we only asked for "type" assertions in
HostGetSupportedImportAssertions.
If moduleRequest.[[Assertions]] has a Record entry
- such that entry.[[Key]] is "type", then let module
- type be entry.[[Value]]. Otherwise let module type be "javascript".
Let moduleType be the result of running the module type from module + request steps given moduleRequest.
If the result of running the module type allowed steps given module - type and settings object is false, then asynchronously complete this algorithm - with null, and return.
If the result of running the module type allowed steps given + moduleType and settings object is false, then asynchronously complete this + algorithm with null, and return.
Fetch a single module script given url, settings
object, "script", options, settings object,
@@ -91393,7 +91391,7 @@ document.querySelector("button").addEventListener("click", bound);
If result is null, asynchronously complete this algorithm with null, and return.
Let visited set be « (url, module type) ».
Let visited set be « (url, moduleType) ».
Fetch the descendants of and link result given settings object, @@ -91741,20 +91739,18 @@ document.querySelector("button").addEventListener("click", bound); href="#validate-requested-module-specifiers">previously successful with these same two arguments.
If requested.[[Assertions]] has a Record entry such
- that entry.[[Key]] is "type", then let module type
- be entry.[[Value]]. Otherwise let module type be "javascript".
Let moduleType be the result of running the module type from module + request steps given requested.
If visited set does not contain - (url, module type), then:
+ (url, moduleType), then:Append requested to moduleRequests.
Append (url, module type) to +
Append (url, moduleType) to visited set.
If moduleRequest.[[Assertions]] has a Record entry
- such that entry.[[Key]] is "type", then let module
- type be entry.[[Value]]. Otherwise let module type be "javascript".
Let moduleType be the result of running the module type from module + request steps given moduleRequest.
Assert: visited set contains - (url, module type).
Fetch a single module script given url, fetch client settings object, destination, options, module map settings object, @@ -91844,23 +91838,15 @@ document.querySelector("button").addEventListener("click", bound); complete with either null (on failure) or a module script (on success).
Let module type be "javascript".
Let moduleType be "javascript".
If moduleRequest was given and moduleRequest.[[Assertions]] has a
- Record entry such that entry.[[Key]] is "type", then:
Assert: No more than one such Record exists.
If moduleRequest was given, then set moduleType to the result of + running the module type from module request steps given + moduleRequest.
Set module type to entry.[[Value]].
Assert: the result of running the module type allowed steps given module - type and module map settings object is true. Otherwise we would not have reached - this point because a failure would have been raised when inspecting +
Assert: the result of running the module type allowed steps given + moduleType and module map settings object is true. Otherwise we would not + have reached this point because a failure would have been raised when inspecting moduleRequest.[[Assertions]] in create a JavaScript module script or fetch an import() module script graph.
Let moduleMap be module map settings object's module map.
If moduleMap[(url, module type)] is +
If moduleMap[(url, moduleType)] is
"fetching", wait in parallel until that entry's value
changes, then queue a task on the networking task source to proceed
with running the following steps.
If moduleMap[(url, module type)] If moduleMap[(url, moduleType)] exists, asynchronously complete this algorithm with
- moduleMap[url / module type], and return.
Set moduleMap[(url, module
- type)] to "fetching".
Set moduleMap[(url,
+ moduleType)] to "fetching".
Let request be a new request whose URL is url, ok status.
then set moduleMap[(url, module - type)] to null, asynchronously complete this algorithm with null, and return.
+then set moduleMap[(url, + moduleType)] to null, asynchronously complete this algorithm with null, and + return.
Let source text be the result of UTF-8
@@ -91941,26 +91928,26 @@ document.querySelector("button").addEventListener("click", bound);
Let module script be null. If MIME type is a JavaScript MIME type and module type
+ If MIME type is a JavaScript MIME type and moduleType
is " If the MIME type essence of MIME type is " If MIME type essence is a JSON MIME type and module
- type is " If MIME type essence is a JSON MIME type and moduleType
+ is " Set moduleMap[(url, module
- type)] to module script, and asynchronously complete this algorithm with
- module script. Set moduleMap[(url,
+ moduleType)] to module script, and asynchronously complete this algorithm
+ with module script. It is intentional that the module map is keyed by the request URL, whereas the marked as itself having a parse
error.) If moduleRequest.[[Assertions]] has a Record entry
- such that entry.[[Key]] is " Let moduleType be the result of running the module type from module
+ request steps given moduleRequest. Let childModule be moduleMap[(childURL, module
- type)]. Let childModule be moduleMap[(childURL,
+ moduleType)]. Assert: childModule is a module script (i.e., it is not " If requested.[[Assertions]] has a Record entry such
- that entry.[[Key]] is " Let moduleType be the result of running the module type from module
+ request steps given requested. If url is failure, or if the result of running the module type
- allowed steps given module type and settings is false, then:javascript", then set module script to the result of
creating a JavaScript module script given source text, module map
settings object, response's url, and
options.text/css"
- and module type is "css", then set module script to
+ and moduleType is "css", then set module script to
the result of creating a CSS module script given source text and
module map settings object.json", then set module script to the result of
+ json", then set module script to the result of
creating a JSON module script given source text and module map
settings object.type", then let module
- type be entry.[[Value]]. Otherwise let module type be "javascript".fetching" or null); by now all module
@@ -92153,14 +92138,12 @@ document.querySelector("button").addEventListener("click", bound);
a module specifier given script's base
URL and requested.[[Specifier]].type", then let module type
- be entry.[[Value]]. Otherwise let module type be "javascript".
Let error be a new TypeError exception.
Return script.
The module type allowed steps, given a string module type +
The module type from module request steps, given a ModuleRequest + Record moduleRequest, are as follows:
+ +Let moduleType be "javascript".
If moduleRequest.[[Assertions]] has a Record entry such
+ that entry.[[Key]] is "type", then:
If entry.[[Value]] is "javascript", then set
+ moduleType to null.
This specification uses the "javascript" module type
+ internally for JavaScript module scripts, so
+ this step is needed to prevent modules from being imported using a "javascript" type assertion (a null moduleType will cause the
+ module type allowed check to fail).
Otherwise, set moduleType to entry.[[Value]].
Return moduleType.
The module type allowed steps, given a string moduleType and an environment settings object settings, are as follows:
If module type is not " If moduleType is not "javascript", "javascript", "css", or "json", then return false.
If module type is "css" and the
+
If moduleType is "css" and the
CSSStyleSheet interface is not exposed in
- setting's Realm, then
+ settings's Realm, then
return false.
Return true.
JavaScript module scripts are the default import type when importing from another JavaScript
+ module; that is, when an import statement lacks a type import assertion the imported module script's type will be JavaScript.
+ Attempting to import a JavaScript resource using an import statement with
+ a type import assertion will fail:
<script type="module">
+ // All of the following will fail, assuming that the imported .mjs files are served with a
+ // JavaScript MIME type. JavaScript module scripts are the default and cannot be imported with
+ // any import type assertion.
+ import foo from "./foo.mjs" assert { type: "javascript" };
+ import foo2 from "./foo2.mjs" assert { type: "js" };
+ import foo3 from "./foo3.mjs" assert { type: "" };
+ await import("./foo4.mjs", { assert: { type: null } });
+ await import("./foo5.mjs", { assert: { type: undefined } });
+</script>
+ To resolve a module specifier given a URL base URL and a @@ -93401,14 +93432,12 @@ import "https://example.com/foo/../module2.mjs"; same two arguments (either while creating the corresponding module script, or in fetch an import() module script graph).
-If moduleRequest.[[Assertions]] has a Record entry such
- that entry.[[Key]] is "type", then let module type
- be entry.[[Value]]. Otherwise let module type be "javascript".
Let moduleType be the result of running the module type from module + request steps given moduleRequest.
Let resolved module script be moduleMap[(url, module - type)]. (This entry must exist for us to have gotten to - this point.)
Let resolved module script be moduleMap[(url, + moduleType)]. (This entry must exist for us to have + gotten to this point.)
Assert: resolved module script is a module script (i.e., is not
null or "fetching").