From bdae4df8d3bf8d2ec1b199b5b6a08ef371146f26 Mon Sep 17 00:00:00 2001
From: Daniel Ehrenberg The following terms are defined in WebAssembly JavaScript Module Integration: A script is one of two possible A script is one of three possible structs. All scripts have: Either a Script Record, for classic
scripts; a Source Text Module Record, for module scripts; or null. In the former two cases, it represents a parsed script;
- null represents a failure parsing.RequestCredentials
enumerationRequestDestination
enumerationfetch()
method
+
+
@@ -86768,7 +86781,7 @@ interface ApplicationCache : EventTarget {
Definitions
-
@@ -86781,8 +86794,10 @@ interface ApplicationCache : EventTarget {
A WebAssembly module script is another type of script. It has no additional items.
+The active script is determined by the following algorithm:
response's status is not an ok status
The result of extracting a MIME type from - response's header list is not a - JavaScript MIME type
+Let type be the result of extracting a + MIME type from response's header + list.
-For historical reasons, fetching a - classic script does not include MIME type checking. In contrast, module scripts will - fail to load if they are not of a correct MIME type.
-For historical reasons, fetching a + classic script does not include MIME type checking. In contrast, module scripts' + interpretation is driven by their MIME type, and they will fail to load if they are not of + a supported MIME type.
-Let source text be the result of UTF-8 - decoding response's body.
Let module script be null.
Let module script be the result of creating a module script given - source text, module map settings object, response's url, and options.
If type is a JavaScript MIME type, then:
+ +Let source text be the result of UTF-8 + decoding response's body.
Set module script to the result of creating a module script given + source text, module map settings object, response's url, and options.
If type is a WebAssembly MIME type, then:
+ +Let buffer be the result of running consume body on + response with ArrayBuffer.
Set module script to the result of creating a WebAssembly module + script given buffer, module map settings object, + response's url, and + options.
Set moduleMap[url] to module
@@ -87737,6 +87779,44 @@ interface ApplicationCache : EventTarget {
Return script.
To validate requested module specifiers + of a module record record for a script script:
+ +For each string requested of + record.[[RequestedModules]]:
+ +Let url be the result of resolving + a module specifier given script's base + URL and requested.
If url is failure, then:
+ +Let error be a new TypeError
exception.
Set script's parse error + to error.
Return.
Set script's record to + result.
This algorithm is essentially validating all of the requested module specifiers. We + treat a module with unresolvable module specifiers the same as one that cannot be parsed; in + both cases, a syntactic issue makes it impossible to ever contemplate instantiating the module + later.
+To create a module script, given a
JavaScript string source, an environment settings object
settings, a URL baseURL, and some script fetch
@@ -87781,37 +87861,56 @@ interface ApplicationCache : EventTarget {
- For each string requested of
- result.[[RequestedModules]]: Validate requested module specifiers of result with
+ script. Let url be the result of resolving
- a module specifier given script's base
- URL and requested. Return script. If url is failure, then: To create a WebAssembly module script,
+ given an Let error be a new If scripting is disabled for
+ settings's responsible browsing context, then set source to
+ the empty string. Set script's parse error
- to error. Let script be a new WebAssembly module script that this algorithm
+ will subsequently initialize. Return script. Set script's settings object to settings. Set script's base URL to
+ baseURL. Set script's fetch
+ options to options. Set script's parse error and
+ error to rethrow to null. This step is essentially validating all of the requested module specifiers. We
- treat a module with unresolvable module specifiers the same as one that cannot be parsed; in
- both cases, a syntactic issue makes it impossible to ever contemplate instantiating the module
- later. Let module be the result of parse a WebAssembly module given the
+ Passing script as the last parameter here ensures
+ result.[[HostDefined]] will be script. If this algorithm throws an exception, then catch it and perform the following steps: Set script's parse error to
+ the exception. Return script. Set script's record to
- result. Validate requested module specifiers of module with
+ script. Return script.
-
- ArrayBuffer
buffer, an
+ environment settings object settings, a URL baseURL,
+ and some script fetch options options:
-
TypeError
exception.
+
- ArrayBuffer
buffer, settings's
+ Realm, and script.
+
application/xml
application/wasm
image/gif