@@ -86746,24 +86746,24 @@ interface <dfn>NavigatorOnLine</dfn> {
8674686746
8674786747 </dd>
8674886748
86749- <dt>An <dfn data-x="concept-module-script-instantiation- state">instantiation state</dfn></dt>
86749+ <dt>A <dfn data-x="concept-module-script-state">state</dfn></dt>
8675086750
8675186751 <dd>
8675286752
8675386753 <p>One of "<code data-x="">uninstantiated</code>", "<code data-x="">errored</code>", or "<code
8675486754 data-x="">instantiated</code>", used to prevent reinvocation of <span
8675586755 data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> on modules that
86756- failed to instantiate previously.</p>
86756+ failed to instantiate previously, and to ensure errors during parsing or instantiation are
86757+ remembered and propagated correctly.</p>
8675786758
8675886759 </dd>
8675986760
86760- <dt>An <dfn data-x="concept-module-script-instantiation- error">instantiation error</dfn></dt>
86761+ <dt>An <dfn data-x="concept-module-script-error">error</dfn></dt>
8676186762
8676286763 <dd>
8676386764
8676486765 <p>A JavaScript value, which has meaning only if the <span
86765- data-x="concept-module-script-instantiation-state">instantiation state</span> is "<code
86766- data-x="">errored</code>".</p>
86766+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>".</p>
8676786767
8676886768 </dd>
8676986769
@@ -87230,49 +87230,41 @@ interface <dfn>NavigatorOnLine</dfn> {
8723087230 <li><p>If <var>result</var> is null, asynchronously complete this algorithm with null and abort
8723187231 these steps.</p></li>
8723287232
87233+ <li><p>If <var>result</var>'s <span data-x="concept-module-script-state">state</span> is "<code
87234+ data-x="">instantiated</code>" or "<code data-x="">errored</code>", asynchronously complete this
87235+ algorithm with <var>result</var>, and abort these steps.</p></li>
87236+
87237+ <li><p>Assert: <var>result</var>'s <span data-x="concept-module-script-state">state</span> is
87238+ "<code data-x="">uninstantiated</code>".</p></li>
87239+
8723387240 <li>
87234- <p>Otherwise, <var>result</var> is a <span>module script</span>. <span data-x="fetch the
87235- descendants of a module script">Fetch the descendants</span> of <var>result</var> given
87236- <var>destination</var> and an ancestor list obtained by appending <var>url</var> to <var>ancestor
87237- list</var>. Wait for <span data-x="fetch the descendants of a module script">fetching the
87238- descendants of a module script</span> to asynchronously complete with <var>descendants
87239- result</var> before proceeding to the next step.</p>
87241+ <p><span data-x="fetch the descendants of a module script">Fetch the
87242+ descendants</span> of <var>result</var> given <var>destination</var> and an ancestor list
87243+ obtained by appending <var>url</var> to <var>ancestor list</var>. Wait for <span data-x="fetch
87244+ the descendants of a module script">fetching the descendants of a module script</span> to
87245+ asynchronously complete with <var>descendants result</var> before proceeding to the next step.</p>
8724087246
8724187247 <p class="note">If the asynchronous completion result is null, meaning that fetching one of the
8724287248 descendants failed, we still proceed through the next set of steps. A failure will shortly occur
8724387249 during instantiation, which we then react to appropriately. The error signal is eventually
8724487250 propagated to the caller of this algorithm in the last step.</p>
8724587251 </li>
8724687252
87247- <li><p>Let <var>instantiationStatus</var> be null.</p></li>
87248-
87249- <li><p>If <var>result</var>'s <span data-x="concept-module-script-instantiation-state">instantiation
87250- state</span> is "<code data-x="">errored</code>", then set <var>instantiationStatus</var> to
87251- Completion { [[Type]]: throw, [[Value]]: <var>result</var>'s <span
87252- data-x="concept-module-script-instantiation-error">instantiation error</span>, [[Target]]:
87253- empty }.</p></li>
87253+ <li><p>Let <var>record</var> be <var>result</var>'s <span
87254+ data-x="concept-module-script-module-record">module record</span>.</p></li>
8725487255
8725587256 <li>
87256- <p>Otherwise:</p>
87257-
87258- <ol>
87259- <li><p>Let <var>record</var> be <var>result</var>'s <span
87260- data-x="concept-module-script-module-record">module record</span>.</p></li>
87261-
87262- <li>
87263- <p>Set <var>instantiationStatus</var> to <var>record</var>.<span
87264- data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span>().</p>
87257+ <p>Let <var>instantiationStatus</var> be <var>record</var>.<span
87258+ data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span>().</p>
8726587259
87266- <p class="note">This step will recursively call <span
87267- data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> all of the
87268- module's uninstantiated dependencies.</p>
87269- </li>
87270- </ol>
87260+ <p class="note">This step will recursively call <span
87261+ data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> all of the
87262+ module's uninstantiated dependencies.</p>
8727187263 </li>
8727287264
8727387265 <li>
87274- <p>For each <var>script</var> in <var>result</var>'s <span>uninstantiated inclusive descendant module
87275- scripts</span>, perform the following steps:</p>
87266+ <p>For each <var>script</var> in <var>result</var>'s <span>uninstantiated inclusive descendant
87267+ module scripts</span>, perform the following steps:</p>
8727687268
8727787269 <ol>
8727887270 <li>
@@ -87285,18 +87277,16 @@ interface <dfn>NavigatorOnLine</dfn> {
8728587277 <li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
8728687278 record</span> to null.</p></li>
8728787279
87288- <li><p>Set <var>script</var>'s <span
87289- data-x="concept-module-script-instantiation-state">instantiation state</span> to "<code
87290- data-x="">errored</code>".</p></li>
87280+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-state">state</span> to
87281+ "<code data-x="">errored</code>".</p></li>
8729187282
87292- <li><p>Set <var>script</var>'s <span
87293- data-x="concept-module-script-instantiation-error">instantiation error</span> to
87283+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-error">error</span> to
8729487284 <var>instantiationStatus</var>.[[Value]].</p></li>
8729587285 </ol>
8729687286 </li>
8729787287
8729887288 <li><p>Otherwise, set <var>script</var>'s <span
87299- data-x="concept-module-script-instantiation- state">instantiation state</span> to "<code
87289+ data-x="concept-module-script-state">state</span> to "<code
8730087290 data-x="">instantiated</code>".</p></li>
8730187291 </ol>
8730287292 </li>
@@ -87314,6 +87304,9 @@ interface <dfn>NavigatorOnLine</dfn> {
8731487304 data-x="module script">module scripts</span> determined as follows:</p>
8731587305
8731687306 <ol>
87307+ <li><p>If <var>script</var>'s <span data-x="concept-module-script-module-record">module
87308+ record</span> is null, return the empty set.</p></li>
87309+
8731787310 <li><p>Let <var>moduleMap</var> be <var>script</var>'s <span>settings object</span>'s
8731887311 <span data-x="concept-settings-object-module-map">module map</span>.</p></li>
8731987312
@@ -87372,7 +87365,7 @@ interface <dfn>NavigatorOnLine</dfn> {
8737287365 </li>
8737387366
8737487367 <li><p>Return a <span>set</span> containing all items of <var>inclusive descendants</var> whose
87375- <span data-x="concept-module-script-instantiation- state">instantiation state</span> is "<code
87368+ <span data-x="concept-module-script-state">state</span> is "<code
8737687369 data-x="">uninstantiated</code>".</p></li>
8737787370 </ol>
8737887371
@@ -87505,10 +87498,14 @@ interface <dfn>NavigatorOnLine</dfn> {
8750587498 <ol>
8750687499 <li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>
8750787500
87508- <li><p><span>Report the exception</span> <var>error</var> for <var>module
87509- script</var>.</p></li>
87501+ <li><p>Set <var>module script</var>'s <span data-x="concept-module-script-state">state</span>
87502+ to "<code data-x="">errored</code>".</p></li>
87503+
87504+ <li><p>Set <var>module script</var>'s <span data-x="concept-module-script-error">error</span>
87505+ to <var>error</var>.</p></li>
8751087506
87511- <li><p>Abort this algorithm, and asynchronously complete it with null.</p></li>
87507+ <li><p>Abort this algorithm, and asynchronously complete it with <var>module
87508+ script</var>.</p></li>
8751287509 </ol>
8751387510 </li>
8751487511
@@ -87531,10 +87528,25 @@ interface <dfn>NavigatorOnLine</dfn> {
8753187528 <span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along
8753287529 while performing the <span>internal module script graph fetching procedure</span>.</p>
8753387530
87534- <p>Wait for all of the <span>internal module script graph fetching procedure</span> invocations
87535- to asynchronously complete. If any of them asynchronously complete with null, then
87536- asynchronously complete this algorithm with null. Otherwise, asynchronously complete this
87537- algorithm with <var>module script</var>.</p>
87531+ <p>These invocations of the <span>internal module script graph fetching procedure</span> should
87532+ be performed in parallel to each other.</p>
87533+
87534+ <p>If any invocation of the <span>internal module script graph fetching procedure</span>
87535+ asynchronously completes with null, optionally abort all other invocations, and then
87536+ asynchronously complete this algorithm with null.</p>
87537+
87538+ <p>If any invocation of the <span>internal module script graph fetching procedure</span>
87539+ asynchronously completes with a <span>module script</span> whose <span
87540+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>",
87541+ optionally abort all other invocations, and then asynchronously complete this algorithm with
87542+ <var>module script</var>. (The errored descendant will cause errors later in the module-fetching
87543+ process, but for now we treat it as a premature "success".)</p>
87544+
87545+ <p>Otherwise, wait for all of the <span>internal module script graph fetching procedure</span>
87546+ invocations to asynchronously complete, with <span data-x="module script">module scripts</span>
87547+ whose <span data-x="concept-module-script-state">states</span> are not "<code
87548+ data-x="">errored</code>". Then, asynchronously complete this algorithm with <var>module
87549+ script</var>.</p>
8753887550 </li>
8753987551 </ol>
8754087552
@@ -87595,9 +87607,22 @@ interface <dfn>NavigatorOnLine</dfn> {
8759587607 <var>result</var>.[[HostDefined]] will be <var>script</var>.</p>
8759687608 </li>
8759787609
87598- <li><p>If <var>result</var> is a <span>List</span> of errors, <span>report the exception</span>
87599- given by the first element of <var>result</var> for <var>script</var>, return null, and abort
87600- these steps.</p></li>
87610+ <li>
87611+ <p>If <var>result</var> is a <span>List</span> of errors, then:</p>
87612+
87613+ <ol>
87614+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-state">state</span> to
87615+ "<code data-x="">errored</code>".</p></li>
87616+
87617+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-error">error</span> to
87618+ <var>errors</var>[0].</p></li>
87619+
87620+ <li><p>Return <var>script</var>.</p></li>
87621+ </ol>
87622+ </li>
87623+
87624+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-state">state</span> to "<code
87625+ data-x="">uninstantiated</code>".</p></li>
8760187626
8760287627 <li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
8760387628 record</span> to <var>result</var>.</p></li>
@@ -87695,14 +87720,12 @@ interface <dfn>NavigatorOnLine</dfn> {
8769587720 <li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
8769687721 not run" then abort these steps.</p></li>
8769787722
87698- <li><p>If <var>s</var>'s <span data-x="concept-module-script-instantiation-state">instantiation
87699- state</span> is "<code data-x="">errored</code>", then <span>report the
87700- exception</span> given by <var>s</var>'s <span
87701- data-x="concept-module-script-instantiation-error">instantiation error</span> for <var>s</var>
87702- and abort these steps.</p></li>
87723+ <li><p>If <var>s</var>'s <span data-x="concept-module-script-state">state</span> is "<code
87724+ data-x="">errored</code>", then <span>report the exception</span> given by <var>s</var>'s <span
87725+ data-x="concept-module-script-error">error</span> for <var>s</var> and abort these
87726+ steps.</p></li>
8770387727
87704- <li><p>Assert: <var>s</var>'s <span
87705- data-x="concept-module-script-instantiation-state">instantiation state</span> is "<code
87728+ <li><p>Assert: <var>s</var>'s <span data-x="concept-module-script-state">state</span> is "<code
8770687729 data-x="">instantiated</code>" (and thus its <span
8770787730 data-x="concept-module-script-module-record">module record</span> is not null).</p></li>
8770887731
@@ -88578,14 +88601,14 @@ import "https://example.com/foo/../module2.js";</pre>
8857888601 steps.</p></li>
8857988602
8858088603 <li><p>If <var>resolved module script</var>'s <span
88581- data-x="concept-module-script-instantiation- state">instantiation state</span> is "<code
88582- data-x="">errored</code>", then throw <var>resolved module script</var>'s <span
88583- data-x="concept-module-script-instantiation- error">instantiation error</span>.</p></li>
88604+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>", then throw
88605+ <var>resolved module script</var>'s <span
88606+ data-x="concept-module-script-error">error</span>.</p></li>
8858488607
8858588608 <li><p>Assert: <var>resolved module script</var>'s <span
88586- data-x="concept-module-script-instantiation- state">instantiation state</span> is "<code
88587- data-x="">instantiated</code>" (and thus its <span
88588- data-x="concept-module-script-module-record">module record</span> is not null).</p></li>
88609+ data-x="concept-module-script-state">state</span> is "<code data-x="">instantiated</code>" (and
88610+ thus its <span data-x="concept-module-script-module-record">module record</span> is not
88611+ null).</p></li>
8858988612
8859088613 <li><p>Return <var>resolved module script</var>'s <span
8859188614 data-x="concept-module-script-module-record">module record</span>.</p></li>
0 commit comments