Permalink
Browse files

Editorial: move base URL from "module script" to "script"

This propagates an appropriate base URL for all instances of creating a
classic script. This has no effect by itself (and indeed looks kind of
pointless as of this commit), but it sets the stage for making import()
use this base URL (#2315).
  • Loading branch information...
domenic committed Sep 14, 2017
1 parent 9275d95 commit 5458513792ab00d58e6c91ba48faaa611d034a2e
Showing with 49 additions and 40 deletions.
  1. +49 −40 source
View
89 source
@@ -58044,6 +58044,9 @@ o............A....e
<li><p>Let <var>source text</var> be the value of the <code
data-x="dom-script-text">text</code> IDL attribute.</p></li>
<li><p>Let <var>base URL</var> be the <code>script</code> element's <span>node
document</span>'s <span>document base URL</span>.</p></li>
<li>
<p>Switch on <span data-x="concept-script-type">the script's type</span>:</p>
@@ -58052,7 +58055,8 @@ o............A....e
<dd>
<ol>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> using
<var>source text</var>, <var>settings object</var>, and <var>options</var>.</p></li>
<var>source text</var>, <var>settings object</var>, <var>base URL</var>, and
<var>options</var>.</p></li>
<li><p>Set <span data-x="concept-script-script">the script's script</span> to
<var>script</var>.</p></li>
@@ -58064,9 +58068,6 @@ o............A....e
<dt>"<code data-x="">module</code>"</dt>
<dd>
<ol>
<li><p>Let <var>base URL</var> be the <code>script</code> element's <span>node
document</span>'s <span>document base URL</span>.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a module script</span> using
<var>source text</var>, <var>settings object</var>, <var>base URL</var>, and
<var>options</var>.</p></li>
@@ -81868,9 +81869,12 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<li><p>Let <var>settings</var> be the <span>relevant settings object</span> for the
<span>active document</span> of <var>browsingContext</var>.</p></li>
<li><p>Let <var>base URL</var> be <var>settings object</var>'s <span>API base
URL</span>.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>script source</var>, <var>settings</var>, and the <span>default classic script fetch
options</span>.</p></li>
<var>script source</var>, <var>settings</var>, <var>base URL</var>, and the <span>default
classic script fetch options</span>.</p></li>
<li><p>Let <var>result</var> be the result of <span data-x="run a classic script">running the
classic script</span> <var>script</var>. If evaluation was unsuccessful, let
@@ -86204,11 +86208,20 @@ interface <dfn>NavigatorOnLine</dfn> {
<dd>A <span>script fetch options</span>, containing various options related to fetching this
script or <span data-x="module script">module scripts</span> that it imports.</dd>
<dt>A <dfn data-dfn-for="script" data-export="" data-x="concept-script-base-url">base
URL</dfn></dt>
<dd><p>A base <span>URL</span> used for <span data-x="resolve a module specifier">resolving a
module specifiers</span>. This will either be the URL from which the script was obtained, for
external scripts, or the <span>document base URL</span> of the containing document, for inline
scripts.</p></dd>
</dl>
<p>A <dfn data-export="">classic script</dfn> is a <span data-x="concept-script">script</span>
that has the following additional <span data-x="struct item">item</span>:</p>
<p>A <dfn data-export="">classic script</dfn> is a type of <span
data-x="concept-script">script</span> that has the following additional <span data-x="struct
item">item</span>:</p>
<dl>
<dt>A <dfn>muted errors</dfn> boolean</dt>
@@ -86218,22 +86231,9 @@ interface <dfn>NavigatorOnLine</dfn> {
information.</p></dd>
</dl>
<p>A <dfn data-export="">module script</dfn> is a <span data-x="concept-script">script</span>
that has the following additional <span data-x="struct item">item</span>:</p>
<dl>
<dt>A <dfn data-x="concept-module-script-base-url">base URL</dfn></dt>
<dd>
<p>A base URL used for resolving module specifiers when <span data-x="resolve a module
specifier">resolving a module specifier</span>. This will either be the URL from which the
script was obtained, for external module scripts, or the <span>document base URL</span> of the
containing document, for inline module scripts.</p>
</dd>
</dl>
<p>A <dfn data-export="">module script</dfn> is another type of <span
data-x="concept-script">script</span>. It has no additional <span data-x="struct
item">items</span>.</p>
<p>We say that a <span>module script</span> <dfn data-x="concept-module-script-is-errored">is
errored</dfn> if either its <span data-x="concept-script-record">record</span> is null, or its
@@ -86605,7 +86605,8 @@ interface <dfn>NavigatorOnLine</dfn> {
<span>CORS-cross-origin</span>, and false otherwise.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>source text</var>, <var>settings object</var>, <var>options</var>, and <var>muted
<var>source text</var>, <var>settings object</var>, <var>response</var>'s <span
data-x="concept-response-url">url</span>, <var>options</var>, and <var>muted
errors</var>.</p></li>
<li>Asynchronously complete this algorithm with <var>script</var>.</li>
@@ -86652,8 +86653,9 @@ interface <dfn>NavigatorOnLine</dfn> {
decoding</span> <var>response</var>'s <span data-x="concept-response-body">body</span>.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> using
<var>source text</var>, <var>script settings object</var>, and the <span>default classic script
fetch options</span>.</p></li>
<var>source text</var>, <var>script settings object</var>, <var>response</var>'s <span
data-x="concept-response-url">url</span>, and the <span>default classic script fetch
options</span>.</p></li>
<li>Asynchronously complete this algorithm with <var>script</var>.</li>
</ol>
@@ -86700,8 +86702,9 @@ interface <dfn>NavigatorOnLine</dfn> {
<span>CORS-cross-origin</span>, and false otherwise.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>source text</var>, <var>settings object</var>, the <span>default classic script fetch
options</span>, and <var>muted errors</var>.</p></li>
<var>source text</var>, <var>settings object</var>, <var>response</var>'s <span
data-x="concept-response-url">url</span>, the <span>default classic script fetch options</span>,
and <var>muted errors</var>.</p></li>
<li><p>Return <var>script</var>.</p></li>
</ol>
@@ -86885,7 +86888,7 @@ interface <dfn>NavigatorOnLine</dfn> {
<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-module-script-base-url">base URL</span> for the <span>module script</span> is
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>
@@ -86945,10 +86948,10 @@ interface <dfn>NavigatorOnLine</dfn> {
<span>internal module script graph fetching procedure</span> given <var>url</var>,
<var>options</var>, <var>destination</var>, <var>module script</var>'s <span>settings
object</span>, <var>module script</var>'s <span>settings object</span>, <var>visited set</var>,
<var>module script</var>'s <span data-x="concept-module-script-base-url">base URL</span>, and
with the <var>top-level module fetch</var> flag unset. If the caller of this algorithm specified
custom <span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those
along while performing the <span>internal module script graph fetching procedure</span>.</p>
<var>module script</var>'s <span data-x="concept-script-base-url">base URL</span>, and with the
<var>top-level module fetch</var> flag unset. If the caller of this algorithm specified custom
<span data-x="fetching-scripts-perform-fetch">perform the fetch</span> steps, pass those along
while performing the <span>internal module script graph fetching procedure</span>.</p>
<p>These invocations of the <span>internal module script graph fetching procedure</span> should
be performed in parallel to each other.</p>
@@ -87033,8 +87036,8 @@ interface <dfn>NavigatorOnLine</dfn> {
<p>To <dfn data-x="creating a classic script">create a classic script</dfn>, given a
<span>JavaScript string</span> <var>source</var>, an <span>environment settings object</span>
<var>settings</var>, some <span>script fetch options</span> <var>options</var>, and an optional
<var>muted errors</var> boolean:</p>
<var>settings</var>, a <span>URL</span> <var>baseURL</var>, some <span>script fetch options</span>
<var>options</var>, and an optional <var>muted errors</var> boolean:</p>
<ol>
<li><p>If <var>muted errors</var> was not provided, let it be false.</p></li>
@@ -87073,6 +87076,9 @@ interface <dfn>NavigatorOnLine</dfn> {
<li><p>Set <var>script</var>'s <span data-x="concept-script-record">record</span> to
<var>result</var>.</p></li>
<li><p>Set <var>script</var>'s <span data-x="concept-script-base-url">base URL</span> to
<var>baseURL</var>.</p></li>
<li><p>Set <var>script</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span> to <var>options</var>.</p></li>
@@ -87145,7 +87151,7 @@ interface <dfn>NavigatorOnLine</dfn> {
<li><p>Set <var>script</var>'s <span data-x="concept-script-record">record</span> to
<var>result</var>.</p></li>
<li><p>Set <var>script</var>'s <span data-x="concept-module-script-base-url">base URL</span> to
<li><p>Set <var>script</var>'s <span data-x="concept-script-base-url">base URL</span> to
<var>baseURL</var>.</p></li>
<li><p>Set <var>script</var>'s <span data-x="concept-script-script-fetch-options">fetch
@@ -88060,7 +88066,7 @@ import "https://example.com/foo/../module2.js";</pre>
</li>
<li><p>Return the result of applying the <span>URL parser</span> to <var>specifier</var> with
<var>script</var>'s <span data-x="concept-module-script-base-url">base URL</span> as the base
<var>script</var>'s <span data-x="concept-script-base-url">base URL</span> as the base
URL.</p></li>
</ol>
@@ -90897,9 +90903,12 @@ document.body.appendChild(frame)</pre>
<li><p>Let <var>settings object</var> be <var>method context</var>'s <span>environment
settings object</span>.</p></li>
<li><p>Let <var>base URL</var> be <var>settings object</var>'s <span>API base
URL</span>.</p></li>
<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>script source</var>, <var>settings object</var>, and the <span>default classic script
fetch options</span>.</p></li>
<var>script source</var>, <var>settings object</var>, <var>base URL</var>, and the
<span>default classic script fetch options</span>.</p></li>
<li><p><span data-x="run a classic script">Run the classic script</span>
<var>script</var>.</p></li>

1 comment on commit 5458513

@taweesakteejantuk66

This comment has been minimized.

Show comment
Hide comment
@taweesakteejantuk66

taweesakteejantuk66 commented on 5458513 Jan 6, 2018

thanks

Please sign in to comment.