diff --git a/source b/source index 5ad958c1d2c..892120ea4ba 100644 --- a/source +++ b/source @@ -58417,10 +58417,11 @@ o............A....e
If this returns null, set the script's script to null and abort these substeps; the script is ready.
Fetch the - descendants of script (using an empty ancestor list). When this - asynchronously completes, set the script's - script to the result. At that time, the script is ready.
Fetch the
+ descendants of and instantiate script, given the destination "script
". When this asynchronously completes, set the script's script to the result. At that time,
+ the script is ready.
Assert: result's state is
"uninstantiated
".
Fetch the - descendants of result given destination and an ancestor list - obtained by appending url to ancestor list. Wait for fetching the descendants of a module script to - asynchronously complete with descendants result before proceeding to the next step.
- -If the asynchronous completion result is null, meaning that fetching one of the - descendants failed, we still proceed through the next set of steps. A failure will shortly occur - during instantiation, which we then react to appropriately. The error signal is eventually - propagated to the caller of this algorithm in the last step.
-Let record be result's module record.
Let instantiationStatus be record.ModuleDeclarationInstantiation().
- -This step will recursively call ModuleDeclarationInstantiation all of the - module's uninstantiated dependencies.
-Fetch the + descendants of and instantiate result given destination and an + ancestor list obtained by appending url to ancestor list.
For each script in result's uninstantiated inclusive descendant - module scripts, perform the following steps:
- -If instantiationStatus is an abrupt completion, then error script with - instantiationStatus.[[Value]].
Otherwise, set script's state to "instantiated
".
Asynchronously complete this algorithm with descendants result.
- -It is intentional that we complete with descendants result here, and - not result, as this allows us to propagate error signals to the caller.
-When the fetch the descendants of and instantiate a module script algorithm + asynchronously completes with final result, asynchronously complete this algorithm + with final result.
In the above algorithm, a module script script's uninstantiated - inclusive descendant module scripts is a set of module scripts determined as follows:
- -If script's module - record is null, return the empty set.
Let moduleMap be script's settings object's - module map.
Let stack be the stack « script ».
Let inclusive descendants be an empty set.
While stack is not empty:
- -Let current the result of popping from - stack.
Assert: current is a module script (i.e., it is not "fetching
" or null).
If inclusive descendants and stack both do not contain current, then:
- -Append current to - inclusive descendants.
Let child specifiers be the value of current's module record's [[RequestedModules]] - internal slot.
Let child URLs be the list obtained by calling - resolve a module specifier once for each item of child specifiers, - given current and that item. Omit any failures.
Let child modules be the list obtained by getting each value in moduleMap whose key is given by an - item of child URLs.
For each s of child modules:
- -If inclusive descendants already contains s, continue.
If s is null, continue.
Assert: s is a module script (i.e., it is not
- "fetching
", since by this point all child modules must have been
- fetched).
Push s onto stack.
Return a set containing all items of inclusive descendants whose
- state is "uninstantiated
".
The above algorithm gives a depth-first search of the module dependency graph. The - main interesting part is in how the "edges" of this graph are determined. The actual search - implementation is not important; any other technique for exploring the graph will suffice, given - that the output is a set only used for membership testing and whose order is thus not - important.
-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 @@ -87395,12 +87281,21 @@ interface NavigatorOnLine { -
To fetch the descendants of a module script module script, given a - destination and an ancestor list, run these steps. The algorithm will - asynchronously complete with either null (on failure) or with module script (on - success).
+To fetch the descendants of and instantiate a module script module + script, given a destination and an optional ancestor list, run these + steps. The algorithm will asynchronously complete with either null (on failure) or with + module script (on success).
If ancestor list was not given, let it be the empty list.
If module script's state is
+ "instantiated
" or "errored
", asynchronously
+ complete this algorithm with module script, and abort these steps.
Assert: module script's state
+ is "uninstantiated
".
Let record be module script's module record.
Let descendants result be null.
For each url in urls, perform the internal module script graph fetching procedure given url, module @@ -87454,24 +87351,132 @@ interface NavigatorOnLine { be performed in parallel to each other.
If any invocation of the internal module script graph fetching procedure - asynchronously completes with null, optionally abort all other invocations, and then - asynchronously complete this algorithm with null.
+ asynchronously completes with null, then optionally abort all other invocations, set + descendants result to null, and proceed to the next step. (The un-fetched descendant + will cause errors during instantiation.)If any invocation of the internal module script graph fetching procedure
asynchronously completes with a module script whose state is "errored
",
- optionally abort all other invocations, and then asynchronously complete this algorithm with
- module script. (The errored descendant will cause errors later in the module-fetching
- process, but for now we treat it as a premature "success".)
errored
", then
+ optionally abort all other invocations, set descendants result to module
+ script, and proceed to the next step. (The errored descendant will cause errors during
+ instantiation.)
Otherwise, wait for all of the internal module script graph fetching procedure
invocations to asynchronously complete, with module scripts
whose states are not "errored
". Then, asynchronously complete this algorithm with module
- script.
Let instantiationStatus be record.ModuleDeclarationInstantiation().
+ +This step will recursively call ModuleDeclarationInstantiation all of the + module's uninstantiated dependencies.
+For each script in module script's uninstantiated inclusive + descendant module scripts, perform the following steps:
+ +If instantiationStatus is an abrupt completion, then error script with + instantiationStatus.[[Value]].
Otherwise, set script's state to "instantiated
".
Asynchronously complete this algorithm with descendants result.
+ +It is intentional that we complete with descendants result here, and + not module script, as this allows us to notify the caller of fetching errors.
+In the above algorithm, a module script script's uninstantiated + inclusive descendant module scripts is a set of module scripts determined as follows:
+ +If script's module + record is null, return the empty set.
Let moduleMap be script's settings object's + module map.
Let stack be the stack « script ».
Let inclusive descendants be an empty set.
While stack is not empty:
+ +Let current the result of popping from + stack.
Assert: current is a module script (i.e., it is not "fetching
" or null).
If inclusive descendants and stack both do not contain current, then:
+ +Append current to + inclusive descendants.
Let child specifiers be the value of current's module record's [[RequestedModules]] + internal slot.
Let child URLs be the list obtained by calling + resolve a module specifier once for each item of child specifiers, + given current and that item. Omit any failures.
Let child modules be the list obtained by getting each value in moduleMap whose key is given by an + item of child URLs.
For each s of child modules:
+ +If inclusive descendants already contains s, continue.
If s is null, continue.
Assert: s is a module script (i.e., it is not
+ "fetching
", since by this point all child modules must have been
+ fetched).
Push s onto stack.
Return a set containing all items of inclusive descendants whose
+ state is "uninstantiated
".
The above algorithm gives a depth-first search of the module dependency graph. The + main interesting part is in how the "edges" of this graph are determined. The actual search + implementation is not important; any other technique for exploring the graph will suffice, given + that the output is a set only used for membership testing and whose order is thus not + important.
+To create a classic script, given some script