From eb39f80a2bd51ae1939254d5bc554c895b2cb3c0 Mon Sep 17 00:00:00 2001
From: Daniel Ehrenberg The following terms are defined in WebAssembly JavaScript Module Integration: a Synthetic Module Record, for CSS module
scripts and JSON module scripts a WebAssembly Module Record, for WebAssembly module scripts; null, representing a parsing failure.
+
+
+
+
+
@@ -91620,6 +91634,9 @@ document.querySelector("button").addEventListener("click", bound);
A module script is a WebAssembly module script if + its record is a WebAssembly Module + Record.
A module script is a CSS module script if its record is a Synthetic Module Record, and it @@ -92705,6 +92726,22 @@ document.querySelector("button").addEventListener("click", bound); creating a JSON module script given source text and module map settings object.
If the MIME type essence of MIME type is
+ "application/wasm" and module type is "javascript", then:
Let bufferPromise be the result of running consume body on + response with ArrayBuffer.
Create a WebAssembly module + script given bufferPromise, module map settings object, + response's url, and options. + Wait until the algorithm asynchronously completes with result.
Set module script to result.
Set moduleMap[(url,
moduleType)] to module script, and asynchronously complete this algorithm
@@ -92890,36 +92927,12 @@ document.querySelector("button").addEventListener("click", bound);
we only asked for "type" assertions in
HostGetSupportedImportAssertions.
For each ModuleRequest record - requested of result.[[RequestedModules]]:
- -Let url be the result of resolving - a module specifier given script's base - URL and requested.[[Specifier]].
Let moduleType be the result of running the module type from module - request steps given requested.
Run the validate requested module specifiers steps given result + and script.
-If url is failure, or if the result of running the module type - allowed steps given moduleType and settings is false, then:
-Let error be a new TypeError exception.
Set script's parse error - to error.
Return script.
This step is essentially validating all of the requested module specifiers and - type assertions. We treat a module with unresolvable module specifiers or unsupported type - assertions the same as one that cannot be parsed; in both cases, a syntactic issue makes it - impossible to ever contemplate linking the module later.
+If these steps throw an exception, set script's parse error to that exception, and return + script.
Set script's record to @@ -92996,6 +93009,109 @@ document.querySelector("button").addEventListener("click", bound);
Return script.
To create a WebAssembly module script,
+ given a promise that will resolve with an ArrayBuffer
+ bufferPromise, an environment settings object settings, a
+ URL baseURL, and some script fetch options
+ options, run these steps. The algorithm will asynchronously complete with a new
+ WebAssembly module script.
If scripting is disabled for
+ settings, then set bufferPromise to a promise resolved with an empty
+ ArrayBuffer.
Let script be a new WebAssembly module script that this algorithm + will subsequently initialize.
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.
Upon fulfillment of bufferPromise with buffer:
+ +Let module be the result of parse a WebAssembly module given + buffer, settings's Realm, and script.
+ +Passing script as the last parameter here ensures + result.[[HostDefined]] will be script.
+ +If this algorithm throws an exception, set script's parse error to that exception, and asynchronously + complete this algorithm with script.
+Run the validate requested module specifiers steps given module + and script.
+ +Set script's record to + module.
Asynchronously complete this algorithm with script.
Upon rejection of bufferPromise with reason:
+Set script's parse error to + reason.
Asynchronously complete this algorithm with script.
The validate requested module specifiers + steps, given a module record record and a script script, are as + follows:
+ +For each ModuleRequest record + requested of record.[[RequestedModules]]:
+ +Let url be the result of resolving + a module specifier given script's base + URL and requested.[[Specifier]].
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 moduleType and settings is false, then:
+ +Let error be a new TypeError exception.
Throw error.
These steps are essentially validating all of the requested module specifiers and + type assertions. We treat a module with unresolvable module specifiers or unsupported type + assertions the same as one that cannot be parsed; in both cases, a syntactic issue makes it + impossible to ever contemplate linking the module later.
+The module type from module request steps, given a ModuleRequest Record moduleRequest, are as follows:
@@ -126668,6 +126784,9 @@ INSERT INTERFACES HEREapplication/xmlapplication/wasmimage/gif