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 728c268
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -106886,14 +106886,20 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>Let <var>moduleMap</var> be <var>settingsObject</var>'s <span
data-x="concept-settings-object-module-map">module map</span>.</p></li>

<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>
<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 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 +106956,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 +143822,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 728c268

Please sign in to comment.