Skip to content

Commit

Permalink
Fix fetch referrer of static imports triggered by dynamic imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 6, 2022
1 parent 244b964 commit 2f8fa0d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -95897,7 +95897,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
and <var>loadState</var> is undefined, then:</p>

<p class="note"><var>loadState</var> is undefined when the current fetching process has been
initiated by a dynamic <code>import()</code> call.</p>
initiated by a dynamic <code>import()</code> call, either directly or when loading the
transitive dependencies of the dynamically imported module.</p>

<ol>
<li><p>Let <var>completion</var> be the <span>Completion Record</span> { [[Type]]: throw, [[Value]]: a new
Expand Down Expand Up @@ -95935,12 +95936,21 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<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>referrer</var>'s <span data-x="concept-script-base-url">base URL</span>.</p>
<p>If none of the following conditions is true</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>
<ul class="brief">
<li><var>referrer</var> is a <span>Script Record</span></li>

<li><var>referrer</var> is a <span data-x="Cyclic Module Record">Module Record</span> and
<var>referrer</var>.[[Status]] is one of evaluating, evaluating-async or evaluated</li>
</ul>

<p>then set <var>fetch referrer</var> to <var>referrer</var>'s <span
data-x="concept-script-base-url">base URL</span>.</p>

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

Expand Down

0 comments on commit 2f8fa0d

Please sign in to comment.