Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 32 additions & 17 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -117115,11 +117115,11 @@ document.querySelector("button").addEventListener("click", bound);

<div algorithm>
<p>To <dfn>fetch a modulepreload module script graph</dfn> given a <span>URL</span> <var>url</var>,
a <span data-x="concept-request-destination">destination</span> <var>destination</var>, an
<span>environment settings object</span> <var>settingsObject</var>, a <span>script fetch
options</span> <var>options</var>, and an algorithm <var>onComplete</var>, run these steps.
<var>onComplete</var> must be an algorithm accepting null (on failure) or a <span>module
script</span> (on success).</p>
a <span data-x="concept-request-destination">destination</span> <var>destination</var>,
an <span>environment settings object</span> <var>settingsObject</var>, a
<span>script fetch options</span> <var>options</var>, and an algorithm <var>onComplete</var>, run
these steps. <var>onComplete</var> must be an algorithm accepting null (on failure) or a
<span>module script</span> (on success).</p>

<ol>
<li>
Expand Down Expand Up @@ -117437,18 +117437,15 @@ document.querySelector("button").addEventListener("click", bound);
data-x="concept-request-destination">destination</span> <var>destination</var>, a <span>script
fetch options</span> <var>options</var>, an <span>environment settings object</span>
<var>settingsObject</var>, a <span data-x="concept-request-referrer">referrer</span>
<var>referrer</var>, an optional <span>ModuleRequest Record</span> <var>moduleRequest</var>, a
boolean <var data-x="fetching-scripts-is-top-level">isTopLevel</var>, an algorithm
<var>onComplete</var>, and an optional <span data-x="fetching-scripts-perform-fetch">perform the
fetch hook</span> <var>performFetch</var>, run these steps. <var>onComplete</var> must be an
algorithm accepting null (on failure) or a <span>module script</span> (on success).</p>
<var>referrer</var>, a boolean <var data-x="fetching-scripts-is-top-level">isTopLevel</var>, an
algorithm <var>onComplete</var>, and an optional <span
data-x="fetching-scripts-perform-fetch">perform the fetch hook</span><var>performFetch</var>, run
these steps. <var>onComplete</var> must be an algorithm accepting null (on failure) or a
<span>module script</span> (on success).</p>

<ol>
<li><p>Let <var>moduleType</var> be "<code data-x="">javascript-or-wasm</code>".</p></li>

<li><p>If <var>moduleRequest</var> was given, then set <var>moduleType</var> to the result of
running the <span>module type from module request</span> steps given
<var>moduleRequest</var>.</p></li>
<li><p>Let <var>moduleType</var> be the result of running
<span>module type from fetch destination</span> on <var>destination</var>.</p></li>
Comment on lines +117447 to +117448
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this wont cover all the cases. When fetching a single imported module script, destination will either be script or the value stored inside LoadState (eg. worker, sharedworker).
We still need to resolve moduleType from moduleRequest record in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module type from fetch destination currently covers that, because the default case there is "javascript-or-wasm", which all of those request destinations are (worker, sharedworker), right?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, moduleType will be javascript-or-wasm even when fetching json or css modules. That's because moduleType is determined by the moduleRequest record not by the top-level destination.


<li><p><span>Assert</span>: the result of running the <span>module type allowed</span> steps
given <var>moduleType</var> and <var>settingsObject</var> is true. Otherwise, we would not have
Expand Down Expand Up @@ -117616,8 +117613,8 @@ document.querySelector("button").addEventListener("click", bound);

<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>fetchClient</var>,
<var>destination</var>, <var>options</var>, <var>settingsObject</var>, <var>referrer</var>,
<var>moduleRequest</var>, false, and <var>onComplete</var>. If <var>performFetch</var> was given,
pass it along as well.</p></li>
false, and <var>onComplete</var>. If <var>performFetch</var> was given, pass it along as
well.</p></li>
</ol>
</div>

Expand Down Expand Up @@ -117972,6 +117969,24 @@ document.querySelector("button").addEventListener("click", bound);
</ol>
</div>

<div algorithm>
<p>The <dfn>module type from fetch destination</dfn> steps, given a <span
data-x="concept-request-destination">destination</span> <var>destination</var>are as follows:</p>

<p>Switch on <var>destination</var>:

<dl class="switch">
<dt>"<code data-x="">json</code>"</dt>
<dd>Return "<code data-x="">json</code>".</dd>

<dt>"<code data-x="">style</code>"</dt>
<dd>Return "<code data-x="">css</code>".</dd>

<dt>Otherwise</dt>
<dd>Return "<code data-x="">javascript-or-wasm</code>".</dd>
</dl>
</div>

<h5 id="calling-scripts">Calling scripts</h5>

<div algorithm>
Expand Down