Skip to content

Commit

Permalink
Split descendant script fetch options into its own algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavweiss committed Apr 13, 2024
1 parent 50ff448 commit 2ead28f
Showing 1 changed file with 37 additions and 21 deletions.
58 changes: 37 additions & 21 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -106273,12 +106273,25 @@ document.querySelector("button").addEventListener("click", bound);
<span data-x="concept-script-fetch-options-fetch-priority">fetch priority</span>.</p></dd>
</dl>

<p>For any given <span>script fetch options</span> <var>options</var>, the <dfn>descendant script
fetch options</dfn> are a new <span>script fetch options</span> whose <span data-x="struct
item">items</span> all have the same values, except for the <span
data-x="concept-script-fetch-options-integrity">integrity metadata</span>, which is instead the
empty string, and the <span data-x="concept-script-fetch-options-fetch-priority">fetch
priority</span>, which is instead "<code data-x="">auto</code>".</p>
<p>To <dfn>get the descendant script fetch options</dfn> given a <span>script fetch options</span>
<var>options</var>, a <span>URL</span> <var>url</var>, and an <span>environment settings
object</span> <var>settingsObject</var>, do the following:
<ol>
<li><p>Let <var>fetchOptions</var> be a copy of <var>script fetch options</var>.</p></li>

<li><p>Let <var>integrity</var> be the result of calling <span>resolving a module integrity
metadata</span> with <var>url</var> and <var>settingsObject</var>.</p></li>

<li><p>Set <var>fetchOptions</var>'s <span
data-x="concept-script-fetch-options-integrity">integrity metadata</span> to
<var>integrity</var>.</p></li>

<li><p>Set <var>fetchOptions</var>'s <span
data-x="concept-script-fetch-options-fetch-priority">fetch priority</span> to "<code
data-x="">auto</code>".</p>

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

<hr>

Expand Down Expand Up @@ -108579,7 +108592,7 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
data-x="concept-import-map-imports">imports</span> are <var>sortedAndNormalizedImports</var>,
whose <span data-x="concept-import-map-scopes">scopes</span> are
<var>sortedAndNormalizedScopes</var>, and whose <span
data-x="concept-import-map-integrity">integrity</span> are
data-x="concept-import-map-integrity">integrity</span> are
<var>normalizedIntegrity</var>.</p></li>
</ol>

Expand Down Expand Up @@ -108740,7 +108753,7 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
<var>originalMap</var>:</p>

<ol>
<li><p>Let <var>normalizedSpecifierKey</var> be the result of <span>resolve a URL-like module
<li><p>Let <var>normalizedSpecifierKey</var> be the result of <span>resolving a URL-like module
specifier</span> given <var>specifierKey</var> and <var>baseURL</var>.</p></li>

<li><p>If <var>normalizedSpecifierKey</var> is null, then <span>continue</span>.</p></li>
Expand Down Expand Up @@ -109411,14 +109424,6 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Set <var>settingsObject</var> to <var>referencingScript</var>'s <span
data-x="concept-script-settings-object">settings object</span>.</p></li>

<li><p>Set <var>fetchOptions</var> to the new <span>descendant script fetch options</span> for
<var>referencingScript</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span>.</p></li>

<li><p><span>Assert</span>: <var>fetchOptions</var> is not null, as
<var>referencingScript</var> is a <span>classic script</span> or a <span>JavaScript module
script</span>.</p></li>

<li><p>Set <var>fetchReferrer</var> to <var>referrer</var>'s <span
data-x="concept-script-base-url">base URL</span>.</p></li>
</ol>
Expand All @@ -109445,6 +109450,22 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<var>moduleRequest</var>.[[Specifier]], catching any exceptions. If they throw an exception, let
<var>resolutionError</var> be the thrown exception.</p></li>

<li>
<p>If <var>referrer</var> is a <span>Script Record</span> or a <span data-x="Cyclic Module
Record">Module Record</span>, then:</p>

<ol>
<li><p>Set <var>fetchOptions</var> to the result of calling <span>get the descendant script
fetch options</span> with <var>referencingScript</var>'s <span
data-x="concept-script-script-fetch-options">fetch options</span>, <var>settingsObject</var>
and <var>url</var>.</p></li>

<li><p><span>Assert</span>: <var>fetchOptions</var> is not null, as
<var>referencingScript</var> is a <span>classic script</span> or a <span>JavaScript module
script</span>.</p></li>
</ol>
</li>

<li>
<p>If the previous step threw an exception, then:</p>

Expand All @@ -109459,11 +109480,6 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
</ol>
</li>

<li><p>Set <var>fetchOptions</var>'s <span
data-x="concept-script-fetch-options-integrity">integrity metadata</span> to the result of
calling <span>resolving a module integrity metadata</span> with <var>url</var> and
<var>settingsObject</var>.</p></li>

<li><p>Let <var>destination</var> be <code data-x="">"script"</code>.</p></li>

<li><p>Let <var>fetchClient</var> be <var>settingsObject</var>.</p></li>
Expand Down

0 comments on commit 2ead28f

Please sign in to comment.