Skip to content

Commit e03cd6b

Browse files
Review by domenic
1 parent 5b989bd commit e03cd6b

File tree

1 file changed

+67
-59
lines changed

1 file changed

+67
-59
lines changed

source

Lines changed: 67 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28932893
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-detacharraybuffer">DetachArrayBuffer</dfn> abstract operation</li>
28942894
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-enumerableownproperties">EnumerableOwnProperties</dfn> abstract operation</li>
28952895
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-finishdynamicimport">FinishDynamicImport</dfn> abstract operation</li>
2896-
<li>The <dfn data-x-href="https://ci.tc39.es/preview/tc39/ecma262/pull/2905/#sec-FinishLoadImportedModule">FinishLoadImportedModule</dfn> abstract operation</li>
2896+
<li>The <dfn data-x-href="https://ci.tc39.es/preview/tc39/ecma262/pull/2905/#sec-FinishLoadingImportedModule">FinishLoadingImportedModule</dfn> abstract operation</li>
28972897
<li>The <dfn data-x="js-OrdinaryFunctionCreate" data-x-href="https://tc39.es/ecma262/#sec-ordinaryfunctioncreate">OrdinaryFunctionCreate</dfn> abstract operation</li>
28982898
<li>The <dfn data-x="js-Get" data-x-href="https://tc39.es/ecma262/#sec-get-o-p">Get</dfn> abstract operation</li>
28992899
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-getactivescriptormodule">GetActiveScriptOrModule</dfn> abstract operation</li>
@@ -93319,7 +93319,7 @@ document.querySelector("button").addEventListener("click", bound);
9331993319
<p>This diagram illustrates how these algorithms relate to the ones above, as well as to each
9332093320
other:</p>
9332193321

93322-
<svg id="module-script-fetching-diagram" viewBox="0 0 1131 256" style="width: 100%;" role="img" aria-label="Fetch an external module script, fetch a modulepreload module script graph, fetch an inline module script graph, and fetch a module worker script graph all call fetch the descendants of and link a module script.">
93322+
<svg id="module-script-fetching-diagram" viewBox="0 0 941 256" style="width: 80%; max-width: 1024px" role="img" aria-label="Fetch an external module script, fetch a modulepreload module script graph, fetch an inline module script graph, and fetch a module worker script graph all call fetch the descendants of and link a module script.">
9332393323
<style>
9332493324
#module-script-fetching-diagram rect {
9332593325
stroke: black;
@@ -93355,45 +93355,45 @@ document.querySelector("button").addEventListener("click", bound);
9335593355
</g>
9335693356
<path d="M90.5,50.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9335793357

93358-
<g transform="translate(380.5,0.5)" class="caller">
93358+
<g transform="translate(190.5,0.5)" class="caller">
9335993359
<rect width="180" height="50"/>
9336093360
<foreignObject width="180" height="50">
9336193361
<span xmlns="http://www.w3.org/1999/xhtml">fetch a modulepreload module script graph</span>
9336293362
</foreignObject>
9336393363
</g>
93364-
<path d="M470.5,50.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
93364+
<path d="M280.5,50.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9336593365

93366-
<g transform="translate(570.5,0.5)" class="caller">
93366+
<g transform="translate(380.5,0.5)" class="caller">
9336793367
<rect width="180" height="50"/>
9336893368
<foreignObject width="180" height="50">
9336993369
<span xmlns="http://www.w3.org/1999/xhtml">fetch an inline module script graph</span>
9337093370
</foreignObject>
9337193371
</g>
93372-
<path d="M660.5,50.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
93372+
<path d="M470.5,50.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9337393373

93374-
<g transform="translate(760.5,0.5)" class="caller">
93374+
<g transform="translate(570.5,0.5)" class="caller">
9337593375
<rect width="180" height="50"/>
9337693376
<foreignObject width="180" height="50">
9337793377
<span xmlns="http://www.w3.org/1999/xhtml">fetch a module worker script graph</span>
9337893378
</foreignObject>
9337993379
</g>
93380-
<path d="M850.5,50.5 L945.5,70.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
93380+
<path d="M660.5,50.5 L755.5,70.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9338193381

93382-
<g transform="translate(950.5,0.5)" class="caller">
93382+
<g transform="translate(760.5,0.5)" class="caller">
9338393383
<rect width="180" height="50"/>
9338493384
<foreignObject width="180" height="50">
9338593385
<span xmlns="http://www.w3.org/1999/xhtml">fetch a worklet script graph</span>
9338693386
</foreignObject>
9338793387
</g>
93388-
<path d="M1040.5,50.5 L945.5,70.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
93388+
<path d="M850.5,50.5 L755.5,70.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9338993389

93390-
<g transform="translate(855.5,70.5)" class="caller">
93390+
<g transform="translate(665.5,70.5)" class="caller">
9339193391
<rect width="180" height="50"/>
9339293392
<foreignObject width="180" height="50">
9339393393
<span xmlns="http://www.w3.org/1999/xhtml">fetch a worklet/module worker script graph</span>
9339493394
</foreignObject>
9339593395
</g>
93396-
<path d="M945.5,120.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
93396+
<path d="M755.5,120.5 L470.5,140.5" marker-end="url(#module-script-fetching-diagram-arrow)"/>
9339793397

9339893398
<g transform="translate(260.5,140.5)" class="subalgorithm">
9339993399
<rect width="420" height="25"/>
@@ -93471,21 +93471,6 @@ document.querySelector("button").addEventListener("click", bound);
9347193471
<p class="note">This step will recursively load all the module transitive dependencies.</p>
9347293472
</li>
9347393473

93474-
<li>
93475-
<p><span>Upon rejection</span> of <var>loading promise</var>, run the
93476-
following steps:</p>
93477-
93478-
<ol>
93479-
<li><p>If <var>state</var>.[[ParseError]] is not null, set <var>module script</var>'s <span
93480-
data-x="concept-script-error-to-rethrow">error to rethrow</span> to
93481-
<var>state</var>.[[ParseError]] and run <var>onComplete</var> given <var>module
93482-
script</var>.</p></li>
93483-
93484-
<!-- loading error -->
93485-
<li><p>Otherwise, run <var>onComplete</var> give null.</p></li>
93486-
</ol>
93487-
</li>
93488-
9348993474
<li>
9349093475
<p><span>Upon fulfillment</span> of <var>loading promise</var>, run the following steps:</p>
9349193476

@@ -93496,13 +93481,32 @@ document.querySelector("button").addEventListener("click", bound);
9349693481
<p class="note">This step will recursively call <span data-x="js-Link">Link</span> on all of
9349793482
the module's unlinked dependencies.</p>
9349893483

93499-
<p>If this throws an exception, set <var>module script</var>'s <span
93484+
<p>If this throws an exception, catch it, and set <var>module script</var>'s <span
9350093485
data-x="concept-script-error-to-rethrow">error to rethrow</span> to that exception.</p>
9350193486
</li>
9350293487

9350393488
<li><p>Run <var>onComplete</var> given <var>module script</var>.</p></li>
9350493489
</ol>
9350593490
</li>
93491+
93492+
<li>
93493+
<p><span>Upon rejection</span> of <var>loading promise</var>, run the
93494+
following steps:</p>
93495+
93496+
<ol>
93497+
<li><p>If <var>state</var>.[[ParseError]] is not null, set <var>module script</var>'s <span
93498+
data-x="concept-script-error-to-rethrow">error to rethrow</span> to
93499+
<var>state</var>.[[ParseError]] and run <var>onComplete</var> given <var>module
93500+
script</var>.</p></li>
93501+
93502+
<li>
93503+
<p>Otherwise, run <var>onComplete</var> given null.</p>
93504+
93505+
<p class="note"><var>state</var>.[[ParseError]] is null when <var>loading promise</var> is
93506+
rejected due to a loading error.</p>
93507+
</li>
93508+
</ol>
93509+
</li>
9350693510
</ol>
9350793511

9350893512
<p>To <dfn>fetch a single module script</dfn>, given a <var>url</var>, a <var>fetch client
@@ -93842,7 +93846,7 @@ document.querySelector("button").addEventListener("click", bound);
9384293846
<p>Run the steps to <span>synchronously replace the rules of a <code>CSSStyleSheet</code></span>
9384393847
on <var>sheet</var> given <var>source</var>.</p>
9384493848

93845-
<p>If this throws an exception, set <var>script</var>'s <span
93849+
<p>If this throws an exception, catch it, and set <var>script</var>'s <span
9384693850
data-x="concept-script-parse-error">parse error</span> to that exception, and return
9384793851
<var>script</var>.</p>
9384893852

@@ -93877,7 +93881,7 @@ document.querySelector("button").addEventListener("click", bound);
9387793881
<li>
9387893882
<p>Let <var>result</var> be <span>ParseJSONModule</span>(<var>source</var>).</p>
9387993883

93880-
<p>If this throws an exception, set <var>script</var>'s <span
93884+
<p>If this throws an exception, catch it, and set <var>script</var>'s <span
9388193885
data-x="concept-script-parse-error">parse error</span> to that exception, and return
9388293886
<var>script</var>.</p>
9388393887
</li>
@@ -95013,13 +95017,19 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
9501395017
».</p></li>
9501495018
</ol>
9501595019

95016-
<h6><dfn>HostLoadImportedModule</dfn>(<var>referrer</var>, <var>moduleRequest</var>,
95017-
<var>loadState</var>, <var>payload</var>)</h6>
95020+
<h6 id="the-hostloadimportedmodule-implementation"><dfn>HostLoadImportedModule</dfn>(<var>referrer</var>,
95021+
<var>moduleRequest</var>, <var>loadState</var>, <var>payload</var>)</h6>
9501895022

9501995023
<p>JavaScript contains an <span>implementation-defined</span> <span
9502095024
data-x="js-HostLoadImportedModule">HostLoadImportedModule</span> abstract operation. User agents
9502195025
must use the following implementation: <ref spec=JAVASCRIPT></p>
9502295026

95027+
<p class="note">This specification expects the second parameter to be a <span>ModuleRequest
95028+
Record</span>, instead of a string as specified by ECMA-262. This is under the assumption that the
95029+
<cite>import assertions</cite> proposal, when updated to use <span>HostLoadImportedModule</span>
95030+
instead of the previous module loading hooks, will update the abstract operation passing a
95031+
<span>ModuleRequest Record</span>. <ref spec=JSIMPORTASSERTIONS></p>
95032+
9502395033
<ol>
9502495034
<li><p>Let <var>settings object</var> be the <span>current settings object</span>.</p></li>
9502595035

@@ -95028,16 +95038,14 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
9502895038
object</span> implements <code>WorkletGlobalScope</code> or <code>ServiceWorkerGlobalScope</code>
9502995039
and <var>loadState</var> is undefined, then:</p>
9503095040

95031-
<p class="note">
95032-
<var>loadState</var> is undefined when the current fetching process has been initiated by a
95033-
dynamic <code data-x="">import()</code> call.
95034-
</p>
95041+
<p class="note"><var>loadState</var> is undefined when the current fetching process has been
95042+
initiated by a dynamic <code>import()</code> call.</p>
9503595043

9503695044
<ol>
95037-
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
95045+
<li><p>Let <var>completion</var> be the <span>Completion Record</span> { [[Type]]: throw, [[Value]]: a new
9503895046
<code>TypeError</code>, [[Target]]: empty }.</p></li>
9503995047

95040-
<li><p>Perform <span>FinishLoadImportedModule</span>(<var>referrer</var>,
95048+
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
9504195049
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
9504295050

9504395051
<li><p>Return.</p></li>
@@ -95070,7 +95078,7 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
9507095078
<var>referencing script</var>'s <span data-x="concept-script-script-fetch-options">fetch
9507195079
options</span>.</p></li>
9507295080

95073-
<li><p>Assert: Neither <var>base URL</var> nor <var>fetch options</var> is null, as
95081+
<li><p>Assert: neither <var>base URL</var> nor <var>fetch options</var> is null, as
9507495082
<var>referencing script</var> is a <span>classic script</span> or a <span>JavaScript module
9507595083
script</span>.</p></li>
9507695084

@@ -95099,49 +95107,49 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
9509995107
</div>
9510095108
</li>
9510195109

95102-
<li><p>Let <var>destination</var> be "script".</p></li>
95110+
<li><p>Let <var>destination</var> be <code data-x="">"script"</code>.</p></li>
9510395111

95104-
<li><p>If <var>loadState</var> is not undefined, set <var>destination</var> to
95112+
<li><p>If <var>loadState</var> is not undefined, then set <var>destination</var> to
9510595113
<var>loadState</var>.[[Destination]].</p></li>
9510695114

9510795115
<li>
9510895116
<p><span>Fetch a single imported module script</span> given <var>settings object</var>,
9510995117
<var>base URL</var>, <var>destination</var>, <var>fetch options</var>, <var>fetch
95110-
referrer</var>, <var>moduleRequest</var>, and with the following steps given <var>module
95111-
script</var>:</p>
95118+
referrer</var>, <var>moduleRequest</var>, and <var>onSingleFetchComplete</var> as defined below.
95119+
If <var>loadState</var> is not undefined and <var>loadState</var>.[[PerformTheFetch]] is not
95120+
null, pass <var>loadState</var>.[[PerformTheFetch]] along as well.</p>
95121+
95122+
<p><var>onSingleFetchComplete</var> given <var>moduleScript</var> is the following
95123+
algorithm:</p>
9511295124

9511395125
<ol>
95114-
<li><p>If <var>module script</var> is null, then let <var>completion</var> be Completion {
95115-
[[Type]]: throw, [[Value]]: a new <code>TypeError</code>, [[Target]]: empty }.</p></li>
95126+
<li><p>If <var>moduleScript</var> is null, then let <var>completion</var> be the
95127+
<span>Completion Record</span> { [[Type]]: throw, [[Value]]: a new <code>TypeError</code>,
95128+
[[Target]]: empty }.</p></li>
9511695129

9511795130
<li>
95118-
<p>Otherwise, if <var>module script</var>'s <span data-x="concept-script-parse-error">parse
95131+
<p>Otherwise, if <var>moduleScript</var>'s <span data-x="concept-script-parse-error">parse
9511995132
error</span> is not null, then:</p>
9512095133

9512195134
<ol>
95122-
<li><p>Let <var>parse error</var> be <var>module script</var>'s <span
95135+
<li><p>Let <var>parseError</var> be <var>moduleScript</var>'s <span
9512395136
data-x="concept-script-parse-error">parse error</span>.</p></li>
9512495137

95125-
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: <var>parse
95126-
error</var>, [[Target]]: empty }.</p></li>
95138+
<li><p>Let <var>completion</var> be the <span>Completion Record</span> { [[Type]]: throw,
95139+
[[Value]]: <var>parseError</var>, [[Target]]: empty }.</p></li>
9512795140

9512895141
<li><p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[ParseError]] is
95129-
null, set <var>loadState</var>.[[ParseError]] to <var>parse error</var>.</p></li>
95142+
null, set <var>loadState</var>.[[ParseError]] to <var>parseError</var>.</p></li>
9513095143
</ol>
9513195144
</li>
9513295145

95133-
<li><p>Otherwise, let <var>completion</var> be Completion { [[Type]]: normal, [[Value]]:
95134-
<var>result</var>'s <span data-x="concept-script-record">record</span>, [[Target]]: empty
95135-
}.</p></li>
95146+
<li><p>Otherwise, let <var>completion</var> be the <span>Completion Record</span> { [[Type]]:
95147+
normal, [[Value]]: <var>result</var>'s <span data-x="concept-script-record">record</span>,
95148+
[[Target]]: empty }.</p></li>
9513695149

95137-
<li><p>Perform <span>FinishLoadImportedModule</span>(<var>referrer</var>,
95150+
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
9513895151
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
9513995152
</ol>
95140-
95141-
<p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[PerformTheFetch]] is not
95142-
null, pass <var>loadState</var>.[[PerformTheFetch]] as <span>fetch a single imported module
95143-
script</span>'s custom <span data-x="fetching-scripts-perform-fetch">perform the fetch</span>
95144-
steps.</p>
9514595153
</li>
9514695154
</ol>
9514795155

0 commit comments

Comments
 (0)