Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't cache HTTP errors in the module map #10327

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
53 changes: 36 additions & 17 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -106886,17 +106886,16 @@ 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 a
lucacasonato marked this conversation as resolved.
Show resolved Hide resolved
<span>module script</span> or null, 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
<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] is a <span>list</span>,
<span data-x="list append">append</span> <var>onComplete</var> to
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)], and return.</p></li>
lucacasonato marked this conversation as resolved.
Show resolved Hide resolved

<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>
<var>moduleType</var>)] to « <var>onComplete</var> ».</p></li>

<li><p>Let <var>request</var> be a new <span data-x="concept-request">request</span> whose
<span data-x="concept-request-url">URL</span> is <var>url</var>, <span
Expand Down Expand Up @@ -106950,9 +106949,20 @@ 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
steps.</p>
<p>then:</p>

<ol>
<li><p>Let <var>callbacks</var> be
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)].</p></li>

<li><p><span data-x="map remove">Remove</span>
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)].</p></li>

<li><p><span data-x="list iterate">For each</span> <var>callback</var> in
<var>callbacks</var>, run <var>callback</var> given null.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p>Let <var>sourceText</var> be the result of <span data-x="UTF-8 decode">UTF-8
Expand Down Expand Up @@ -106988,17 +106998,24 @@ document.querySelector("button").addEventListener("click", bound);
the result of <span>creating a JSON module script</span> given <var>sourceText</var> and
<var>settingsObject</var>.</p></li>

<li><p>Let <var>callbacks</var> be
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)].</p></li>

<li>
<p><span data-x="map set">Set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to <var>moduleScript</var>, and run <var>onComplete</var> given
<var>moduleScript</var>.</p>
<p>If <var>moduleScript</var> is null, then <span data-x="map remove">remove</span>
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)], otherwise
<span data-x="map set">set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to <var>moduleScript</var>.</p>

<p class="note">It is intentional that the <span>module map</span> is keyed by the <span
data-x="concept-request-url">request URL</span>, whereas the <span
data-x="concept-script-base-url">base URL</span> for the <span>module script</span> is
set to the <span data-x="concept-response-url">response URL</span>. The former is used to
deduplicate fetches, while the latter is used for URL resolution.</p>
</li>

<li><p><span data-x="list iterate">For each</span> <var>callback</var> in
<var>callbacks</var>, run <var>callback</var> given <var>moduleScript</var>.</p></li>
</ol>
</li>
</ol>
Expand Down Expand Up @@ -109083,10 +109100,11 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
The <span>URL record</span> is the <span data-x="concept-request-url">request URL</span> at which
the module was fetched, and the <span>string</span> indicates the type of the module (e.g. "<code
data-x="">javascript</code>"). The <span>module map</span>'s values are either a <span>module
script</span>, null (used to represent failed fetches), or a placeholder value "<code
data-x="">fetching</code>". </span><span data-x="module map">Module maps</span> are used to ensure
that imported module scripts are only fetched, parsed, and evaluated once per
<code>Document</code> or <a href="#workers">worker</a>.</p>
script</span>, null (used to represent a mismatched <span>MIME type</span>), or a
<span>list</span> of algorithms (that are waiting for the fetch to complete).</span> <span
data-x="module map">Module maps</span> are used to ensure that imported module scripts are only
fetched, parsed, and evaluated once per <code>Document</code> or <a
href="#workers">worker</a>.</p>

<div class="example">
<p>Since <span data-x="module map">module maps</span> are keyed by (URL, module type), the
Expand Down Expand Up @@ -143816,6 +143834,7 @@ INSERT INTERFACES HERE
Logan<!-- on moz irc -->,
Logan Moore,
Loune,
Luca Casonato,
Lucas Gadani,
&#x0141;ukasz Pilorz,
Luke Kenneth Casson Leighton,
Expand Down
Loading