Skip to content

Commit

Permalink
Differentiate fetch referrer between static and dynamic imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 28, 2022
1 parent c75dae4 commit b73221e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -93636,7 +93636,7 @@ document.querySelector("button").addEventListener("click", bound);
</ol>

<p>To <dfn>fetch a single imported module script</dfn>, given a <var>settings object</var>, a
<var>base URL</var>, a <var>destination</var>, some <var>options</var>, a
<var>base URL</var>, a <var>destination</var>, some <var>options</var>, a <var>referrer</var>, a
<var>moduleRequest</var>, and an <var>onComplete</var> algorithm, run these steps.
<var>onComplete</var> must be an algorithm accepting null (on failure) or a <span>module
script</span> (on success).</p>
Expand All @@ -93662,8 +93662,8 @@ document.querySelector("button").addEventListener("click", bound);

<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>settings
object</var>, <var>destination</var>, <var>options</var>, <var>settings object</var>,
"<code data-x="">client</code>", <var>moduleRequest</var>, with the <var>top-level module
fetch flag</var> unset, and with <var>onComplete</var>.</p></li>
<var>referrer</var>, <var>moduleRequest</var>, with the <var>top-level module fetch flag</var>
unset, and with <var>onComplete</var>.</p></li>
</ol>

<h5 id="creating-scripts">Creating scripts</h5>
Expand Down Expand Up @@ -95046,6 +95046,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Let <var>fetch options</var> be the <span>default classic script fetch
options</span>.</p></li>

<li><p>Let <var>fetch referrer</var> be "<code data-x="">client</code>".</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>
Expand All @@ -95067,6 +95069,15 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Assert: Neither <var>base URL</var> nor <var>fetch options</var> is null, as
<var>referencing script</var> is a <span>classic script</span> or a <span>JavaScript module
script</span>.</p></li>

<li>
<p>If <var>loadState</var> is not undefined, set <var>fetch referrer</var> to <var>base
URL</var>.</p>

<p class="XXX">We check <var>loadState</var> to not propagate the referrer when using dynamic
imports. <a href="https://github.com/whatwg/html/issues/3744">Issue #3744</a> looks into
aligning dynamic imports with static imports.</p>
</li>
</ol>

<div class="example">
Expand All @@ -95091,8 +95102,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>

<li>
<p><span>Fetch a single imported module script</span> given <var>settings object</var>,
<var>base URL</var>, <var>destination</var>, <var>fetch options</var>, <var>moduleRequest</var>,
and with the following steps given <var>module script</var>:</p>
<var>base URL</var>, <var>destination</var>, <var>fetch options</var>, <var>fetch
referrer</var>, <var>moduleRequest</var>, and with the following steps given <var>module
script</var>:</p>

<ol>
<li><p>If <var>module script</var> is null, then let <var>completion</var> be Completion {
Expand Down

0 comments on commit b73221e

Please sign in to comment.