Skip to content

Commit

Permalink
Don't cache HTTP errors in the import module cache
Browse files Browse the repository at this point in the history
Multiple parallel imports will still only fetch once, and if the fetch
fails, will both error. A subsequent import (dynamic import, a
dynamically inserted via `<script src="..." type="module">`, or a static
import from either of these) to the same specifier will result in a
re-fetch if the previous fetch failed.
  • Loading branch information
lucacasonato committed May 7, 2024
1 parent f499167 commit b94700d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -106888,12 +106888,17 @@ document.querySelector("button").addEventListener("click", bound);

<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] is
"<code data-x="">fetching</code>", wait <span>in parallel</span> until that entry's value
changes, then <span>queue a task</span> on the <span>networking task source</span> to proceed
with running the following steps.</p></li>
changes, then <span>queue a task</span> on the <span>networking task source</span> to run these
steps:</p>

<ol>
<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] <span
data-x="map exists">exists</span>, run <var>onComplete</var> given
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)], and return.</p></li>

<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] <span
data-x="map exists">exists</span>, run <var>onComplete</var> given
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)], and return.</p></li>
<li><p>Run <var>onComplete</var> given null, and return.</p></li>
</ol>
</li>

<li><p><span data-x="map set">Set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to "<code data-x="">fetching</code>".</p></li>
Expand Down Expand Up @@ -106950,8 +106955,8 @@ document.querySelector("button").addEventListener("click", bound);
<span>ok status</span>,</p></li>
</ul>

<p>then <span data-x="map set">set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to null, run <var>onComplete</var> given null, and abort these
<p>then <span data-x="map remove">remove</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)], run <var>onComplete</var> given null, and abort these
steps.</p>
</li>

Expand Down Expand Up @@ -143816,6 +143821,7 @@ INSERT INTERFACES HERE
Logan<!-- on moz irc -->,
Logan Moore,
Loune,
Luca Casonato,
Lucas Gadani,
&#x0141;ukasz Pilorz,
Luke Kenneth Casson Leighton,
Expand Down

0 comments on commit b94700d

Please sign in to comment.