@@ -86557,24 +86557,24 @@ interface <dfn>NavigatorOnLine</dfn> {
86557
86557
86558
86558
</dd>
86559
86559
86560
- <dt>An <dfn data-x="concept-module-script-instantiation- state">instantiation state</dfn></dt>
86560
+ <dt>A <dfn data-x="concept-module-script-state">state</dfn></dt>
86561
86561
86562
86562
<dd>
86563
86563
86564
86564
<p>One of "<code data-x="">uninstantiated</code>", "<code data-x="">errored</code>", or "<code
86565
86565
data-x="">instantiated</code>", used to prevent reinvocation of <span
86566
86566
data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> on modules that
86567
- failed to instantiate previously.</p>
86567
+ failed to instantiate previously, and to ensure errors during parsing, instantiation, or
86568
+ evaluation are remembered and propagated correctly.</p>
86568
86569
86569
86570
</dd>
86570
86571
86571
- <dt>An <dfn data-x="concept-module-script-instantiation- error">instantiation error</dfn></dt>
86572
+ <dt>An <dfn data-x="concept-module-script-error">error</dfn></dt>
86572
86573
86573
86574
<dd>
86574
86575
86575
86576
<p>A JavaScript value, which has meaning only if the <span
86576
- data-x="concept-module-script-instantiation-state">instantiation state</span> is "<code
86577
- data-x="">errored</code>".</p>
86577
+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>".</p>
86578
86578
86579
86579
</dd>
86580
86580
@@ -86607,6 +86607,33 @@ interface <dfn>NavigatorOnLine</dfn> {
86607
86607
86608
86608
</dl>
86609
86609
86610
+ <p>To <dfn>error a module script</dfn> <var>script</var> with a given value <var>error</var>,
86611
+ perform the following steps:</p>
86612
+
86613
+ <ol>
86614
+ <li><p>Assert: <var>script</var>'s <span data-x="concept-module-script-state">state</span> is not
86615
+ "<code data-x="">errored</code>".</p></li>
86616
+
86617
+ <li>
86618
+ <p>If <var>script</var>'s <span data-x="concept-module-script-module-record">module
86619
+ record</span> is set, then:</p>
86620
+
86621
+ <ol>
86622
+ <li><p>Set <var>script</var> <span data-x="concept-module-script-module-record">module
86623
+ record</span>'s [[HostDefined]] field to undefined.</p></li>
86624
+
86625
+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
86626
+ record</span> to null.</p></li>
86627
+ </ol>
86628
+ </li>
86629
+
86630
+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-state">state</span> to
86631
+ "<code data-x="">errored</code>".</p></li>
86632
+
86633
+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-error">error</span> to
86634
+ <var>error</var>.</p></li>
86635
+ </ol>
86636
+
86610
86637
<hr>
86611
86638
86612
86639
<p>An <dfn data-export="">environment</dfn> is an object that identifies the settings of a
@@ -87041,73 +87068,49 @@ interface <dfn>NavigatorOnLine</dfn> {
87041
87068
<li><p>If <var>result</var> is null, asynchronously complete this algorithm with null and abort
87042
87069
these steps.</p></li>
87043
87070
87071
+ <li><p>If <var>result</var>'s <span data-x="concept-module-script-state">state</span> is "<code
87072
+ data-x="">instantiated</code>" or "<code data-x="">errored</code>", asynchronously complete this
87073
+ algorithm with <var>result</var>, and abort these steps.</p></li>
87074
+
87075
+ <li><p>Assert: <var>result</var>'s <span data-x="concept-module-script-state">state</span> is
87076
+ "<code data-x="">uninstantiated</code>".</p></li>
87077
+
87044
87078
<li>
87045
- <p>Otherwise, <var>result</var> is a <span>module script</span>. <span data-x="fetch the
87046
- descendants of a module script">Fetch the descendants</span> of <var>result</var> given
87047
- <var>destination</var> and an ancestor list obtained by appending <var>url</var> to <var>ancestor
87048
- list</var>. Wait for <span data-x="fetch the descendants of a module script">fetching the
87049
- descendants of a module script</span> to asynchronously complete with <var>descendants
87050
- result</var> before proceeding to the next step.</p>
87079
+ <p><span data-x="fetch the descendants of a module script">Fetch the
87080
+ descendants</span> of <var>result</var> given <var>destination</var> and an ancestor list
87081
+ obtained by appending <var>url</var> to <var>ancestor list</var>. Wait for <span data-x="fetch
87082
+ the descendants of a module script">fetching the descendants of a module script</span> to
87083
+ asynchronously complete with <var>descendants result</var> before proceeding to the next step.</p>
87051
87084
87052
87085
<p class="note">If the asynchronous completion result is null, meaning that fetching one of the
87053
87086
descendants failed, we still proceed through the next set of steps. A failure will shortly occur
87054
87087
during instantiation, which we then react to appropriately. The error signal is eventually
87055
87088
propagated to the caller of this algorithm in the last step.</p>
87056
87089
</li>
87057
87090
87058
- <li><p>Let <var>instantiationStatus</var> be null.</p></li>
87059
-
87060
- <li><p>If <var>result</var>'s <span data-x="concept-module-script-instantiation-state">instantiation
87061
- state</span> is "<code data-x="">errored</code>", then set <var>instantiationStatus</var> to
87062
- Completion { [[Type]]: throw, [[Value]]: <var>result</var>'s <span
87063
- data-x="concept-module-script-instantiation-error">instantiation error</span>, [[Target]]:
87064
- empty }.</p></li>
87091
+ <li><p>Let <var>record</var> be <var>result</var>'s <span
87092
+ data-x="concept-module-script-module-record">module record</span>.</p></li>
87065
87093
87066
87094
<li>
87067
- <p>Otherwise:</p>
87068
-
87069
- <ol>
87070
- <li><p>Let <var>record</var> be <var>result</var>'s <span
87071
- data-x="concept-module-script-module-record">module record</span>.</p></li>
87072
-
87073
- <li>
87074
- <p>Set <var>instantiationStatus</var> to <var>record</var>.<span
87075
- data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span>().</p>
87095
+ <p>Let <var>instantiationStatus</var> be <var>record</var>.<span
87096
+ data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span>().</p>
87076
87097
87077
- <p class="note">This step will recursively call <span
87078
- data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> all of the
87079
- module's uninstantiated dependencies.</p>
87080
- </li>
87081
- </ol>
87098
+ <p class="note">This step will recursively call <span
87099
+ data-x="js-ModuleDeclarationInstantiation">ModuleDeclarationInstantiation</span> all of the
87100
+ module's uninstantiated dependencies.</p>
87082
87101
</li>
87083
87102
87084
87103
<li>
87085
- <p>For each <var>script</var> in <var>result</var>'s <span>uninstantiated inclusive descendant module
87086
- scripts</span>, perform the following steps:</p>
87104
+ <p>For each <var>script</var> in <var>result</var>'s <span>uninstantiated inclusive descendant
87105
+ module scripts</span>, perform the following steps:</p>
87087
87106
87088
87107
<ol>
87089
- <li>
87090
- <p>If <var>instantiationStatus</var> is an abrupt completion, then:</p>
87091
-
87092
- <ol>
87093
- <li><p>Set <var>script</var> <span data-x="concept-module-script-module-record">module
87094
- record</span>'s [[HostDefined]] field to undefined.</p></li>
87095
-
87096
- <li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
87097
- record</span> to null.</p></li>
87098
-
87099
- <li><p>Set <var>script</var>'s <span
87100
- data-x="concept-module-script-instantiation-state">instantiation state</span> to "<code
87101
- data-x="">errored</code>".</p></li>
87102
-
87103
- <li><p>Set <var>script</var>'s <span
87104
- data-x="concept-module-script-instantiation-error">instantiation error</span> to
87105
- <var>instantiationStatus</var>.[[Value]].</p></li>
87106
- </ol>
87107
- </li>
87108
+ <li><p>If <var>instantiationStatus</var> is an abrupt completion, then <span data-x="error a
87109
+ module script">error</span> <var>script</var> with
87110
+ <var>instantiationStatus</var>.[[Value]].</p></li>
87108
87111
87109
87112
<li><p>Otherwise, set <var>script</var>'s <span
87110
- data-x="concept-module-script-instantiation- state">instantiation state</span> to "<code
87113
+ data-x="concept-module-script-state">state</span> to "<code
87111
87114
data-x="">instantiated</code>".</p></li>
87112
87115
</ol>
87113
87116
</li>
@@ -87125,6 +87128,9 @@ interface <dfn>NavigatorOnLine</dfn> {
87125
87128
data-x="module script">module scripts</span> determined as follows:</p>
87126
87129
87127
87130
<ol>
87131
+ <li><p>If <var>script</var>'s <span data-x="concept-module-script-module-record">module
87132
+ record</span> is null, return the empty set.</p></li>
87133
+
87128
87134
<li><p>Let <var>moduleMap</var> be <var>script</var>'s <span>settings object</span>'s
87129
87135
<span data-x="concept-settings-object-module-map">module map</span>.</p></li>
87130
87136
@@ -87183,7 +87189,7 @@ interface <dfn>NavigatorOnLine</dfn> {
87183
87189
</li>
87184
87190
87185
87191
<li><p>Return a <span>set</span> containing all items of <var>inclusive descendants</var> whose
87186
- <span data-x="concept-module-script-instantiation- state">instantiation state</span> is "<code
87192
+ <span data-x="concept-module-script-state">state</span> is "<code
87187
87193
data-x="">uninstantiated</code>".</p></li>
87188
87194
</ol>
87189
87195
@@ -87316,10 +87322,11 @@ interface <dfn>NavigatorOnLine</dfn> {
87316
87322
<ol>
87317
87323
<li><p>Let <var>error</var> be a new <code>TypeError</code> exception.</p></li>
87318
87324
87319
- <li><p><span>Report the exception </span> <var>error </var> for <var>module
87320
- script </var>.</p></li>
87325
+ <li><p><span data-x="error a module script">Error </span> <var>module script </var> with
87326
+ <var>error </var>.</p></li>
87321
87327
87322
- <li><p>Abort this algorithm, and asynchronously complete it with null.</p></li>
87328
+ <li><p>Abort this algorithm, and asynchronously complete it with <var>module
87329
+ script</var>.</p></li>
87323
87330
</ol>
87324
87331
</li>
87325
87332
@@ -87342,10 +87349,25 @@ interface <dfn>NavigatorOnLine</dfn> {
87342
87349
<span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along
87343
87350
while performing the <span>internal module script graph fetching procedure</span>.</p>
87344
87351
87345
- <p>Wait for all of the <span>internal module script graph fetching procedure</span> invocations
87346
- to asynchronously complete. If any of them asynchronously complete with null, then
87347
- asynchronously complete this algorithm with null. Otherwise, asynchronously complete this
87348
- algorithm with <var>module script</var>.</p>
87352
+ <p>These invocations of the <span>internal module script graph fetching procedure</span> should
87353
+ be performed in parallel to each other.</p>
87354
+
87355
+ <p>If any invocation of the <span>internal module script graph fetching procedure</span>
87356
+ asynchronously completes with null, optionally abort all other invocations, and then
87357
+ asynchronously complete this algorithm with null.</p>
87358
+
87359
+ <p>If any invocation of the <span>internal module script graph fetching procedure</span>
87360
+ asynchronously completes with a <span>module script</span> whose <span
87361
+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>",
87362
+ optionally abort all other invocations, and then asynchronously complete this algorithm with
87363
+ <var>module script</var>. (The errored descendant will cause errors later in the module-fetching
87364
+ process, but for now we treat it as a premature "success".)</p>
87365
+
87366
+ <p>Otherwise, wait for all of the <span>internal module script graph fetching procedure</span>
87367
+ invocations to asynchronously complete, with <span data-x="module script">module scripts</span>
87368
+ whose <span data-x="concept-module-script-state">states</span> are not "<code
87369
+ data-x="">errored</code>". Then, asynchronously complete this algorithm with <var>module
87370
+ script</var>.</p>
87349
87371
</li>
87350
87372
</ol>
87351
87373
@@ -87406,9 +87428,19 @@ interface <dfn>NavigatorOnLine</dfn> {
87406
87428
<var>result</var>.[[HostDefined]] will be <var>script</var>.</p>
87407
87429
</li>
87408
87430
87409
- <li><p>If <var>result</var> is a <span>List</span> of errors, <span>report the exception</span>
87410
- given by the first element of <var>result</var> for <var>script</var>, return null, and abort
87411
- these steps.</p></li>
87431
+ <li>
87432
+ <p>If <var>result</var> is a <span>List</span> of errors, then:</p>
87433
+
87434
+ <ol>
87435
+ <li><p><span data-x="error a module script">Error</span> <var>script</var> with
87436
+ <var>errors</var>[0].</p></li>
87437
+
87438
+ <li><p>Return <var>script</var>.</p></li>
87439
+ </ol>
87440
+ </li>
87441
+
87442
+ <li><p>Set <var>script</var>'s <span data-x="concept-module-script-state">state</span> to "<code
87443
+ data-x="">uninstantiated</code>".</p></li>
87412
87444
87413
87445
<li><p>Set <var>script</var>'s <span data-x="concept-module-script-module-record">module
87414
87446
record</span> to <var>result</var>.</p></li>
@@ -87506,14 +87538,12 @@ interface <dfn>NavigatorOnLine</dfn> {
87506
87538
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
87507
87539
not run" then abort these steps.</p></li>
87508
87540
87509
- <li><p>If <var>s</var>'s <span data-x="concept-module-script-instantiation-state">instantiation
87510
- state</span> is "<code data-x="">errored</code>", then <span>report the
87511
- exception</span> given by <var>s</var>'s <span
87512
- data-x="concept-module-script-instantiation-error">instantiation error</span> for <var>s</var>
87513
- and abort these steps.</p></li>
87541
+ <li><p>If <var>s</var>'s <span data-x="concept-module-script-state">state</span> is "<code
87542
+ data-x="">errored</code>", then <span>report the exception</span> given by <var>s</var>'s <span
87543
+ data-x="concept-module-script-error">error</span> for <var>s</var> and abort these
87544
+ steps.</p></li>
87514
87545
87515
- <li><p>Assert: <var>s</var>'s <span
87516
- data-x="concept-module-script-instantiation-state">instantiation state</span> is "<code
87546
+ <li><p>Assert: <var>s</var>'s <span data-x="concept-module-script-state">state</span> is "<code
87517
87547
data-x="">instantiated</code>" (and thus its <span
87518
87548
data-x="concept-module-script-module-record">module record</span> is not null).</p></li>
87519
87549
@@ -87527,13 +87557,24 @@ interface <dfn>NavigatorOnLine</dfn> {
87527
87557
data-x="js-ModuleEvaluation">ModuleEvaluation</span>().</p>
87528
87558
87529
87559
<p class="note">This step will recursively evaluate all of the module's dependencies.</p>
87560
+
87561
+ <p>If <span data-x="js-ModuleEvaluation">ModuleEvaluation</span> fails to complete as a result
87562
+ of the user agent <span data-x="abort a running script">aborting the running script</span>, then
87563
+ set <var>evaluationStatus</var> to Completion { [[Type]]: throw, [[Value]]: a new
87564
+ <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>, [[Target]]: empty }.
87530
87565
</li>
87531
87566
87532
- <li><p>If <var>evaluationStatus</var> is an abrupt completion, then <span>report the
87533
- exception</span> given by <var>evaluationStatus</var>.[[Value]] for <var>s</var>. (Do not perform
87534
- this step if <span data-x="js-ModuleEvaluation">ModuleEvaluation</span> fails to complete as a
87535
- result of the user agent <span data-x="abort a running script">aborting the running
87536
- script</span>.)</p></li>
87567
+ <li>
87568
+ <p>If <var>evaluationStatus</var> is an abrupt completion, then:</p>
87569
+
87570
+ <ol>
87571
+ <li><p><span data-x="error a module script">Error</span> <var>script</var> with
87572
+ <var>evaluationStatus</var>.[[Value]].</p></li>
87573
+
87574
+ <li><p><span>Report the exception</span> given by <var>evaluationStatus</var>.[[Value]] for
87575
+ <var>s</var>.</p>
87576
+ </ol>
87577
+ </li>
87537
87578
87538
87579
<li><p><span>Clean up after running script</span> with <var>settings</var>.</p></li>
87539
87580
</ol>
@@ -88389,9 +88430,9 @@ import "https://example.com/foo/../module2.js";</pre>
88389
88430
steps.</p></li>
88390
88431
88391
88432
<li><p>If <var>resolved module script</var>'s <span
88392
- data-x="concept-module-script-instantiation- state">instantiation state</span> is "<code
88393
- data-x="">errored</code>", then throw <var>resolved module script</var>'s <span
88394
- data-x="concept-module-script-instantiation- error">instantiation error</span>.</p></li>
88433
+ data-x="concept-module-script-state">state</span> is "<code data-x="">errored</code>", then throw
88434
+ <var>resolved module script</var>'s <span
88435
+ data-x="concept-module-script-error">error</span>.</p></li>
88395
88436
88396
88437
<li><p>Assert: <var>resolved module script</var>'s <span
88397
88438
data-x="concept-module-script-module-record">module record</span> is not null.</p></li>
0 commit comments