Skip to content

Commit 34933d4

Browse files
committed
Allow modulepreload to work for all module types without needing to specify type at the point of preload. Achieve this by adding 'module type must match' flag to 'fetch a single module script', which is unset only in the case of modulepreload.
1 parent 27ebcf4 commit 34933d4

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

source

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86778,10 +86778,10 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8677886778
<ol>
8677986779
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>settings
8678086780
object</var>, "<code data-x="">script</code>", <var>options</var>, <var>settings object</var>,
86781-
"<code data-x="">client</code>", and with the <var>top-level module fetch flag</var> set. If the
86782-
caller of this algorithm specified custom <span data-x="fetching-scripts-perform-fetch">perform
86783-
the fetch</span> steps, pass those along as well. Wait until the algorithm asynchronously
86784-
completes with <var>result</var>.</p></li>
86781+
"<code data-x="">client</code>", with the <var>module type must match</var> flag set, and with
86782+
the <var>top-level module fetch flag</var> set. If the caller of this algorithm specified custom
86783+
<span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along as
86784+
well. Wait until the algorithm asynchronously completes with <var>result</var>.</p></li>
8678586785

8678686786
<li><p>If <var>result</var> is null, asynchronously complete this algorithm with null, and abort
8678786787
these steps.</p></li>
@@ -86810,10 +86810,11 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8681086810

8681186811
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>settings
8681286812
object</var>, "<code data-x="">script</code>", <var>options</var>, <var>settings object</var>,
86813-
"<code data-x="">client</code>", <var>moduleRequest</var>, and with the <var>top-level module
86814-
fetch flag</var> set. If the caller of this algorithm specified custom <span
86815-
data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along as well.
86816-
Wait until the algorithm asynchronously completes with <var>result</var>.</p></li>
86813+
"<code data-x="">client</code>", <var>moduleRequest</var>, with the <var>module type must
86814+
match</var> flag set, and with the <var>top-level module fetch flag</var> set. If the caller of
86815+
this algorithm specified custom <span data-x="fetching-scripts-perform-fetch">perform the
86816+
fetch</span> steps, pass those along as well. Wait until the algorithm asynchronously completes
86817+
with <var>result</var>.</p></li>
8681786818

8681886819
<li><p>If <var>result</var> is null, asynchronously complete this algorithm with null, and abort
8681986820
these steps.</p></li>
@@ -86835,14 +86836,15 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8683586836
<ol>
8683686837
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>settings
8683786838
object</var>, <var>destination</var>, <var>options</var>, <var>settings object</var>, "<code
86838-
data-x="">client</code>", and with the <var>top-level module fetch</var> flag set. Wait until
86839-
algorithm asynchronously completes with <var>result</var>.</p></li>
86839+
data-x="">client</code>", with the <var>module type must match</var> flag unset, and with the
86840+
<var>top-level module fetch</var> flag set. Wait until algorithm asynchronously completes with
86841+
<var>result</var>.</p></li>
8684086842

8684186843
<li><p>Asynchronously complete this algorithm with <var>result</var>, but do <em>not</em> abort
8684286844
these steps.</p></li>
8684386845

8684486846
<li>
86845-
<p>Optionally, perform the following steps:</p>
86847+
<p>If <var>result</var> is not null, optionally perform the following steps:</p>
8684686848

8684786849
<ol>
8684886850
<li><p>Let <var>visited set</var> be « <var>url</var> ».</p></li>
@@ -86900,10 +86902,10 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8690086902

8690186903
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>fetch client settings
8690286904
object</var>, <var>destination</var>, <var>options</var>, <var>module map settings object</var>,
86903-
"<code data-x="">client</code>", and with the <var>top-level module fetch flag</var> set. If the
86904-
caller of this algorithm specified custom <span data-x="fetching-scripts-perform-fetch">perform
86905-
the fetch</span> steps, pass those along as well. Wait until the algorithm asynchronously
86906-
completes with <var>result</var>.</p></li>
86905+
"<code data-x="">client</code>", with the <var>module type must match</var> flag set, and with
86906+
the <var>top-level module fetch flag</var> set. If the caller of this algorithm specified custom
86907+
<span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along as
86908+
well. Wait until the algorithm asynchronously completes with <var>result</var>.</p></li>
8690786909

8690886910
<li><p>If <var>result</var> is null, asynchronously complete this algorithm with null, and abort
8690986911
these steps.</p></li>
@@ -87168,10 +87170,11 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8716887170

8716987171
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>fetch client settings
8717087172
object</var>, <var>destination</var>, <var>options</var>, <var>module map settings object</var>,
87171-
<var>referrer</var>, <var>moduleRequest</var>, and with the
87172-
<var>top-level module fetch flag</var> unset. If the caller of this algorithm specified custom
87173-
<span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along
87174-
while <span data-x="fetch a single module script">fetching a single module script</span>.</p>
87173+
<var>referrer</var>, <var>moduleRequest</var>, with the <var>module type must match</var> flag
87174+
set, and with the <var>top-level module fetch flag</var> unset. If the caller of this algorithm
87175+
specified custom <span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps,
87176+
pass those along while <span data-x="fetch a single module script">fetching a single module
87177+
script</span>.</p>
8717587178

8717687179
<li><p>Return from this algorithm, and run the following steps when <span data-x="fetch a single
8717787180
module script">fetching a single module script</span> asynchronously completes with
@@ -87190,9 +87193,10 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8719087193

8719187194
<p>To <dfn>fetch a single module script</dfn>, given a <var>url</var>, a <var>fetch client
8719287195
settings object</var>, a <var>destination</var>, some <var>options</var>, a <var>module map
87193-
settings object</var>, a <var>referrer</var>, an optional <var>moduleRequest</var>, and
87194-
a <var>top-level module fetch</var> flag, run these steps. The algorithm will asynchronously
87195-
complete with either null (on failure) or a <span>module script</span> (on success).</p>
87196+
settings object</var>, a <var>referrer</var>, an optional <var>moduleRequest</var>, a
87197+
<var>module type must match</var> flag, and a <var>top-level module fetch</var> flag, run these
87198+
steps. The algorithm will asynchronously complete with either null (on failure) or a
87199+
<span>module script</span> (on success).</p>
8719687200

8719787201
<ol>
8719887202
<li>
@@ -87221,6 +87225,8 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8722187225
with <var>moduleMap</var>[<var>url</var>], and abort these steps.</p>
8722287226

8722387227
<ul>
87228+
<li><p>The <var>module type must match</var> flag is unset.</p></li>
87229+
8722487230
<li><p><var>moduleMap</var>[<var>url</var>] is a <span>JavaScript module script</span>
8722587231
and <var>module type</var> is undefined.</p></li>
8722687232

@@ -87315,8 +87321,8 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8731587321
<p>If <var>MIME type</var> is a <span>JavaScript MIME type</span>, then:</p>
8731687322

8731787323
<ol>
87318-
<li><p>If <var>module type</var> is not undefined, asynchronously complete this algorithm with
87319-
null, and abort these steps.</p></li>
87324+
<li><p>If the <var>module type must match</var> flag is set and <var>module type</var> is not
87325+
undefined, asynchronously complete this algorithm with null, and abort these steps.</p></li>
8732087326

8732187327
<li><p>Let <var>source text</var> be the result of <span data-x="UTF-8 decode">UTF-8
8732287328
decoding</span> <var>response</var>'s <span data-x="concept-response-body">body</span>.</p></li>
@@ -87331,8 +87337,9 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8733187337
<li>
8733287338
<p>If <var>MIME type</var> is a <span>JSON MIME type</span>, then:</p>
8733387339
<ol>
87334-
<li><p>If <var>module type</var> is not <code data-x="">"json"</code>, asynchronously complete
87335-
this algorithm with null, and abort these steps.</p></li>
87340+
<li><p>If the <var>module type must match</var> flag is set and <var>module type</var> is not
87341+
<code data-x="">"json"</code>, asynchronously complete this algorithm with null, and abort
87342+
these steps.</p></li>
8733687343

8733787344
<li><p>Let <var>source text</var> be the result of <span data-x="UTF-8 decode">UTF-8
8733887345
decoding</span> <var>response</var>'s <span data-x="concept-response-body">body</span>.</p></li>

0 commit comments

Comments
 (0)