Skip to content

Commit

Permalink
Make import statements set the importing script as the referrer
Browse files Browse the repository at this point in the history
Fixes #1150. Previously, they would set the top-level document (that
requested the root of the module script tree) as the referrer. This
makes more sense, being for example consistent with CSS @import.
  • Loading branch information
domenic committed May 17, 2016
1 parent 176e742 commit 3d0f0f2
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -85978,23 +85978,26 @@ interface <dfn>NavigatorOnLine</dfn> {

<p>To <dfn>fetch a module script tree</dfn> given a <var>url</var>, a <var>credentials mode</var>,
a <var>cryptographic nonce</var>, a <var>parser state</var>, a <var>destination</var>, a
<var>fetch client settings object</var>, and an optional <var>ancestor list</var> and <var>module
map settings object</var>, run these steps. The algorithm will asynchronously complete with either
null (on failure) or a <span>module script</span> (on success).</p>
<var>fetch client settings object</var>, and optional <var>module map settings object</var>,
<var>ancestor list</var>, and <var>referrer</var>, run these steps. The algorithm will
asynchronously complete with either null (on failure) or a <span>module script</span> (on
success).</p>

<ol>
<li><p>If <var>ancestor list</var> is not given, let it be an empty list.</p></li>

<li><p>If <var>module map settings object</var> is not given, let it be <var>fetch client
settings object</var>.</p></li>

<li><p>If <var>ancestor list</var> is not given, let it be an empty list.</p></li>

<li><p>If <var>referrer</var> is not given, let it be "<code data-x="">client</code>".</p>

<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>credentials
mode</var>, <var>cryptographic nonce</var>, <var>parser state</var>, <var>destination</var>,
<var>fetch client settings object</var>, and <var>module map settings object</var>. If the caller
of this algorithm specified custom <span data-x="fetching-scripts-set-up-request">set up the
request</span> or <span data-x="fetching-scripts-process-response">process the response</span>
steps, pass those along while <span data-x="fetch a single module script">fetching a single
module script</span>.</p>
<var>fetch client settings object</var>, <var>module map settings object</var>, and
<var>referrer</var>. If the caller of this algorithm specified custom <span
data-x="fetching-scripts-set-up-request">set up the request</span> or <span
data-x="fetching-scripts-process-response">process the response</span> steps, pass those along
while <span data-x="fetch a single module script">fetching a single module script</span>.</p>

<li><p>Return from this algorithm, and run the following steps when <span data-x="fetch a single
module script">fetching a single module script</span> asynchronously completes with
Expand Down Expand Up @@ -86058,8 +86061,9 @@ interface <dfn>NavigatorOnLine</dfn> {
data-x="concept-module-script-credentials-mode">credentials mode</span>, <var>module
script</var>'s <span data-x="concept-module-script-nonce">cryptographic nonce</span>,
<var>module script</var>'s <span data-x="concept-module-script-parser">parser state</span>,
<var>destination</var>, <var>module script</var>'s <span>settings object</span>, and
<var>ancestor list</var>.</p>
<var>destination</var>, <var>module script</var>'s <span>settings object</span>, <var>module
script</var>'s <span>settings object</span>, <var>ancestor list</var>, and <var>module
script</var>'s <span data-x="concept-module-script-base-url">base URL</span>.</p>

<p class="note">It is intentional that no custom <span
data-x="fetching-scripts-set-up-request">set up the request</span> or <span
Expand All @@ -86078,9 +86082,9 @@ interface <dfn>NavigatorOnLine</dfn> {

<p>To <dfn>fetch a single module script</dfn>, given a <var>url</var>, a <var>credentials
mode</var>, a <var>cryptographic nonce</var>, a <var>parser state</var>, a <var>destination</var>,
a <var>fetch client settings object</var>, and a <var>module map settings object</var>, run these
steps. The algorithm will asynchronously complete with either null (on failure) or a <span>module
script</span> (on success).</p>
a <var>fetch client settings object</var>, a <var>module map settings object</var>, and a
<var>referrer</var>, run these steps. The algorithm will asynchronously complete with either null
(on failure) or a <span>module script</span> (on success).</p>

<ol>
<li><p>Let <var>module map</var> be <var>module map settings object</var>'s <span>module
Expand All @@ -86104,8 +86108,10 @@ interface <dfn>NavigatorOnLine</dfn> {
data-x="concept-request-credentials-mode">credentials mode</span> is <var>credentials
mode</var>, <span data-x="concept-request-nonce-metadata">cryptographic nonce metadata</span> is
<var>cryptographic nonce</var>, <span data-x="concept-request-parser-metadata">parser
metadata</span> is <var>parser state</var>and <span data-x="concept-request-client">client</span>
is <var>fetch client settings object</var>.</p></li>
metadata</span> is <var>parser state</var>, <span
data-x="concept-request-referrer">referrer</span> is <var>referrer</var>, and <span
data-x="concept-request-client">client</span> is <var>fetch client settings
object</var>.</p></li>

<li><p>If the caller specified custom steps to <span data-x="fetching-scripts-set-up-request">set
up the request</span>, perform them on <var>request</var>.</p></li>
Expand Down Expand Up @@ -86136,7 +86142,7 @@ interface <dfn>NavigatorOnLine</dfn> {
<li>
<p>The result of <span data-x="extract a MIME type">extracting a MIME type</span> from
<var>response</var>'s <span data-x="concept-response-header-list">header list</span>
(ignoring parameters) is not a <span>JavaScript MIME type</span>.</p>
(ignoring parameters) is not a <span>JavaScript MIME type</span></p>

<p class="note">For historical reasons, <span data-x="fetch a classic script">fetching a
classic script</span> does not include MIME type checking. In contrast, module scripts will
Expand All @@ -86145,7 +86151,7 @@ interface <dfn>NavigatorOnLine</dfn> {

<li><p>The caller specified custom steps to <span
data-x="fetching-scripts-process-response">process the response</span>, which when performed
on <var>response</var> return false.</p></li>
on <var>response</var> return false</p></li>
</ul>
</li>

Expand Down

0 comments on commit 3d0f0f2

Please sign in to comment.