diff --git a/source b/source index 49ab997c711..d853c4c0d8e 100644 --- a/source +++ b/source @@ -2944,6 +2944,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
Users agents that support JavaScript must also implement the import() proposal. + The following terms are defined there, and used in this specification:
+ +import()
This feature is not quite integrated yet, but will be + shortly. In the meantime there are some parts of the script processing model that have been + updated to support it, which might appear pointless until that integration is complete.
+ @@ -58087,11 +58098,19 @@ o............A....e -Let parser state be "parser-inserted
" if the
+
Let parser metadata be "parser-inserted
" if the
script
element has been flagged as "parser-inserted", and
- "not parser-inserted
" otherwise.
not-parser-inserted
" otherwise.
- Let settings be the element's node document's +
Let options be a script fetch options whose cryptographic nonce is cryptographic + nonce, integrity metadata is + integrity metadata, parser + metadata is parser metadata, and credentials mode is module script + credentials mode.
+ +Let settings object be the element's node document's
Window
object's environment settings object.
classic
"Fetch a classic script given url, settings, - cryptographic nonce, integrity metadata, parser state, - CORS setting, and encoding.
+Fetch a classic script given url, settings object, + options, CORS setting, and encoding.
module
"Fetch a module script graph given url, settings,
- "script
", cryptographic nonce, parser state,
- and module script credentials mode.
Fetch a module script graph given url, settings
+ object, "script
", and options.
Let script be the result of creating a classic script using - source text and settings.
Set the script's script to script.
Let script be the result of creating a module script using - source text, settings, base URL, cryptographic - nonce, parser state, and module script credentials - mode.
If this returns null, set the script's script to null and abort these substeps; the script is ready.
A JavaScript value, which has meaning only if the record is null.
A module script is a script - that has the following additional items:
+ that has the following additional item:A credentials mode used to fetch - imported modules.
- -A cryptographic nonce used to fetch - imported modules.
- -The parser metadata used to fetch - imported modules.
- -We say that a module script is @@ -86564,6 +86560,79 @@ interface NavigatorOnLine { inputs and resulting in classic or module scripts.
+We define script fetch options to be a struct with the following items:
+ +The cryptographic nonce metadata used + for the initial fetch and for fetching any imported modules
The integrity metadata used for + the initial fetch
The parser metadata used for the + initial fetch and for fetching any imported modules.
The credentials mode used for the + initial fetch (for module scripts) and for fetching any + imported modules (for both module scripts and classic scripts).
Recall that via the import()
feature, classic scripts can import module scripts.
The default classic script fetch options are a script fetch options
+ whose cryptographic nonce is the empty
+ string, integrity metadata is the
+ empty string, parser metadata is "not-parser-inserted
", and credentials mode is "omit
".
Given a request request and a script + fetch options options, we define:
+ +Set request's cryptographic nonce metadata to + options's cryptographic + nonce, its integrity metadata to + options's integrity + metadata, and its parser metadata to + options's parser + metadata.
Set request's + cryptographic nonce metadata to + options's cryptographic + nonce, its integrity metadata to + options's integrity + metadata, its parser metadata to + options's parser metadata, + and its credentials mode to + options's credentials + mode.
For any given script fetch options options, the descendant script + fetch options are a new script fetch options whose items all have the same values, except for the integrity metadata, which is instead the + empty string.
+ +The algorithms below can be customized by optionally supplying a custom perform the fetch hook, which takes a request and an NavigatorOnLine {
Service Workers is an example of a specification that runs these algorithms with its own options for the hook.
+Now for the algorithms themselves.
+To fetch a classic script given a url, a settings - object, a cryptographic nonce, an integrity metadata, a parser - state, a CORS setting, and a character encoding, run these steps. The - algorithm will asynchronously complete with either null (on failure) or a new classic - script (on success).
+ object, some options, a CORS setting, and a character + encoding, run these steps. The algorithm will asynchronously complete with either null (on + failure) or a new classic script (on success).Let request be the result of script", and CORS setting.
Set request's client to - settings object, its cryptographic nonce - metadata to cryptographic nonce, its integrity metadata to integrity - metadata and its parser metadata to - parser state.
Set up the classic script request given request and + options.
Let script be the result of creating a classic script given - source text, settings object, and muted errors.
Let script be the result of creating a classic script using - source text and script settings object.
Let request be a new request whose url is url, client is settings object, destination is "script", destination is "script
", parser metadata is "not
parser-inserted
", synchronous flag is set, and whose
use-URL-credentials flag is set.
Let script be the result of creating a classic script given - source text, settings object, and muted errors.
Return script.
To fetch a module script graph given - a url, a settings object, a destination, a cryptographic - nonce, a parser state, and a credentials mode, run these steps. The - algorithm will asynchronously complete with either null (on failure) or a module - script (on success).
+ a url, a settings object, a destination, and some + options, run these steps. The algorithm will asynchronously complete with either null + (on failure) or a module script (on success).Let visited set be « url ».
Perform the internal module script graph fetching procedure given
- url, settings object, destination, cryptographic
- nonce, parser state, credentials mode, settings object,
- visited set, "client
", and with the top-level module fetch
- flag set. If the caller of this algorithm specified custom url, settings object, destination, options,
+ settings object, visited set, "client
", and with the
+ top-level module fetch flag set. If the caller of this algorithm specified custom perform the fetch steps, pass those along as
well.
Let visited set be « url ».
Let options be a script fetch options whose cryptographic nonce is the empty string, integrity metadata is the empty string,
+ parser metadata is "not-parser-inserted
", and credentials mode is credentials
+ mode.
Perform the internal module script graph fetching procedure given
- url, fetch client settings object, destination, the empty
- string, "not parser-inserted
", credentials mode, module
- map settings object, visited set, "client
", and with the
- top-level module fetch flag set. If the caller of this algorithm specified custom
- perform the fetch steps, pass those along as
- well.
client
", and with the top-level module fetch flag set. If the caller
+ of this algorithm specified custom perform the
+ fetch steps, pass those along as well.
When the internal module script graph fetching procedure asynchronously completes with result, asynchronously complete this algorithm with @@ -86807,22 +86886,22 @@ interface NavigatorOnLine { a script">preparing a script, and should not be used directly by other specifications.
To perform the internal module script graph fetching procedure given a - url, a fetch client settings object, a destination, a - cryptographic nonce, a parser state, a credentials mode, a - module map settings object, a visited set, a referrer, and a - top-level module fetch flag, perform these steps. The algorithm will asynchronously - complete with either null (on failure) or a module script (on success).
+ url, a fetch client settings object, a destination, a some + options, a module map settings object, a visited set, a + referrer, and a top-level module fetch flag, perform these steps. The + algorithm will asynchronously complete with either null (on failure) or a module + script (on success).Assert: visited set contains url.
Fetch a single module script given url, fetch client settings - object, destination, cryptographic nonce, parser state, - credentials mode, module map settings object, referrer, and the - top-level module fetch flag. If the caller of this algorithm specified custom perform the fetch steps, pass those along while - fetching a single module script.
+ object, destination, options, module map settings object, + referrer, and the top-level module fetch flag. If the caller of this + algorithm specified custom perform the fetch + steps, pass those along while fetching a single + module script.Return from this algorithm, and run the following steps when fetching a single module script asynchronously completes with @@ -86846,11 +86925,10 @@ interface NavigatorOnLine {
To fetch a single module script, given a url, a fetch client - settings object, a destination, a cryptographic nonce, a parser - state, a credentials mode, a module map settings object, a - referrer, and a top-level module fetch flag, run these steps. The algorithm - will asynchronously complete with either null (on failure) or a module script (on - success).
+ settings object, a destination, some options, a module map + settings object, a referrer, and a top-level module fetch flag, run + these steps. The algorithm will asynchronously complete with either null (on failure) or a + module script (on success).Let moduleMap be module map settings object's NavigatorOnLine {
url is url, destination is destination, mode is "cors
", credentials mode is credentials
- mode, cryptographic nonce metadata is
- cryptographic nonce, parser
- metadata is parser state, referrer is referrer, and client is fetch client settings
object.
Set up the module script request given request and + options.
If the caller specified custom steps to perform
@@ -86924,8 +87001,7 @@ interface NavigatorOnLine {
Let module script be the result of creating a module script given
source text, module map settings object, response's url, cryptographic
- nonce, parser state, and credentials mode.
Set moduleMap[url] to module @@ -86985,18 +87061,18 @@ interface NavigatorOnLine {
Let options be the descendant script fetch options for module + script's fetch options.
For each url in urls, perform the - internal module script graph fetching procedure given url, module - script's credentials mode, - module script's cryptographic - nonce, module script's parser - state, destination, module script's settings object, - module script's settings object, visited set, module - script's base URL, and with the - top-level module fetch flag unset. If the caller of this algorithm specified custom - perform the fetch steps, pass those along - while performing the internal module script graph fetching procedure.
+ internal module script graph fetching procedure given url, + options, destination, module script's settings + object, module script's settings object, visited set, + module script's base URL, and + with the top-level module fetch flag unset. If the caller of this algorithm specified + custom perform the fetch steps, pass those + along while performing the internal module script graph fetching procedure.These invocations of the internal module script graph fetching procedure should be performed in parallel to each other.
@@ -87081,7 +87157,8 @@ interface NavigatorOnLine {To create a classic script, given a JavaScript string source, an environment settings object - settings, and an optional muted errors boolean:
+ settings, some script fetch options options, and an optional + muted errors boolean:If muted errors was not provided, let it be false.
If result is a List of errors, then set script's parse error to result[0].
If result is a List of errors, then:
+ +Set script's parse error to + result[0].
Otherwise, set script's record to +
Return script.
Set script's record to result.
Set script's fetch + options to options.
Return script.
To create a module script, given a JavaScript string source, an environment settings object - settings, a URL baseURL, a cryptographic nonce - cryptographicNonce, a parser - metadata parserState, and a credentials mode credentialsMode:
+ settings, a URL baseURL, and some script fetch + options options:If scripting is disabled for @@ -87187,14 +87272,8 @@ interface NavigatorOnLine {
Set script's base URL to baseURL.
Set script's cryptographic - nonce to cryptographicNonce.
Set script's parser state - to parserState.
Set script's credentials - mode to credentialsMode.
Set script's fetch + options to options.
Return script.
Let script be the result of creating a classic script given - script source and settings object.
Run the classic script script.