[html5] r8247 - [giow] (3) The bulk of this is editorial: refactoring how scripts are defined so [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Oct 30 16:18:05 PDT 2013


Author: ianh
Date: 2013-10-30 16:18:04 -0700 (Wed, 30 Oct 2013)
New Revision: 8247

Modified:
   complete.html
   index
   source
Log:
[giow] (3) The bulk of this is editorial: refactoring how scripts are defined so that all the common stuff is in a shared 'settings object' rather than being duplicated per script. But this also cleans up how postMessage() interacts with the event loop and a few other things I've since forgotten.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=22863
Affected topics: DOM APIs, HTML, HTML Syntax and Parsing, Rendering, Security, Workers

Modified: complete.html
===================================================================
--- complete.html	2013-10-28 21:49:17 UTC (rev 8246)
+++ complete.html	2013-10-30 23:18:04 UTC (rev 8247)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 28 October 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 30 October 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -1010,13 +1010,14 @@
      <li><a href=#processing-model-3><span class=secno>7.1.3 </span>Processing model</a>
       <ol>
        <li><a href=#definitions-0><span class=secno>7.1.3.1 </span>Definitions</a></li>
-       <li><a href=#calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</a></li>
-       <li><a href=#creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</a></li>
-       <li><a href=#killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</a></li>
-       <li><a href=#runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</a>
+       <li><a href=#script-settings-for-browsing-contexts><span class=secno>7.1.3.2 </span>Script settings for browsing contexts</a></li>
+       <li><a href=#calling-scripts><span class=secno>7.1.3.3 </span>Calling scripts</a></li>
+       <li><a href=#creating-scripts><span class=secno>7.1.3.4 </span>Creating scripts</a></li>
+       <li><a href=#killing-scripts><span class=secno>7.1.3.5 </span>Killing scripts</a></li>
+       <li><a href=#runtime-script-errors><span class=secno>7.1.3.6 </span>Runtime script errors</a>
         <ol>
-         <li><a href=#runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</a></li>
-         <li><a href=#the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code>ErrorEvent</code> interface</a></ol></ol></li>
+         <li><a href=#runtime-script-errors-in-documents><span class=secno>7.1.3.6.1 </span>Runtime script errors in documents</a></li>
+         <li><a href=#the-errorevent-interface><span class=secno>7.1.3.6.2 </span>The <code>ErrorEvent</code> interface</a></ol></ol></li>
      <li><a href=#event-loops><span class=secno>7.1.4 </span>Event loops</a>
       <ol>
        <li><a href=#definitions-1><span class=secno>7.1.4.1 </span>Definitions</a></li>
@@ -1174,8 +1175,9 @@
      <li><a href=#creating-workers><span class=secno>10.2.6 </span>Creating workers</a>
       <ol>
        <li><a href=#the-abstractworker-abstract-interface><span class=secno>10.2.6.1 </span>The <code>AbstractWorker</code> abstract interface</a></li>
-       <li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.2 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
-       <li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
+       <li><a href=#script-settings-for-workers><span class=secno>10.2.6.2 </span>Script settings for workers</a></li>
+       <li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.3 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
+       <li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.4 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
    <li><a href=#apis-available-to-workers><span class=secno>10.3 </span>APIs available to workers</a>
     <ol>
      <li><a href=#importing-scripts-and-libraries><span class=secno>10.3.1 </span>Importing scripts and libraries</a></li>
@@ -6681,7 +6683,8 @@
 
      <dt>If the URL came from a script (e.g. as an argument to a method)</dt>
 
-     <dd>The URL character encoding is the <a href="#script's-url-character-encoding">script's URL character encoding</a>.</dd>
+<!--CLEANUP-->
+     <dd>The URL character encoding is the <a href=#api-url-character-encoding>API URL character encoding</a> specified by the script's <a href=#settings-object>settings object</a>.</dd>
 
      <dt>If the URL came from a DOM node (e.g. from an element)</dt>
 
@@ -8387,10 +8390,12 @@
   their user interface. This is the primary mechanism by which a user can tell if a site is
   attempting to impersonate another.</p>
 
+<!--CLEANUP-->
   <p>When a <code><a href=#document>Document</a></code> is created by a <a href=#concept-script title=concept-script>script</a> using
   the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> or <code title=dom-DOMImplementation-createHTMLDocument><a href=#dom-domimplementation-createhtmldocument>createHTMLDocument()</a></code> APIs, <a href="#the-document's-address">the
-  document's address</a> is the same as <a href="#the-document's-address">the document's address</a> of the <a href="#script's-document">script's
-  document</a>, and the <code><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
+  document's address</a> is the same as <a href="#the-document's-address">the document's address</a> of the <a href=#responsible-document>responsible
+  document</a> specified by the script's <a href=#settings-object>settings
+  object</a>, and the <code><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
   <a href=#completely-loaded>completely loaded</a> immediately.</p>
 
   <p><dfn id="the-document's-referrer">The document's referrer</dfn> is an <a href=#absolute-url>absolute URL</a> that can be set when the
@@ -8820,6 +8825,8 @@
 
   </dl><div class=impl>
 
+<!--CLEANUP--><!-- multiple paragraphs -->
+
   <!-- these all return the same object each time because of a rule in
   the collection section -->
 
@@ -9086,8 +9093,10 @@
 --><li><p>Let <var title="">document</var> be the <code><a href=#xmldocument>XMLDocument</a></code> object on which the
    method was invoked.</li>
 
+<!--CLEANUP-->
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the method's first argument, relative to the
-   <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>. If this is not
+   <a href=#api-base-url>API base URL</a> specified by the
+   <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>. If this is not
    successful, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. Otherwise, let <var title="">url</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>
 
    <li><p>If the <a href=#origin>origin</a> of <var title="">url</var> is not the same as the
@@ -9112,9 +9121,10 @@
 
    <li><p>Let <var title="">success</var> be false.</li>
 
+<!--CLEANUP-->
    <li><p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">url</var> from the <a href=#origin>origin</a> of
-   <var title="">document</var>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's
-   referrer source">referrer source</a>, with the <i title="">synchronous flag</i> set and the <i title="">force same-origin flag</i> set.</li>
+   <var title="">document</var>, using the <a href=#api-referrer-source>API referrer source</a> specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a>, with the <i title="">synchronous flag</i> set and the <i title="">force same-origin flag</i> set.</li>
 
    <li>
 
@@ -51847,29 +51857,33 @@
 
        <li>
 
+<!--CLEANUP-->
         <p>Let <var title="">old script element</var> be the value to which the
-        <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
+        <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
         initialized.</p>
 
        </li>
 
        <li>
 
-        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to the <code><a href=#the-script-element>script</a></code>
+<!--CLEANUP-->
+        <p>Initialize the <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to the <code><a href=#the-script-element>script</a></code>
         element.</p>
 
        </li>
 
        <li>
 
-        <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
-        <code><a href=#the-script-element>script</a></code> element node, using <var><a href="#the-script-block's-source">the script block's source</a></var>, the
-        <a href=#url>URL</a> from which the script was obtained, and <var><a href="#the-script-block's-type">the script block's
-        type</a></var>.</p>
+<!--CLEANUP-->
+        <p><a href=#create-a-script>Create a script</a>, using <var><a href="#the-script-block's-source">the script block's source</a></var>, the
+        <a href=#url>URL</a> from which the script was obtained, <var><a href="#the-script-block's-type">the script block's
+        type</a></var> as the scripting language, and the <a href=#script-settings-object>script settings object</a> of the <code><a href=#the-script-element>script</a></code> element's
+        <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>
 
+<!--CLEANUP-->
         <p>If the script came from a resource that was <a href=#fetch title=fetch>fetched</a> in the
-        steps above, and the resource was <a href=#cors-cross-origin>CORS-cross-origin</a>, then pass the <var title="">muted errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a>
-        algorithm.</p>
+        steps above, and the resource was <a href=#cors-cross-origin>CORS-cross-origin</a>, then pass the <var title="">muted errors</var> flag to the <a href=#create-a-script>create a script</a>
+        algorithm as well.</p>
 
         <p class=note>This is where the script is compiled and actually executed.</p>
 
@@ -51877,7 +51891,8 @@
 
        <li>
 
-        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to <var title="">old script
+<!--CLEANUP-->
+        <p>Initialize the <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to <var title="">old script
         element</var>.</p>
 
        </li>
@@ -64264,12 +64279,14 @@
   present, and as if all the properties of that <code><a href=#window>Window</a></code> object had their [[Enumerable]]
   attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
   script origin</a> that is not the same as the <code><a href=#window>Window</a></code> object's
   <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a separate set
   of objects. These objects must have the prototype chain appropriate for the script for which the
-  objects are created (not those that would be appropriate for scripts whose <a href="#script's-global-object">script's global
-  object</a> is the <code><a href=#window>Window</a></code> object in question).</p>
+  objects are created (not those that would be appropriate for scripts whose <a href=#global-object>global
+  object</a>, as specified by their <a href=#settings-object>settings object</a>,
+  is the <code><a href=#window>Window</a></code> object in question).</p>
 
   <div class=example>
 
@@ -64341,11 +64358,12 @@
 
   <p>The method has four arguments, though they are all optional.</p>
 
+<!--CLEANUP-->
   <p>The first argument, <var title="">url</var>, must be a <a href=#valid-non-empty-url>valid non-empty URL</a> for a
   page to load in the browsing context. If the first argument is the empty string, then the <var title="">url</var> argument must be interpreted as "<code><a href=#about:blank>about:blank</a></code>". Otherwise, the
   argument must be <a href=#resolve-a-url title="resolve a url">resolved</a> to an <a href=#absolute-url>absolute URL</a> (or
-  an error), relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-  URL</a>, when the method is invoked.</p>
+  an error), relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings 
+  object</a> when the method was invoked.</p>
 
   <p>The second argument, <var title="">target</var>, specifies the <a href=#browsing-context-name title="browsing context
   name">name</a> of the browsing context that is to be navigated. It must be a <a href=#valid-browsing-context-name-or-keyword>valid
@@ -64378,13 +64396,14 @@
   browsing context, then throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
   steps.</p>
 
+<!--CLEANUP-->
   <p>Otherwise, if <var title="">url</var> is not "<code><a href=#about:blank>about:blank</a></code>", the user agent must
   <a href=#navigate>navigate</a><!--DONAV window.open()--> the selected <a href=#browsing-context>browsing context</a> to the
   <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve a url">resolving</a> <var title="">url</var> earlier. If the <var title="">replace</var> is true or if the <a href=#browsing-context>browsing
   context</a> was just created as part of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
   browsing context name</a>, then <a href=#replacement-enabled title="replacement enabled">replacement must be
-  enabled</a>. The navigation must be done with the <a href="#script's-browsing-context" title="script's browsing
-  context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source browsing
+  enabled</a>. The navigation must be done with the <a href=#responsible-browsing-context>responsible
+  browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a> as the <a href=#source-browsing-context>source browsing
   context</a>. If the <a href=#resolve-a-url>resolve a URL</a> algorithm failed, then the user agent may either
   instead <a href=#navigate>navigate</a> to an inline error page, using the same replacement behavior and
   source browsing context behavior as described earlier in this paragraph; or treat the <var title="">url</var> as "<code><a href=#about:blank>about:blank</a></code>", acting as described in the next paragraph.</p>
@@ -64415,11 +64434,15 @@
   <ul class=brief><li>The corresponding <a href=#browsing-context>browsing context</a> <var title="">A</var> is
    <a href=#script-closable>script-closable</a>.</li>
 
-   <li>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-   script</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>
+<!--CLEANUP-->
+   <li>The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+   script</a>'s <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar
+   with</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>
 
-   <li id=sandboxClose>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
-   <a href=#incumbent-script>incumbent script</a> is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
+<!--CLEANUP-->
+   <li id=sandboxClose>The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the
+   <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
+   is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
    context</a> <var title="">A</var>.</li>
 
   </ul><p>A <a href=#browsing-context>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if it is an <a href=#auxiliary-browsing-context>auxiliary
@@ -64462,13 +64485,15 @@
 
   </dl><div class=impl>
 
+<!--CLEANUP-->
   <p>The <dfn id=dom-length title=dom-length><code>length</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code>
   interface must return the number of <a href=#child-browsing-context title="child browsing context">child browsing
   contexts</a> that are <a href=#browsing-context-nested-through title="browsing context nested through">nested through</a>
   elements that are <a href=#in-a-document title="in a document">in the <code>Document</code></a> that is the
   <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code> object, if that <code><a href=#window>Window</a></code>'s
-  <a href=#browsing-context>browsing context</a> shares the same <a href=#event-loop>event loop</a> as the <a href="#script's-browsing-context">script's
-  browsing context</a> of the <a href=#entry-script>entry script</a> accessing the IDL attribute; otherwise,
+  <a href=#browsing-context>browsing context</a> shares the same <a href=#event-loop>event loop</a> as the <a href=#responsible-document>responsible
+  document</a> specified by the <a href=#settings-object>settings object</a> of the
+  <a href=#entry-script>entry script</a> accessing the IDL attribute; otherwise,
   it must return zero.</p>
 
   <!-- in other words, frames are only accessible to same-thread processes -->
@@ -64585,8 +64610,10 @@
   objects have <a href=#implied-strong-reference title="implied strong reference">implied strong references</a> to the
   <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
 
-  <p>Each <a href=#concept-script title=concept-script>script</a> has a strong reference to its <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> and its <a href="#script's-document" title="script's
-  document">document</a>.</p>
+<!--CLEANUP-->
+  <p>Each <a href=#concept-script title=concept-script>script</a> has a strong reference to its <a href=#settings-object>settings
+  object</a>, and each <a href=#script-settings-object>script settings object</a>
+  has strong references to its <a href=#global-object>global object</a>, <a href=#responsible-browsing-context>responsible browsing context</a>, and <a href=#responsible-document>responsible document</a>.</p>
 
   <!-- discard a document -->
   <p>When a <a href=#browsing-context>browsing context</a> is to <dfn id=discard-a-document>discard a <code>Document</code></dfn>, the user
@@ -65921,8 +65948,9 @@
 
     <p>If the third argument is not null, run these substeps:</p>
 
-    <ol><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the third argument, relative to the
-     <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</li>
+    <ol><!--CLEANUP--><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the third argument, relative to the
+     <a href=#api-base-url>API base URL</a> specified by the
+     <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
      <li>If that fails, throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
 
@@ -65932,9 +65960,10 @@
      <a href=#concept-url-query title=concept-url-query>query</a>, and <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> components, then throw a
      <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
 
+<!--CLEANUP-->
      <li>If the <a href=#origin>origin</a> of the resulting <a href=#absolute-url>absolute URL</a> is not the same as
-     the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
-     document">document</a>, and either the <a href=#concept-url-path title=concept-url-path>path</a> or <a href=#concept-url-query title=concept-url-query>query</a> components of the two <a href=#parsed-url title="parsed URL">parsed
+     the <a href=#origin>origin</a> of the <a href=#responsible-document>responsible document</a> specified by the <a href=#entry-script>entry script</a>'s
+     <a href=#settings-object>settings object</a>, and either the <a href=#concept-url-path title=concept-url-path>path</a> or <a href=#concept-url-query title=concept-url-query>query</a> components of the two <a href=#parsed-url title="parsed URL">parsed
      URLs</a> compared in the previous step differ, throw a <code><a href=#securityerror>SecurityError</a></code> exception
      and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
      origin.)</li>
@@ -66189,9 +66218,10 @@
   <p>The <i>relevant <code><a href=#document>Document</a></code></i> is the <code><a href=#location>Location</a></code> object's associated
   <code><a href=#document>Document</a></code> object's <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>.</p>
 
+<!--CLEANUP-->
   <p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn>
   method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
-  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
+  to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>, and if that is
   successful, must <a href=#navigate>navigate</a><!--DONAV location.href/assign--> the <a href=#browsing-context>browsing
   context</a> to the specified <var title="">url</var>. If the <a href=#browsing-context>browsing context</a>'s
   <a href=#session-history>session history</a> contains only one <code><a href=#document>Document</a></code>, and that was the
@@ -66201,14 +66231,16 @@
   Safari doesn't check that. Thus this might need changing if testing shows the IE/Firefox behaviour
   is required here. -->
 
+<!--CLEANUP-->
   <p>When the <dfn id=dom-location-replace title=dom-location-replace><code>replace(<var title="">url</var>)</code></dfn>
   method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
-  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
+  to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>, and if that is
   successful, <a href=#navigate>navigate</a><!--DONAV location.href/replace--> the <a href=#browsing-context>browsing
   context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>
 
-  <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href="#script's-browsing-context" title="script's
-  browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source
+<!--CLEANUP-->
+  <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href=#responsible-browsing-context>responsible browsing context</a> specified by
+  the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a> as the <a href=#source-browsing-context>source
   browsing context</a>.</p>
 
   <p>If the <a href=#resolve-a-url title="resolve a url">resolving</a> step of the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods is not successful, then the user agent must
@@ -66272,9 +66304,10 @@
   input</a> algorithm with <a href="#the-document's-address" title="the document's address">the address</a> of the
   <i>relevant <code><a href=#document>Document</a></code></i> as the given value.</p>
 
+<!--CLEANUP-->
   <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the
-  base</a> algorithm must return the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base
-  URL">base URL</a>, if there is one, or null otherwise.</p>
+  base</a> algorithm must return the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s
+  <a href=#settings-object>settings object</a>, if there is one, or null otherwise.</p>
 
   <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding title=concept-uu-query-encoding>query
   encoding</a> is the <a href="#document's-character-encoding">document's character encoding</a>.</p>
@@ -66326,12 +66359,15 @@
   context</a>'s <a href=#active-document>active document</a>'s <a href=#effective-script-origin>effective script origin</a>, with the
   following exceptions:</p>
 
-  <ul><li>The <code title=dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#entry-script>entry script</a>'s
-   <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing
+  <ul><!--CLEANUP--><li>The <code title=dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#responsible-browsing-context>responsible browsing context</a>
+   specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing
    context</a> with which the <code><a href=#location>Location</a></code> object is associated
 
-   <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#entry-script>entry
-   script</a>'s <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the
+<!--CLEANUP-->
+   <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#responsible-browsing-context>responsible
+   browsing context</a> specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar with</a> the
    <a href=#browsing-context>browsing context</a> with which the <code><a href=#location>Location</a></code> object is associated
 
    <li>Any properties not defined in the IDL for the <code><a href=#location>Location</a></code> object or indirectly via
@@ -66345,12 +66381,13 @@
   properties, getters, setters, etc, were not present, and as if all the properties of that
   <code><a href=#location>Location</a></code> object had their [[Enumerable]] attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
   script origin</a> that is not the <a href=#same-origin>same origin</a> as the <code><a href=#location>Location</a></code>
   object's <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a
   separate set of objects. These objects must have the prototype chain appropriate for the script
   for which the objects are created (not those that would be appropriate for scripts whose
-  <a href="#script's-global-object">script's global object</a> is the <code><a href=#location>Location</a></code> object's <code><a href=#document>Document</a></code>'s
+  <a href=#settings-object>settings object</a> specifies a <a href=#global-object>global object</a> that is the <code><a href=#location>Location</a></code> object's <code><a href=#document>Document</a></code>'s
   <code><a href=#window>Window</a></code> object).</p>
 
   </div>
@@ -67757,7 +67794,7 @@
 
   <ol><li>
 
-    <p><a href=#make-disappear>Make disappear</a> any <code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor whose global object is the
+    <p><a href=#make-disappear>Make disappear</a> any <code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor from the
     <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>
 
     <p>If this affected any <code><a href=#websocket>WebSocket</a></code> objects, then set <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</p>
@@ -69915,27 +69952,28 @@
     information).</p>
 
    </dd>
-<!--
-   <dt>A relationship with a <span>script settings object</span></dt>
 
+   <dt>A <dfn id=settings-object>settings object</dfn></dt>
+
    <dd>
 
-    <p>An object (defined below) that describes various settings that can be shared with other
-    scripts.</p>
+    <p>A <a href=#script-settings-object>script settings object</a>, various settings that are shared with other scripts in
+    the same context.</p>
 
    </dd>
 
-  </dl>
+   <dt>An <dfn title="">owner</dfn>, <dfn title="">origin</dfn>, and <dfn title="">effective origin</dfn></dt>
 
-  <hr>
+   <dd>
 
-  <p>Each global object has a <dfn>script settings object</dfn> shared by the scripts that use that
-  global object. A <span>script settings object</span> consists of the following:</p>
+    <p>There are defined in the <a href=#origin>origin</a> section.</p>
 
-  <dl>
--->
-   <dt>A <dfn id=script-execution-environment>script execution environment</dfn></dt>
+   </dd>
 
+  </dl><hr><p>A <dfn id=script-settings-object>script settings object</dfn> specifies algorithms for obtaining the following:</p>
+
+  <dl><dt>A <dfn id=script-execution-environment>script execution environment</dfn> for each language supported by the user agent</dt>
+
    <dd>
 
     <p>The characteristics of the script execution environment depend on the language, and are not
@@ -69947,19 +69985,18 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-global-object">script's global object</dfn></dt>
-
+   <dt>A <dfn id=global-object>global object</dfn></dt>
    <dd>
 
-    <p>An object that provides the APIs that the code can use.</p>
+    <p>An object that provides the APIs that can be called by the code in scripts that use this
+    <a href=#script-settings-object title="script settings object">settings object</a>.</p>
 
-    <p class=example>This is typically a <code><a href=#window>Window</a></code> object. In JavaScript, this
-    corresponds to the <i>global object</i>.</p>
+    <p class=note>This is typically a <code><a href=#window>Window</a></code> object or a
+    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object. When a <a href=#global-object>global object</a> is an empty object, it
+    can't do anything that interacts with the environment.</p>
 
-    <p class=note>When a <a href="#script's-global-object">script's global object</a> is an empty object, it can't do
-    anything that interacts with the environment.</p>
-
-    <p>If the <a href="#script's-global-object">script's global object</a> is a <code><a href=#window>Window</a></code> object, then in
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> is a <code><a href=#window>Window</a></code> object, then, in
     JavaScript, the ThisBinding of the global execution context for this script must be the
     <code><a href=#window>Window</a></code> object's <code><a href=#windowproxy>WindowProxy</a></code> object, rather than the global object. <a href=#refsECMA262>[ECMA262]</a></p>
 
@@ -69970,70 +70007,148 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-browsing-context">script's browsing context</dfn></dt>
+   <dt>A <dfn id=responsible-browsing-context>responsible browsing context</dfn></dt>
 
    <dd>
 
     <p>A <a href=#browsing-context>browsing context</a> that is assigned responsibility for actions taken by the
-    script.</p>
+    scripts that use this <a href=#script-settings-object>script settings object</a>.</p>
 
     <p class=example>When a script creates and <a href=#navigate title=navigate>navigates</a> a new
-    <a href=#top-level-browsing-context>top-level browsing context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute of
-    the new <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object will be set to the
-    <a href="#script's-browsing-context">script's browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+    <a href=#top-level-browsing-context>top-level browsing context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute
+    of the new <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object will be set to the
+    <a href=#responsible-browsing-context>responsible browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-document">script's document</dfn></dt>
+   <dt>A <dfn id=responsible-document>responsible document</dfn></dt>
 
    <dd>
 
-    <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the script.</p>
+    <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the scripts that
+    use this <a href=#script-settings-object>script settings object</a>.</p>
 
+<!--CLEANUP-->
     <p class=example>For example, the <a href="#the-document's-address" title="the document's address">address</a> of the
-    <a href="#script's-document">script's document</a> is used to set the <a href="#the-document's-address" title="the document's
-    address">address</a> of any <code><a href=#document>Document</a></code> elements created using <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>.</p>
+    <a href=#responsible-document>responsible document</a> is used to set the <a href="#the-document's-address" title="the document's
+    address">address</a> of any <code><a href=#document>Document</a></code>s created using <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>.</p>
 
    </dd>
 
-   <dt>The <dfn id="script's-referrer-source">script's referrer source</dfn></dt>
+   <dt>A <dfn id=responsible-event-loop>responsible event loop</dfn></dt>
 
    <dd>
 
-    <p>Either a <code><a href=#document>Document</a></code> (specifically, the <a href="#script's-document">script's document</a>), or a
+    <p>An <a href=#event-loop>event loop</a> that is used when it would not be immediately clear what event
+    loop to use.</p>
+
+   </dd>
+
+   <dt>An <dfn id=api-referrer-source>API referrer source</dfn></dt>
+
+   <dd>
+
+    <p>Either a <code><a href=#document>Document</a></code> (specifically, the <a href=#responsible-document>responsible document</a>), or a
     <a href=#url>URL</a>, which is used by some APIs to determine what value to use for the <code title=http-referer>Referer</code> (sic) header in calls to the <a href=#fetch title=fetch>fetching</a> algorithm.</p>
 
    </dd>
 
-   <dt>A <dfn id="script's-url-character-encoding" title="script's URL character encoding">URL character encoding</dfn></dt>
+   <dt>An <dfn id=api-url-character-encoding>API URL character encoding</dfn></dt>
 
    <dd>
 
-    <p>A character encoding, set when the script is created, used to encode URLs. <span id=sce-not-copy title="">If the character encoding is set from another source, e.g. a
-    <a href="#document's-character-encoding">document's character encoding</a>, then the <a href="#script's-url-character-encoding">script's URL character
-    encoding</a> must follow the source, so that if the source's changes, so does the
-    script's.</span></p>
+<!--CLEANUP-->
+    <p>A character encoding used to encode URLs by APIs called by scripts that use
+    this <a href=#script-settings-object>script settings object</a>.</p>
 
    </dd>
 
-   <dt>A <dfn id="script's-base-url" title="script's base URL">base URL</dfn></dt>
+   <dt>An <dfn id=api-base-url>API base URL</dfn></dt>
 
    <dd>
 
-    <p>A <a href=#url>URL</a>, set when the script is created, used to resolve <a href=#relative-url title="relative
-    URL">relative URLs</a>. <span id=sbu-not-copy title="">If the base URL is set from another
-    source, e.g. a <a href=#document-base-url>document base URL</a>, then the <a href="#script's-base-url">script's base URL</a> must
-    follow the source, so that if the source's changes, so does the script's.</span></p>
+<!--CLEANUP-->
+    <p>An <a href=#absolute-url>absolute URL</a> used by APIs called by scripts that use
+    this <a href=#script-settings-object>script settings object</a> to resolve <a href=#relative-url title="relative
+    URL">relative URLs</a>.</p>
 
    </dd>
 
-  </dl></div>
+  </dl><h5 id=script-settings-for-browsing-contexts><span class=secno>7.1.3.2 </span>Script settings for browsing contexts</h5>
 
+  <p>Whenever a new <code><a href=#window>Window</a></code> object is created, it must also create a <a href=#script-settings-object>script
+  settings object</a> whose algorithms are defined as follows:</p>
 
-  <div class=impl>
+  <dl><dt>The <a href=#script-execution-environment title="script execution environment">script execution environments</a></dt>
+   <dd>
 
-  <h5 id=calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</h5>
+    <p>When the <a href=#script-settings-object>script settings object</a> is created, for each language supported by the
+    user agent, create an appropriate execution environment as defined by the relevant
+    specification.</p>
 
+    <p>When a <a href=#script-execution-environment>script execution environment</a> is needed, return the appropriate one from
+    those created when the <a href=#script-settings-object>script settings object</a> was created.</p>
+
+   </dd>
+
+   <dt>The <a href=#global-object>global object</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#window>Window</a></code> object itself.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-browsing-context>responsible browsing context</a></dt>
+   <dd>
+
+    <p>Return the <a href=#browsing-context>browsing context</a> with which the <code><a href=#window>Window</a></code> object is
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-document>responsible document</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-event-loop>responsible event loop</a></dt>
+   <dd>
+
+    <p>Return the <a href=#event-loop>event loop</a> that is associated with the <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related
+    similar-origin browsing contexts</a> to which the <code><a href=#window>Window</a></code> object's <a href=#browsing-context>browsing
+    context</a> belongs.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-referrer-source>API referrer source</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-url-character-encoding>API URL character encoding</a></dt>
+   <dd>
+
+    <p>Return the current <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of
+    the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-base-url>API base URL</a></dt>
+   <dd>
+
+    <p>Return the current <a href=#document-base-url title="document base URL">base URL</a> of the
+    <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently associated.</p>
+
+   </dd>
+
+  </dl><h5 id=calling-scripts><span class=secno>7.1.3.3 </span>Calling scripts</h5>
+
   <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=stack-of-incumbent-scripts>stack of
   incumbent scripts</dfn>, which must be initially empty. When a new script is <i>pushed</i> onto
   this stack, the specified script is to be added to the stack; when the script on this stack that
@@ -70048,8 +70163,10 @@
    new incumbent <a href=#concept-script title=concept-script>script</a> and the owner <a href=#concept-script title=concept-script>script</a>. If this returns "do not run" then abort these
    steps.</li>
 
-   <li><p>Make the <a href=#script-execution-environment title="script execution environment">script execution environment</a>
-   for <var title="">s</var> execute the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
+<!--CLEANUP-->
+   <li><p>Make the appropriate <a href=#script-execution-environment>script execution environment</a>
+   specified by <var title="">s</var>'s <a href=#settings-object>settings
+   object</a> execute the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
    entry-point</a>.</li>
 
    <li><p><a href=#clean-up-after-running-a-callback>Clean up after running a callback</a>.</li>
@@ -70059,11 +70176,12 @@
   <a href=#concept-script title=concept-script>script</a> <var title="">o</var>, and return either "run" or "do
   not run".</p>
 
-  <ol><li><p>If the <a href="#script's-global-object" title="script's global object">global object</a> of <var title="">o</var>
+  <ol><!--CLEANUP--><li><p>If the <a href=#global-object>global object</a> specified by <var title="">o</var>'s <a href=#settings-object>settings object</a>
    is a <code><a href=#window>Window</a></code> object whose <code><a href=#document>Document</a></code> object is not <a href=#fully-active>fully
    active</a>, then return "do not run" and abort these steps.</p>
 
-   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> for <var title="">o</var>'s <a href="#script's-browsing-context" title="script's browsing context">browsing context</a>, then return
+<!--CLEANUP-->
+   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> for the <a href=#responsible-browsing-context>responsible browsing context</a> specified by <var title="">o</var>'s <a href=#settings-object>settings object</a>, then return
    "do not run" and abort these steps.</p>
 
    <li><p>Push <var title="">s</var> onto the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a>, and label it
@@ -70102,7 +70220,7 @@
   <p>The <dfn id=entry-script>entry script</dfn> is the most-recently added <a href=#concept-script title=concept-script>script</a> in the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> that is
   labeled as a <a href=#candidate-entry-scripts title="candidate entry scripts">candidate entry script</a>. If the stack is
   empty, or has no entries labeled as such, then there is no <a href=#entry-script>entry script</a>. It is used
-  to obtain, amongst other things, the <a href="#script's-base-url">script's base URL</a> to <a href=#resolve-a-url title="resolve a
+  to obtain, amongst other things, the <a href=#api-base-url>API base URL</a> to <a href=#resolve-a-url title="resolve a
   url">resolve</a> relative <a href=#url title=URL>URLs</a> used in scripts running in that
   <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
 
@@ -70134,12 +70252,11 @@
 
   <div class=impl>
 
-  <h5 id=creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</h5>
+  <h5 id=creating-scripts><span class=secno>7.1.3.4 </span>Creating scripts</h5>
 
   <p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script title="create a script">created</dfn>, given some script source, a script source URL, its
-  scripting language, a global object, a browsing context, a document, a referrer source, a URL
-  character encoding, a base URL, and optionally a <var title="">muted errors</var> flag, the user
-  agent must run the following steps:</p>
+  scripting language, a <a href=#script-settings-object>script settings object</a>, and optionally a <var title="">muted
+  errors</var> flag, the user agent must run the following steps:</p>
 
   <ol><li><p>Let <var title="">script</var> be a new <a href=#concept-script title=concept-script>script</a> that
    this algorithm will subsequently initialize.</li>
@@ -70148,16 +70265,14 @@
    context</a> passed to this algorithm, then abort these steps, as if the script source
    described a program that did nothing but return void.</p>
 
-   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> as appropriate for the given scripting
-   language.</li>
+   <li><p>Obtain the appropriate <a href=#script-execution-environment>script execution environment</a> for the given scripting
+   language from the <a href=#script-settings-object>script settings object</a> provided.</li>
 
    <li><p>Parse/compile/initialize the source of the script using the <a href=#script-execution-environment>script execution
    environment</a>, as appropriate for the scripting language, and thus obtain <var title="">script</var>'s <a href=#code-entry-point>code entry-point</a>.</li>
 
-   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the <a href="#script's-browsing-context">script's browsing
-   context</a>, the <a href="#script's-document">script's document</a>, the <a href="#script's-referrer-source">script's referrer source</a>,
-   the <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the <a href="#script's-base-url">script's base URL</a> from the
-   settings passed to this algorithm.</li>
+   <li><p>Let <var title="">script</var>'s <a href=#settings-object>settings object</a> be the <a href=#script-settings-object>script
+   settings object</a> provided.</li>
 
    <li><p>If the <var title="">muted errors</var> flag was set, then set <var title="">script</var>'s <a href=#muted-errors>muted errors</a> flag.</li>
 
@@ -70167,45 +70282,20 @@
     <a href=#jump-to-a-code-entry-point title="jump to a code entry-point">Jump</a> to <var title="">script</var>'s <a href=#code-entry-point>code
     entry-point</a>.</p>
 
+<!--CLEANUP-->
     <p>Otherwise, <a href=#report-the-error>report the error</a> for <var title="">script</var>, with the problematic
-    position (line number and column number), using the <a href="#script's-global-object">script's global object</a> as the
+    position (line number and column number), using the <a href=#global-object>global object</a> specified by the <a href=#script-settings-object>script settings object</a> as the
     target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this,
     then the error may be reported to the user.</p>
 
    </li>
 
-  </ol><hr><p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script-from-a-node title="create a script from a node">created from a node</dfn> <var title="">node</var>, given some
-  script source, its URL, its scripting language, and optionally a <var title="">muted errors</var>
-  flag, the user agent must <a href=#create-a-script>create a script</a>, using the given script source, URL, and
-  scripting language, <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> <var title="">node</var>, and, if the <var title="">muted errors</var> flag was set in the call to this
-  algorithm, the <var title="">muted errors</var> flag.</p>
-
-  <p><dfn id=the-script-settings-determined-from-the-node>The script settings determined from the node</dfn> <var title="">node</var> are computed
-  as follows:</p>
-
-  <ol><li><p>Let <var title="">document</var> be the <code><a href=#document>Document</a></code> of <var title="">node</var>
-   (or <var title="">node</var> itself if it is a <code><a href=#document>Document</a></code>).</li>
-
-   <li><p>The global object is the <code><a href=#window>Window</a></code> object of <var title="">document</var>.</li>
-
-   <li><p>The browsing context is the <a href=#browsing-context>browsing context</a> of <var title="">document</var>.</p>
-
-   <li><p>The document is <var title="">document</var>.</p>
-
-   <li><p>The referrer source is <var title="">document</var>.</p>
-
-   <li><p>The URL character encoding is the <a href="#document's-character-encoding" title="document's character encoding">character
-   encoding</a> of <var title="">document</var>. (<a href=#sce-not-copy>This is a reference,
-   not a copy</a>.)</li>
-
-   <li><p>The base URL is the <a href=#document-base-url title="document base URL">base URL</a> of <var title="">document</var>. (<a href=#sbu-not-copy>This is a reference, not a copy</a>.)</li>
-
   </ol></div>
 
 
   <div class=impl>
 
-  <h5 id=killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</h5>
+  <h5 id=killing-scripts><span class=secno>7.1.3.5 </span>Killing scripts</h5>
 
   <p>User agents may impose resource limitations on scripts, for example CPU quotas, memory limits,
   total execution time limits, or bandwidth limitations. When a script exceeds a limit, the user
@@ -70241,7 +70331,7 @@
 
   <div class=impl>
 
-  <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</h5>
+  <h5 id=runtime-script-errors><span class=secno>7.1.3.6 </span>Runtime script errors</h5>
 
   <p>When the user agent is required to <dfn id=report-the-error title="report the error">report an error</dfn> for a
   particular <a href=#concept-script title=concept-script>script</a> <var title="">script</var> with a particular
@@ -70314,11 +70404,12 @@
 
    <li><p>If <var title="">event</var> was canceled, then the error is <i title=concept-error-handled><a href=#concept-error-handled>handled</a></i>. Otherwise, the error is <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</p>
 
-  </ol><h6 id=runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</h6>
+  </ol><h6 id=runtime-script-errors-in-documents><span class=secno>7.1.3.6.1 </span>Runtime script errors in documents</h6>
 
+<!--CLEANUP-->
   <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
   <code><a href=#document>Document</a></code>, the user agent must <a href=#report-the-error>report the error</a> for the relevant <a href=#concept-script title=concept-script>script</a>, with the problematic position (line number and column
-  number) in the resource containing the script, using the <a href="#script's-global-object">script's global object</a> as
+  number) in the resource containing the script, using the <a href=#global-object>global object</a> specified by the script's <a href=#settings-object>settings object</a> as
   the target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this,
   then the error may be reported to the user.</p>
 
@@ -70326,7 +70417,7 @@
 
 
 
-  <h6 id=the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code><a href=#errorevent>ErrorEvent</a></code> interface</h6>
+  <h6 id=the-errorevent-interface><span class=secno>7.1.3.6.2 </span>The <code><a href=#errorevent>ErrorEvent</a></code> interface</h6>
 
   <pre class=idl>[Constructor(DOMString type, optional <a href=#erroreventinit>ErrorEventInit</a> eventInitDict)]
 interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event>Event</a> {
@@ -70437,7 +70528,7 @@
   the task was queued in the context of a <a href=#browsing-context>browsing context</a>, then it is the
   <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> at the time the task was queued; if
   the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is
-  the <a href="#script's-document">script's document</a>.</p>
+  the <a href=#responsible-document>responsible document</a> specified by the script's <a href=#settings-object>settings object</a>.</p>
 
   <p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
   the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>
@@ -70529,9 +70620,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><a href=#concept-mo-invoke title=concept-mo-invoke>Invoke <code>MutationObserver</code> objects</a> for the
-    <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> to which the <a href="#script's-browsing-context">script's
-    browsing context</a> belongs, using the <a href=#task-wrapper-algorithm>task wrapper algorithm</a> as the steps to
+    <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> to which the <a href=#responsible-browsing-context>responsible
+    browsing context</a> specified by the script's <a href=#settings-object>settings object</a> belongs, using the <a href=#task-wrapper-algorithm>task wrapper algorithm</a> as the steps to
     invoke each callback.</p>
 
     <p class=note>This will typically invoke scripted callbacks, which calls the <a href=#jump-to-a-code-entry-point>jump to a
@@ -70716,10 +70808,10 @@
       context</a> being navigated has a <a href=#creator-browsing-context>creator browsing context</a>, then let <var title="">address</var> be the <a href="#the-document's-address" title="the document's address">address</a> of the
       <a href=#creator-document>creator <code>Document</code></a> instead.</p>
 
-      <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
-      <code><a href=#document>Document</a></code> node of the <a href=#active-document>active document</a>, using the aforementioned
-      script source, the <a href=#url>URL</a> of the resource where the <code>javascript:</code> URL,
-      was found, and assuming the scripting language is JavaScript.</p>
+      <p><a href=#create-a-script>Create a script</a>, using the aforementioned script source, the <a href=#url>URL</a>
+      of the resource where the <code>javascript:</code> URL, was found, JavaScript as the scripting
+      language, and the <a href=#script-settings-object>script settings object</a> of the <code><a href=#window>Window</a></code> object of the
+      <a href=#active-document>active document</a>.</p>
 
       <p>Let <var title="">result</var> be the return value of the <a href=#code-entry-point>code entry-point</a>
       of this <a href=#concept-script title=concept-script>script</a>. If an exception was thrown, let <var title="">result</var> be void instead. (The result will be void also if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>.)</p>
@@ -70846,8 +70938,12 @@
 
   <ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to null.</li>
 
-   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for JavaScript.</li>
+   <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a> of the
+   <code><a href=#window>Window</a></code> object associated with the <a href=#browsing-context>browsing context</a> to which belongs the
+   <code><a href=#document>Document</a></code> of the element in question.</li>
 
+   <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
+
    <li><p>Let <var title="">body</var> be the <a href=#event-handler-content-attributes title="event handler content attributes">event
    handler content attribute</a>'s new value.</li>
 
@@ -70890,7 +70986,8 @@
 
    <li>
 
-    <p>Using the script execution environment created above, create a function object (as defined in
+<!--CLEANUP-->
+    <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function object (as defined in
     ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
 
     <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
@@ -70939,15 +71036,12 @@
 
      <dd>The value of <var title="">strict</var>.</dd>
 
-    </dl><p>Let this new function be the script's <a href=#code-entry-point>code entry-point</a>.</p>
+    </dl><!--CLEANUP--><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code entry-point</a>.</p>
 
    </li>
 
-   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the <a href="#script's-browsing-context">script's browsing
-   context</a>, the <a href="#script's-document">script's document</a>, the <a href="#script's-referrer-source">script's referrer source</a>,
-   the <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the <a href="#script's-base-url">script's base URL</a> from
-   <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> on which the attribute is being
-   set.</li>
+   <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
+   <var title="">script settings</var>.</li>
 
    <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to the
    aforementioned function.</li>
@@ -71745,15 +71839,22 @@
    <li><p>Remove all child nodes of the document, without firing any mutation events.</li> <!--
    as of 2009-03-30, only WebKit fired mutation events here. -->
 
-   <li><p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
-   (This includes in particular the <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>,
-   <code><a href=#history-0>History</a></code>, <code><a href=#applicationcache>ApplicationCache</a></code>, and <code><a href=#navigator>Navigator</a></code>, objects, the
-   various <code><a href=#barprop>BarProp</a></code> objects, the two <code><a href=#storage-0>Storage</a></code> objects, the various
-   <code><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
-   <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
-   IDL prototypes in the JavaScript binding, including the <code><a href=#document>Document</a></code> object's
-   prototype.)</li>
+   <li>
 
+    <p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
+    (This includes in particular the <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>,
+    <code><a href=#history-0>History</a></code>, <code><a href=#applicationcache>ApplicationCache</a></code>, and <code><a href=#navigator>Navigator</a></code>, objects, the
+    various <code><a href=#barprop>BarProp</a></code> objects, the two <code><a href=#storage-0>Storage</a></code> objects, the various
+    <code><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
+    <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
+    IDL prototypes in the JavaScript binding, including the <code><a href=#document>Document</a></code> object's
+    prototype.)</p>
+
+    <p class=note>The new <code><a href=#window>Window</a></code> object has a new <a href=#script-settings-object>script settings
+    object</a>.</p>
+
+   </li>
+
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%20src%3D%22document%22%3E%3C%2Fiframe%3E%0A%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20f%20%3D%20document.getElementsByTagName('iframe')%5B0%5D%3B%20d%20%3D%20f.contentWindow.document%3B%20%7D%3C%2Fscript%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22w(d.documentElement.innerHTML)%22%20value%3D%22dump%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cscript%3Evar%20x%20%3D%20new%20XMLHttpRequest()%3Bx.open(%26quot%3BGET%26quot%3B%2C%20%26quot%3BGET%26quot%3B)%3Bx.onreadystatechange%3Dfunction()%20%7B%20alert(x.readyState)%3B%20%7D%3Bx.send(null)%3B%3C%2Fscript%3E')%3Bd.close()%3B%20setTimeout(function()%20%7B%20d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%20%7D%2C%200)%3B%22%20value%3D%22xhr%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.onclick%20%3D%20function()%20%7B%20w('click')%20%7D%22%20value%3D%22add%20click%20handler%22%3E%
 0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3E%3Cscript%3Ei%20%3D%200%3B%20setTimeout(%26quot%3Bparent.w(i%2B%2B)%26quot%3B%2C%202000)%3C%2Fscript%3E%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%20with%20timer%22%3E -->
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%3E%3C%2Fiframe%3E%0D%0A%3Cscript%3E%0D%0Aonload%20%3D%20function%20()%20%7B%0D%0A%20frames%5B0%5D.test%20%3D%201%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20var%20a%20%3D%20frames%5B0%5D.document.location.assign%3B%0D%0A%20w(a)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%20frames%5B0%5D.document.open()%3B%0D%0A%20frames%5B0%5D.document.write('%3Cscript%3Edocument.write(test)%3C%5C%2Fscript%3E')%3B%0D%0A%20frames%5B0%5D.document.close()%3B%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E -->
 
@@ -71765,8 +71866,10 @@
 
    <li><p>Set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state back to true.</li>
 
-   <li><p>Change <a href="#the-document's-address">the document's address</a> to the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's document">document</a>'s <a href="#the-document's-address" title="the document's
-   address">address</a>.</li>
+<!--CLEANUP-->
+   <li><p>Change <a href="#the-document's-address">the document's address</a> to the <a href="#the-document's-address" title="the document's
+   address">address</a> of the <a href=#responsible-document>responsible document</a> specified by
+   the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
    <!-- <span>the document's referrer</span> stays the same -->
 
@@ -72197,32 +72300,14 @@
 
          <li><p>Let <var title="">script language</var> be JavaScript.</li>
 
-         <li>
+         <li><p>Let <var title="">settings object</var> be <var title="">method context</var>'s
+         <a href=#script-settings-object>script settings object</a>.</li>
 
-          <p>If <var title="">method context</var> is a <code><a href=#window>Window</a></code> object, let <var title="">global object</var> be <var title="">method context</var>, let <var title="">browsing context</var> be the <a href=#browsing-context>browsing context</a> with which <var title="">global object</var> is associated, let <var title="">document</var> and <var title="">referrer source</var> be the <code><a href=#document>Document</a></code> associated with <var title="">global object</var>, let <var title="">character encoding</var> be the <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of the <code><a href=#document>Document</a></code>
-          associated with <var title="">global object</var> (<a href=#sce-not-copy>this is a
-          reference, not a copy</a>), and let <var title="">base URL</var> be the <a href=#document-base-url title="document base URL">base URL</a> of the <code><a href=#document>Document</a></code> associated with <var title="">global object</var> (<a href=#sbu-not-copy>this is a reference, not a
-          copy</a>).</p>
+         <li><!--CLEANUP--><!--no need for all this whitespace-->
 
-          <p>Otherwise, <var title="">method context</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
-          let <var title="">global object</var>, <var title="">browsing context</var>, <var title="">document</var>, <var title="">referrer source</var>, <var title="">character
-          encoding</var>, and <var title="">base URL</var> be the <a href="#script's-global-object">script's global object</a>,
-          <a href="#script's-browsing-context">script's browsing context</a>, <a href="#script's-document">script's document</a>, <a href="#script's-referrer-source">script's
-          referrer source</a>, <a href="#script's-url-character-encoding">script's URL character encoding</a>, and <a href="#script's-base-url">script's
-          base URL</a> (respectively) of the <a href=#concept-script title=concept-script>script</a> that the
-          <a href=#run-a-worker>run a worker</a> algorithm created when it created <var title="">method
-          context</var>.</p>
-
-         </li>
-
-         <li>
-
           <p><a href=#create-a-script>Create a script</a> using <var title="">script source</var> as the script
-          source, the <a href=#url>URL</a> where <var title="">script source</var> can be found, <var title="">scripting language</var> as the scripting language, <var title="">global
-          object</var> as the global object, <var title="">browsing context</var> as the browsing
-          context, <var title="">document</var> as the document, <var title="">referrer source</var>
-          as the referrer source, <var title="">character encoding</var> as the URL character
-          encoding, and <var title="">base URL</var> as the base URL.</p>
+          source, the <a href=#url>URL</a> where <var title="">script source</var> can be found, <var title="">scripting language</var> as the scripting language, and <var title="">settings
+          object</var> as the <a href=#script-settings-object>script settings object</a>.</p>
 
          </li>
 
@@ -72230,7 +72315,7 @@
 
       </dl></li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>If the <var title="">repeat</var> flag is true, then call <a href=#timer-initialization-steps>timer initialization
       steps</a> again, passing them the same method arguments, the same <var title="">method
@@ -72569,7 +72654,8 @@
   <ol><li>
 
     <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">url</var> relative to the
-    <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</p>
+    <a href=#api-base-url>API base URL</a> specified by
+    <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</p>
 
     <p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
 
@@ -72598,9 +72684,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of the
-    <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-    script</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
+    <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
     then return the empty string and abort these steps.</p>
 
    </li>
@@ -72653,11 +72740,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Set all the flags in the new browsing context's <a href=#popup-sandboxing-flag-set>popup sandboxing flag set</a> that
     are set in the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of
-    the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-    script</a>. The <a href="#script's-browsing-context" title="script's browsing
-    context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
+    the <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a>. The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
     must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed
     navigator</a>.</p>
 
@@ -72689,9 +72776,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><a href=#navigate>Navigate</a><!--DONAV showModalDialog--> the new <a href=#browsing-context>browsing context</a> to
     the <a href=#absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url title="resolve a url">resolving</a>
-    <var title="">url</var> earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
+    <var title="">url</var> earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href=#responsible-browsing-context>responsible
+    browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
     as the <a href=#source-browsing-context>source browsing context</a>.</p>
 
    </li>
@@ -73152,9 +73241,10 @@
     argument passed to one of these methods does not contain the exact literal string
     "<code>%s</code>".</p>
 
+<!--CLEANUP-->
     <p>User agents must throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception if <a href=#resolve-a-url title="resolve a
-    url">resolving</a> the <var title="">url</var> argument relative to the <a href=#entry-script>entry
-    script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, is not successful.</p>
+    url">resolving</a> the <var title="">url</var> argument relative to the
+    <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> is not successful.</p>
 
     <p class=note>The resulting <a href=#absolute-url>absolute URL</a> would by definition not be a <a href=#valid-url>valid
     URL</a> as it would include the string "<code title="">%s</code>" which is not a valid
@@ -73170,10 +73260,12 @@
     <p>The resulting <a href=#absolute-url>absolute URL</a> is the <dfn id=proto-url>proto-URL</dfn>. It identifies the
     handler for the purposes of the methods described below.</p>
 
+<!--CLEANUP-->
     <p>When the user agent uses this handler, it must replace the first occurrence of the exact
     literal string "<code title="">%s</code>" in the <var title="">url</var> argument with an
     escaped version of the <a href=#absolute-url>absolute URL</a> of the content in question (as defined below),
-    then <a href=#resolve-a-url title="resolve a url">resolve</a> the resulting URL, relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
+    then <a href=#resolve-a-url title="resolve a url">resolve</a> the resulting URL, relative to the <a href=#api-base-url>API
+    base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
     invoked, and then <a href=#navigate>navigate</a><!--DONAV user--> an appropriate <a href=#browsing-context>browsing
     context</a> to the resulting URL using the GET method (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a> for non-HTTP URLs).</p>
 
@@ -73381,7 +73473,9 @@
   <ol><li><p>If the string does not contain the substring "<code title="">%s</code>", abort these
    steps. There's no matching handler.</li>
 
-   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the string relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a>.</li>
+<!--CLEANUP-->
+   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the string relative to the <a href=#api-base-url>API base URL</a>
+   specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
    <li><p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception, aborting the
    method.</li>
@@ -74008,9 +74102,9 @@
     never does anything, or may arbitrarily ignore invocations with particular arguments for
     security, privacy, or usability reasons.</li>
 
+<!--CLEANUP-->
     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the method's first argument
-    relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-    URL</a>.</li>
+    relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
     <li><p>If this fails, abort these steps.</li>
 
@@ -74032,9 +74126,10 @@
     <li><p>Let <var title="">host1</var> be the host component of the <a href=#origin>origin</a> of the
     <a href=#entry-script>entry script</a>.</li>
 
+<!--CLEANUP-->
     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument
-    relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-    URL</a>.</li>
+    relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>.</li>
 
     <li><p>If this fails, return 0 and abort these steps.</li>
 
@@ -77969,9 +78064,9 @@
   settings, if any, in the form of an <code><a href=#eventsourceinit>EventSourceInit</a></code> dictionary. When the
   <code>EventSource()</code> constructor is invoked, the UA must run these steps:</p>
 
-  <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified in the first
-   argument, relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-   URL</a>.
+  <ol><!--CLEANUP--><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified in the first
+   argument, relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+   object</a>.
    </li>
 
    <li><p>If the previous step failed, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort
@@ -77990,9 +78085,10 @@
 
    <li><!-- if you change this, don't forget to update the reconnecting fetch lower down as well! -->
 
+<!--CLEANUP-->
     <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting <a href=#absolute-url>absolute
-    URL</a> using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer source">referrer
-    source</a>, with the <i>mode</i> being <var title="">CORS mode</var>, and the <i title="">origin</i> being the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a><!--, and the
+    URL</a> using the <a href=#api-referrer-source>API referrer source</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>, with the <i>mode</i> being <var title="">CORS mode</var>, and the <i title="">origin</i> being the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a><!--, and the
     <i>default origin behaviour</i> set to <i>fail</i> (though it has no effect in the "Anonymous"
     and "Use Credentials" modes)-->, and process the resource obtained in this fashion, if any, as
     described below.</p>
@@ -79609,7 +79705,7 @@
 
     </ol></li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Let <var title="">message clone</var> be the result of obtaining a <a href=#structured-clone>structured
     clone</a> of the <var title="">message</var> argument, with <var title="">transfer map</var>
@@ -79623,14 +79719,14 @@
     <p>If the method was invoked with a third argument <var title="">transfer</var>, run these
     substeps:</p>
 
-    <ol><li>
+    <ol><li><!--CLEANUP--><!--no need for all this whitespace-->
 
-      <p>Let <var title="">new owner</var> be the <code><a href=#window>Window</a></code> object on which the method was
+      <p>Let <var title="">new owner</var> be the <a href=#script-settings-object>script settings object</a> of the <code><a href=#window>Window</a></code> object on which the method was
       invoked.</p>
 
      </li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new
       object <var title="">y</var> by <a href=#transfer-a-transferable-object title="transfer a Transferable
@@ -79642,7 +79738,7 @@
 
     </ol></li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a>
     array.</p>
@@ -79658,9 +79754,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <var title="">targetOrigin</var> argument is a single literal U+002F SOLIDUS character
     (/), and the <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which the method was
-    invoked does not have the <a href=#same-origin>same origin</a> as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's document">document</a>, then abort these steps silently.</p>
+    invoked does not have the <a href=#same-origin>same origin</a> as the <a href=#responsible-document>responsible document</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>, then abort these steps silently.</p>
 
     <p>Otherwise, if the <var title="">targetOrigin</var> argument is an <a href=#absolute-url>absolute URL</a>,
     and the <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which the method was invoked
@@ -79674,12 +79772,16 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
     <code><a href=#messageevent>MessageEvent</a></code> interface, with the event type <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
     default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
     initialized to the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialized to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an origin">Unicode serialization</a> of the
     <a href=#origin>origin</a> of the <a href=#incumbent-script>incumbent script</a>, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be initialized to the
-    <a href="#script's-global-object">script's global object</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialized to the <var title="">new ports</var> array.
+    <code><a href=#windowproxy>WindowProxy</a></code> object corresponding to the
+    <a href=#global-object>global object</a> (a <code><a href=#window>Window</a></code> object) specified by the
+    <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>,
+    and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialized to the <var title="">new ports</var> array.
     </p>
     <!-- invariant: the global object is always a Window if the script can see this method -->
 
@@ -79914,11 +80016,14 @@
   <p>When the <dfn id=dom-messagechannel title=dom-MessageChannel><code>MessageChannel()</code></dfn> constructor is
   called, it must run the following algorithm:</p>
 
-  <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object">script's
-   global object</a>, and let <var title="">port1</var> be that object.</li>
+  <ol><!--CLEANUP--><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a>
+   of the <a href=#incumbent-script>incumbent script</a>, and let <var title="">port1</var> be that object.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object">script's
-   global object</a>, and let <var title="">port2</var> be that object.</li>
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a>
+   of the <a href=#incumbent-script>incumbent script</a>, and let <var title="">port2</var> be that object.</li>
 
    <li><p><a href=#entangle>Entangle</a> the <var title="">port1</var> and <var title="">port2</var>
    objects.</li>
@@ -80000,21 +80105,30 @@
   message queue</dfn>, initially empty. A <a href=#port-message-queue>port message queue</a> can be enabled or
   disabled, and is initially disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed altogether, which has much the
-  same effect). A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag. It must
-  initially be false.</p>
+  same effect). A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag, which must
+  initially be false, and an <dfn id=concept-port-owner title=concept-port-owner>owner</dfn>, which is a <a href=#settings-object>settings
+  object</a> set when the object is created, as described below.</p>
 
+<!--CLEANUP-->
   <p>When a port's <a href=#port-message-queue>port message queue</a> is enabled, the <a href=#event-loop>event loop</a> must use
-  it as one of its <a href=#task-source title="task source">task sources</a>.</p>
+  it as one of its <a href=#task-source title="task source">task sources</a>. All <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> on the <a href=#port-message-queue>port
+  message queue</a> must be associated with the <a href=#responsible-document>responsible document</a> specified by
+  the port's <a href=#concept-port-owner title=concept-port-owner>owner</a>.</p>
 
-  <p class=note>If the <code><a href=#document>Document</a></code> of the port's event listeners' <a href="#script's-global-object" title="script's
-  global object">global object</a> is not <a href=#fully-active>fully active</a>, then the messages are
+<!--CLEANUP-->
+  <p class=note>If the port's <a href=#concept-port-owner title=concept-port-owner>owner</a> specifies a <a href=#responsible-document>responsible document</a> that is <a href=#fully-active>fully active</a>,
+  but the event listeners all have scripts whose <a href=#settings-object title="settings object">settings objects</a>
+  specify <a href=#responsible-document title="responsible document">responsible documents</a> that are <em>not</em> <a href=#fully-active>fully active</a>, then the messages will be
   lost.</p> <!-- because of the jump-to-entry-point algorithm first step -->
 
+<!--CLEANUP-->
   <p>Each <a href=#event-loop>event loop</a> has a <a href=#task-source>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
   message queue</dfn>. This is a virtual <a href=#task-source>task source</a>: it must act as if it contained
   the <a href=#concept-task title=concept-task>tasks</a> of each <a href=#port-message-queue>port message queue</a> of each
-  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false and whose <a href=#port-message-queue>port
-  message queue</a> is enabled, in the order in which they were added to their respective
+  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false, whose <a href=#port-message-queue>port
+  message queue</a> is enabled, and whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+  specifies that <a href=#event-loop>event loop</a> as the <a href=#responsible-event-loop>responsible event loop</a>,
+  in the order in which they were added to their respective
   <a href=#task-source>task source</a>. When a <a href=#concept-task title=concept-task>task</a> would be removed from the
   <a href=#unshipped-port-message-queue>unshipped port message queue</a>, it must instead be removed from its <a href=#port-message-queue>port message
   queue</a>.</p>
@@ -80029,9 +80143,10 @@
   is true, its <a href=#port-message-queue>port message queue</a> acts as a first-class <a href=#task-source>task source</a>,
   unaffected to any <a href=#unshipped-port-message-queue>unshipped port message queue</a>.</p>
 
-  <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> owned by a
-  <a href="#script's-global-object">script's global object</a> object <var title="">owner</var>, it must instantiate a new
-  <code><a href=#messageport>MessagePort</a></code> object, and let its owner be <var title="">owner</var>.</p>
+<!--CLEANUP-->
+  <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> with a particular
+  <a href=#settings-object>settings object</a> as its <var title="">owner</var>, it must instantiate a new
+  <code><a href=#messageport>MessagePort</a></code> object, and let its <a href=#concept-port-owner title=concept-port-owner>owner</a> be <var title="">owner</var>.</p>
 
   <p>When the user agent is to <dfn id=entangle>entangle</dfn> two <code><a href=#messageport>MessagePort</a></code> objects, it must run
   the following steps:</p>
@@ -80069,7 +80184,7 @@
   <ol><li><p>Set <var title="">original port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
    true.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">owner</var>, and let <var title="">new port</var> be that object.</li>
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">owner</var>, and let <var title="">new port</var> be that object.</li>
 
    <li><p>Set <var title="">new port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to true.</li>
 
@@ -80176,7 +80291,8 @@
 
     <ol><li>
 
-      <p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there
+<!--CLEANUP-->
+      <p>Let <var title="">new owner</var> be the <a href=#concept-port-owner title=concept-port-owner>owner</a> of <var title="">target port</var>, if there
       is a <var title="">target port</var>, or else some arbitrary owner. (This <var title="">new
       owner</var> is used when transferring objects below. If there is no <var title="">target
       port</var>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
@@ -80238,8 +80354,9 @@
 
    <li><p>Let <var title="">message</var> be the method's first argument.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span>script's
-   global object</span>, and let <var title="">port1</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   title="concept-port-owner">owner</span> is the <span>incumbent script</span>'s <span>settings
+   object</span>, and let <var title="">port1</var> be that object.</p></li>
 
    <li><p>If the <var title="">source port</var> is not entangled with another port, then return
    <var title="">port1</var> and abort these steps.</p></li> <!- - we don't throw an exception
@@ -80249,8 +80366,9 @@
    <li><p>Let <var title="">target port</var> be the port with which <var title="">source port</var>
    is entangled.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the owner of the <var
-   title="">target port</var>, and let <var title="">port2</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   title="concept-port-owner">owner</span> is the <span title="concept-port-owner">owner</span> of
+   the <var title="">target port</var>, and let <var title="">port2</var> be that object.</p></li>
 
    <li><p><span>Entangle</span> the <var title="">port1</var> and <var title="">port2</var>
    objects.</p></li>
@@ -80402,9 +80520,10 @@
 
   <div class=impl>
 
+<!--CLEANUP-->
   <p>When a <code><a href=#messageport>MessagePort</a></code> object <var title="">o</var> is entangled, user agents must
   either act as if <var title="">o</var>'s entangled <code><a href=#messageport>MessagePort</a></code> object has a strong
-  reference to <var title="">o</var>, or as if <var title="">o</var>'s owner has a strong reference
+  reference to <var title="">o</var>, or as if the <a href=#global-object>global object</a> specified by <var title="">o</var>'s <a href=#concept-port-owner title=concept-port-owner>owner</a> has a strong reference
   to <var title="">o</var>.</p>
 
   <div class=note>
@@ -81595,7 +81714,7 @@
   JavaScript</a> if the <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#shared-worker-environment>shared worker
   environment</a>.</p>
 
-  <p>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on their global object for each
+  <p>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on their <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object for each
   connection.</p>
 
   <p>The <dfn id=dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name><code>name</code></dfn> attribute must return
@@ -81672,14 +81791,15 @@
   it must be removed from the list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of each
   worker whose list contains that <code><a href=#document>Document</a></code>.</p>
 
-  <p>Given a <a href="#script's-global-object">script's global object</a> <var title="">o</var> when creating or obtaining a
+<!--CLEANUP-->
+  <p>Given a <a href=#settings-object>settings object</a> <var title="">o</var> when creating or obtaining a
   worker, the <dfn id=list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to add</dfn> depends on the type
-  of <var title="">o</var>. If <var title="">o</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
+  of <a href=#global-object>global object</a> specified by <var title="">o</var>'s. If <var title="">o</var>
+  specifies a <a href=#global-object>global object</a> that is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
   (i.e. if we are creating a nested worker), then the relevant <code><a href=#document>Document</a></code>s are the
-  <code><a href=#document>Document</a></code>s that are in <var title="">o</var>'s own list of <a href="#the-worker's-documents">the worker's
-  <code>Document</code>s</a>. Otherwise, <var title="">o</var> is a <code><a href=#window>Window</a></code> object,
-  and the relevant <code><a href=#document>Document</a></code> is just the <code><a href=#document>Document</a></code> that is the <a href=#active-document>active
-  document</a> of the <code><a href=#window>Window</a></code> object <var title="">o</var>.</p>
+  <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of the <a href=#global-object>global object</a> specified by
+  <var title="">o</var>. Otherwise, <var title="">o</var> specifies a <a href=#global-object>global object</a> that is a <code><a href=#window>Window</a></code> object,
+  and the relevant <code><a href=#document>Document</a></code> is just the <a href=#responsible-document>responsible document</a> specified by <var title="">o</var>.</p>
 
   <hr><p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents">the worker's
   <code>Document</code>s</a> is not empty.</p>
@@ -81698,8 +81818,9 @@
 
   <h4 id=processing-model-7><span class=secno>10.2.4 </span>Processing model</h4>
 
-  <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url>URL</a> <var title="">url</var>, a <a href=#browsing-context>browsing context</a> <var title="">owner browsing context</var>, a
-  <code><a href=#document>Document</a></code> <var title="">owner document</var>, an <a href=#origin>origin</a> <var title="">owner origin</var>, and with global scope <var title="">worker global scope</var>, it
+<!--CLEANUP-->
+  <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url>URL</a> <var title="">url</var>, a <a href=#script-settings-object>script settings object</a> <var title="">settings object</var>,
+  and an <a href=#origin>origin</a> <var title="">owner origin</var>, it
   must run the following steps:</p>
 
   <ol><li id=worker-processing-model-top>
@@ -81712,6 +81833,9 @@
 
    </li>
 
+   <li><p>Let <var title="">worker global scope</var> be the <a href=#global-object>global object</a> specified
+   by <var title="">settings object</var>.</li>
+
    <li><p>If <var title="">worker global scope</var> is actually a
    <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker), and there are
    any <a href=#relevant-application-cache title="relevant application cache">relevant application caches</a> that are
@@ -81724,8 +81848,8 @@
    <li>
 
     <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> the resource identified by <var title="">url</var>,
-    from the <var title="">owner origin</var>, using <var title="">owner document</var> as the
-    <a href=#referrer-source>referrer source</a>, with the <i>synchronous flag</i> set and the <i>force same-origin
+    from the <var title="">owner origin</var>, using the <a href=#responsible-document>responsible document</a> specified by <var title="">settings object</var> as the
+    <a href=#referrer-source>referrer source</a> (not the specified <a href=#api-referrer-source>API referrer source</a>!), with the <i>synchronous flag</i> set and the <i>force same-origin
     flag</i> set.</p> <!-- not http-origin privacy sensitive (looking forward to CORS) -->
 
     <p>If the attempt fails, then for each <code><a href=#worker>Worker</a></code> or <code><a href=#sharedworker>SharedWorker</a></code> object
@@ -81745,7 +81869,7 @@
    </li>
 
    <li><p>In the newly created execution environment, create a <a href=#javascript-global-environment>JavaScript global
-   environment</a> whose <i>global object</i> is <var title="">worker global scope</var>. If <var title="">worker global scope</var> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this
+   environment</a> whose <i><a href=#global-object>global object</a></i> is <var title="">worker global scope</var>. If <var title="">worker global scope</var> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this
    is a <a href=#dedicated-worker-environment>dedicated worker environment</a>. Otherwise, <var title="">worker global
    scope</var> is a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object, and this is a <a href=#shared-worker-environment>shared worker
    environment</a>. (In either case, by definition, it is a <a href=#worker-environment>worker
@@ -81753,29 +81877,18 @@
 
    <li><!-- SCRIPT EXEC -->
 
-    <p>A new <a href=#concept-script title=concept-script>script</a> is now created, as follows.</p>
+    <p>Let <var title="">script</var> be a new <a href=#concept-script title=concept-script>script</a>.</p>
 
-    <p>Create a new <a href=#script-execution-environment>script execution environment</a> set up as appropriate for the
-    scripting language <var title="">language</var>.</p>
+    <p>Obtain the appropriate <a href=#script-execution-environment>script execution environment</a> for the scripting language
+    <var title="">language</var> from <var title="">settings object</var>.</p>
 
     <p>Parse/compile/initialize <var title="">source</var> using that <a href=#script-execution-environment>script execution
     environment</a>, as appropriate for <var title="">language</var>, and thus obtain a
     <a href=#code-entry-point>code entry-point</a>.</p>
 
-    <p>Set the <a href="#script's-global-object">script's global object</a> to <var title="">worker global scope</var>.</p>
+    <p>Let <var title="">script</var>'s <a href=#settings-object>settings object</a> be <var title="">settings
+    object</var>.</p>
 
-    <p>Set the <a href="#script's-browsing-context">script's browsing context</a> to <var title="">owner browsing
-    context</var>.</p>
-
-    <p>Set the <a href="#script's-document">script's document</a> to <var title="">owner document</var>.</p>
-
-    <p>Set the <a href="#script's-referrer-source">script's referrer source</a> to <var title="">url</var>.</p>
-
-    <p>Set the <a href="#script's-url-character-encoding">script's URL character encoding</a> to UTF-8. (This is just used for
-    encoding non-ASCII characters in the query component of URLs.)</p>
-
-    <p>Set the <a href="#script's-base-url">script's base URL</a> to <var title="">url</var>.</p>
-
    </li>
 
    <li>
@@ -81821,8 +81934,8 @@
 
    <li>
 
-    <p><strong><a href=#event-loop>Event loop<!-- labeled for ease of discussion --></a></strong>: Create a new <a href=#event-loop>event
-    loop</a>, and run it until it is destroyed.</p>
+    <p><strong><a href=#event-loop>Event loop<!-- labeled for ease of discussion --></a></strong>: Run the <a href=#responsible-event-loop>responsible
+    event loop</a> specified by <var title="">settings object</var> until it is destroyed.</p>
 
     <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task title=concept-task>tasks</a> run by the <a href=#event-loop>event loop</a> might get prematurely
     aborted by the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
@@ -81971,8 +82084,98 @@
   <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
    <tbody><tr><td><dfn id=handler-abstractworker-onerror title=handler-AbstractWorker-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
 <!-- v2-onclose    <tr><td><dfn title="handler-AbstractWorker-onclose"><code>onclose</code></dfn> <td> <code title="event-worker-close">close</code> -->
-  </table><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>
+  </table><h5 id=script-settings-for-workers><span class=secno>10.2.6.2 </span>Script settings for workers</h5>
 
+  <p>When the user agent is required to <dfn id=set-up-a-worker-script-settings-object>set up a worker script settings object</dfn>, given a
+  <var title="">worker global scope</var>, it must run the following steps:</p>
+
+  <ol><li><p>Let <var title="">inherited responsible browsing context</var> be the <a href=#responsible-browsing-context>responsible
+   browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings
+   object</a>.</li>
+
+   <li><p>Let <var title="">inherited responsible document</var> be the <a href=#responsible-document>responsible
+   document</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings
+   object</a>.</li>
+
+   <li><p>Let <var title="">worker event loop</var> be a newly created <a href=#event-loop>event
+   loop</a>.</li>
+
+   <li>
+
+    <p>Let <var title="">settings object</var> be a new <a href=#script-settings-object>script settings object</a> whose
+    algorithms are defined as follows:</p>
+
+    <dl><dt>The <a href=#script-execution-environment title="script execution environment">script execution environments</a></dt>
+     <dd>
+
+      <p>When the <a href=#script-settings-object>script settings object</a> is created, for each language supported by the
+      user agent, create an appropriate execution environment as defined by the relevant
+      specification.</p>
+
+      <p>When a <a href=#script-execution-environment>script execution environment</a> is needed, return the appropriate one from
+      those created when the <a href=#script-settings-object>script settings object</a> was created.</p>
+
+      <p class=note>Currently, workers only support JavaScript, so only a JavaScript execution
+      environment is actually needed here.</p>
+
+     </dd>
+
+     <dt>The <a href=#global-object>global object</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker global scope</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-browsing-context>responsible browsing context</a></dt>
+     <dd>
+
+      <p>Return <var title="">inherited responsible browsing context</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-document>responsible document</a></dt>
+     <dd>
+
+      <p>Return <var title="">inherited responsible document</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-event-loop>responsible event loop</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker event loop</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-referrer-source>API referrer source</a></dt>
+     <dd>
+
+      <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+      associated.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-url-character-encoding>API URL character encoding</a></dt>
+     <dd>
+
+      <p>Return UTF-8.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-base-url>API base URL</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker URL</var>.</p>
+
+     </dd>
+
+    </dl></li>
+
+   <li><p>Return <var title="">settings object</var>.</li>
+
+  </ol><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.3 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>
+
   <pre class=idl>[<a href=#dom-worker title=dom-Worker>Constructor</a>(DOMString scriptURL)]
 interface <dfn id=worker>Worker</dfn> : <a href=#eventtarget>EventTarget</a> {
   void <a href=#dom-worker-terminate title=dom-Worker-terminate>terminate</a>();
@@ -82027,17 +82230,21 @@
    the request violates a policy decision (e.g. if the user agent is configured to not allow the
    page to start dedicated workers).</li>
 
+<!--CLEANUP-->
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument
-   relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, when
-   the method is invoked.</li>
+   relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> when
+   the method was invoked.</li>
 
    <li><p>If this fails, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>
 
+   <li><p>Let <var title="">worker URL</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>
+
    <li>
 
-    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of the resulting <a href=#parsed-url>parsed
-    URL</a> is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of the
-    resulting <a href=#absolute-url>absolute URL</a> is not the <a href=#same-origin title="same origin">same</a> as the
+<!--CLEANUP-->
+    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of <var title="">worker URL</var>
+    is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of <var title="">worker URL</var>
+    is not the <a href=#same-origin title="same origin">same</a> as the
     origin of the <a href=#entry-script>entry script</a>, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and
     abort these steps.</p>
 
@@ -82052,16 +82259,22 @@
    origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
    scope</var> be this new object.</li>
 
+   <li><p><a href=#set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var title="">worker global
+   scope</var>, and let <var title="">settings object</var> be the result.</li>
+
    <li><p>Create a new <code><a href=#worker>Worker</a></code> object, associated with <var title="">worker global
    scope</var>. Let <var title="">worker</var> be this new object.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
    this be the <var title="">outside port</var>.</li>
 
    <li><p>Associate the <var title="">outside port</var> with <var title="">worker</var>.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
-   global scope</var>. Let <var title="">inside port</var> be this new object.</li>
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">script settings</var>
+   Let <var title="">inside port</var> be this new object.</li>
 
    <li><p>Associate <var title="">inside port</var> with <var title="">worker global
    scope</var>.</li>
@@ -82079,8 +82292,9 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
-    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
+    add</a> given the <a href=#settings-object>settings object</a> of the
     <a href=#incumbent-script>incumbent script</a>.</p>
 
    </li>
@@ -82095,25 +82309,24 @@
 
    <li>
 
-    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-    script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker),
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker),
     add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of
-    the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
-    object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+    the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global object</a> of the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
    </li>
 
    <li>
 
-    <p><a href=#run-a-worker>Run a worker</a> for the resulting <a href=#absolute-url>absolute URL</a>, with the
-    <a href="#script's-browsing-context">script's browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing context</var>, with the <a href="#script's-document">script's document</a> of the
-    <a href=#incumbent-script>incumbent script</a> as the <var title="">owner document</var>, with the
-    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner origin</var>,
-    and with <var title="">worker global scope</var> as the global scope.</p>
+    <p><a href=#run-a-worker>Run a worker</a> for the script with <a href=#url>URL</a> <var title="">worker
+    URL</var>, the <a href=#script-settings-object>script settings object</a> <var title="">settings object</var>, and the
+    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner
+    origin</var>.</p>
 
    </li>
 
-  </ol><h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>
+  </ol><h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.4 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>
 
   <pre class=idl>[<a href=#dom-sharedworker title=dom-SharedWorker>Constructor</a>(DOMString scriptURL, optional DOMString name)]
 interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#eventtarget>EventTarget</a> {
@@ -82160,7 +82373,7 @@
    <li>
 
     <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
-    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
+    add</a> given the <a href=#settings-object>settings object</a> of the
     <a href=#incumbent-script>incumbent script</a>.</p>
 
    </li>
@@ -82172,7 +82385,9 @@
     <ol><li><p>Create a new <code><a href=#sharedworker>SharedWorker</a></code> object, which will shortly be associated with a
      <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. Let this <code><a href=#sharedworker>SharedWorker</a></code> object be <var title="">worker</var>.</li>
 
-     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
+<!--CLEANUP-->
+     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+     is the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
      this be the <var title="">outside port</var>.</li>
 
      <li><p>Assign <var title="">outside port</var> to the <code title=dom-SharedWorker-port><a href=#dom-sharedworker-port>port</a></code> attribute of <var title="">worker</var>.</li>
@@ -82217,8 +82432,13 @@
        <li><p>Associate <var title="">worker</var> with <var title="">worker global
        scope</var>.</li>
 
-       <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker global scope</var>. Let this be the <var title="">inside port</var>.</li>
+       <li><p>Let <var title="">settings object</var> be the <a href=#script-settings-object>script settings object</a>
+       whose <a href=#global-object>global object</a> is <var title="">worker global scope</var>.</li>
 
+<!--CLEANUP-->
+       <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+       is <var title="">settings object</var>. Let this be the <var title="">inside port</var>.</li>
+
        <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var>
        and <var title="">inside port</var>.</li>
 
@@ -82241,11 +82461,12 @@
 
        <li>
 
-        <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-        script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global
+<!--CLEANUP-->
+        <p>If the <a href=#global-object>global object</a> specified by the <a href=#incumbent-script>incumbent
+        script</a>'s <a href=#settings-object>settings object</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global
         scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
-        <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
-        object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+        <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global
+        object</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
        </li>
 
@@ -82253,17 +82474,23 @@
 
       </ol></li>
 
+     <!-- OTHERWISE: -->
+
      <li><p>Create a new <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#worker-origin>worker
      origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
      scope</var> be this new object.</li>
 
+     <li><p><a href=#set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var title="">worker global
+     scope</var>, and let <var title="">settings object</var> be the result.</li>
+
      <li><p>Associate <var title="">worker</var> with <var title="">worker global
      scope</var>.</li>
 
      <li><p>Set the <code title=dom-SharedWorkerGlobalScope-name><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute of <var title="">worker global scope</var> to <var title="">name</var>.</li>
 
-     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
-     global scope</var>. Let <var title="">inside port</var> be this new object.</li>
+<!--CLEANUP-->
+     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">settings object</var>.
+     Let <var title="">inside port</var> be this new object.</li>
 
      <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var> and <var title="">inside
      port</var>.</li>
@@ -82291,21 +82518,18 @@
 
    <li>
 
-    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-    script</a> that invoked the constructor is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
-    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global object">global
-    object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> specified by the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent
+    script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
+    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global
+    object</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
    </li>
 
    <li>
 
-    <p><a href=#run-a-worker>Run a worker</a> for <var title="">scriptURL</var>, with the <a href="#script's-browsing-context">script's browsing
-    context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing
-    context</var>, with the <a href="#script's-document">script's document</a> of the <a href=#incumbent-script>incumbent script</a> the
-    <var title="">owner document</var>, with the <a href=#origin>origin</a> of the <a href=#entry-script>entry
-    script</a> as the <var title="">owner origin</var>, and with <var title="">worker global
-    scope</var> as the global scope.</p>
+    <p><a href=#run-a-worker>Run a worker</a> for the script with <a href=#url>URL</a> <var title="">scriptURL</var>, the <a href=#script-settings-object>script settings object</a> <var title="">settings
+    object</var>, and the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner origin</var>.</p>
 
    </li>
 
@@ -82336,15 +82560,19 @@
 
   <ol><li><p>If there are no arguments, return without doing anything. Abort these steps.</li>
 
+   <li><p>Let <var title="">settings object</var> be the <a href=#script-settings-object>script settings object</a> of the
+   <a href=#incumbent-script>incumbent script</a>.</li>
+
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> each argument.</li>
 
    <li><p>If any fail, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>
 
    <li>
 
+<!--CLEANUP-->
     <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> each resource identified by the resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>, from the <a href=#entry-script>entry script</a>'s
-    <a href=#origin>origin</a>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer
-    source">referrer source</a>, and with the <i>synchronous flag</i> set.</p> <!-- not
+    <a href=#origin>origin</a>, using the <a href=#api-referrer-source>API referrer source</a> specified by <var title="">settings
+    object</var>, and with the <i>synchronous flag</i> set.</p> <!-- not
     http-origin privacy sensitive -->
 
    </li>
@@ -82373,14 +82601,13 @@
 
      <li>
 
-      <p><a href=#create-a-script>Create a script</a>, using <var title="">source</var> as the script source, the
-      <a href=#url>URL</a> from which <var title="">source</var> was obtained, and <var title="">language</var> as the scripting language, using the same global object, browsing
-      context, document, referrer source, URL character encoding, and base URL as the <a href=#concept-script title=concept-script>script</a> that was created by the worker's <a href=#run-a-worker>run a
-      worker</a> algorithm.</p>
+      <p><a href=#create-a-script>Create a script</a> using <var title="">source</var> as the script source, the
+      <a href=#url>URL</a> from which <var title="">source</var> was obtained, <var title="">language</var> as the scripting language, and <var title="">settings object</var> as
+      the <a href=#script-settings-object>script settings object</a>.</p>
 
       <p>If the script came from a resource whose <a href=#url>URL</a> does not have the <a href=#same-origin>same
       origin</a> as the <a href=#worker-origin>worker origin</a>, then pass the <var title="">muted
-      errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a> algorithm.</p>
+      errors</var> flag to the <a href=#create-a-script>create a script</a> algorithm as well.</p>
 
       <p>Let the newly created <a href=#concept-script title=concept-script>script</a> run until it either
       returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
@@ -94972,7 +95199,7 @@
    <li>None of the elements in the <code><a href=#document>Document</a></code> are in any of the following namespaces: <a href=#html-namespace-0>HTML namespace</a>, <a href=#svg-namespace>SVG namespace</a>, <a href=#mathml-namespace>MathML namespace</a>
    <li>The <code><a href=#document>Document</a></code> has no <a href=#focusable>focusable</a> elements (e.g. from XLink).
    <li>The <code><a href=#document>Document</a></code> has no <a href=#hyperlink title=hyperlink>hyperlinks</a> (e.g. from XLink).
-   <li>There exists no <a href=#concept-script title=concept-script>script</a> whose <a href="#script's-document" title="script's document">document</a> is this <code><a href=#document>Document</a></code>.
+   <li>There exists no <a href=#concept-script title=concept-script>script</a> whose <a href=#settings-object>settings object</a> specifies this <code><a href=#document>Document</a></code> as the <a href=#responsible-document>responsible document</a>.
    <li>None of the elements in the <code><a href=#document>Document</a></code> have any registered event listeners.
   </ul><p><dfn id=an-unstyled-document-view>An unstyled document view</dfn> is one where the DOM is not rendered according to CSS
   (which would, since there are no applicable styles in this context, just result in a wall of

Modified: index
===================================================================
--- index	2013-10-28 21:49:17 UTC (rev 8246)
+++ index	2013-10-30 23:18:04 UTC (rev 8247)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 28 October 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 30 October 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -1010,13 +1010,14 @@
      <li><a href=#processing-model-3><span class=secno>7.1.3 </span>Processing model</a>
       <ol>
        <li><a href=#definitions-0><span class=secno>7.1.3.1 </span>Definitions</a></li>
-       <li><a href=#calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</a></li>
-       <li><a href=#creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</a></li>
-       <li><a href=#killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</a></li>
-       <li><a href=#runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</a>
+       <li><a href=#script-settings-for-browsing-contexts><span class=secno>7.1.3.2 </span>Script settings for browsing contexts</a></li>
+       <li><a href=#calling-scripts><span class=secno>7.1.3.3 </span>Calling scripts</a></li>
+       <li><a href=#creating-scripts><span class=secno>7.1.3.4 </span>Creating scripts</a></li>
+       <li><a href=#killing-scripts><span class=secno>7.1.3.5 </span>Killing scripts</a></li>
+       <li><a href=#runtime-script-errors><span class=secno>7.1.3.6 </span>Runtime script errors</a>
         <ol>
-         <li><a href=#runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</a></li>
-         <li><a href=#the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code>ErrorEvent</code> interface</a></ol></ol></li>
+         <li><a href=#runtime-script-errors-in-documents><span class=secno>7.1.3.6.1 </span>Runtime script errors in documents</a></li>
+         <li><a href=#the-errorevent-interface><span class=secno>7.1.3.6.2 </span>The <code>ErrorEvent</code> interface</a></ol></ol></li>
      <li><a href=#event-loops><span class=secno>7.1.4 </span>Event loops</a>
       <ol>
        <li><a href=#definitions-1><span class=secno>7.1.4.1 </span>Definitions</a></li>
@@ -1174,8 +1175,9 @@
      <li><a href=#creating-workers><span class=secno>10.2.6 </span>Creating workers</a>
       <ol>
        <li><a href=#the-abstractworker-abstract-interface><span class=secno>10.2.6.1 </span>The <code>AbstractWorker</code> abstract interface</a></li>
-       <li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.2 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
-       <li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
+       <li><a href=#script-settings-for-workers><span class=secno>10.2.6.2 </span>Script settings for workers</a></li>
+       <li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.3 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
+       <li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.4 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
    <li><a href=#apis-available-to-workers><span class=secno>10.3 </span>APIs available to workers</a>
     <ol>
      <li><a href=#importing-scripts-and-libraries><span class=secno>10.3.1 </span>Importing scripts and libraries</a></li>
@@ -6681,7 +6683,8 @@
 
      <dt>If the URL came from a script (e.g. as an argument to a method)</dt>
 
-     <dd>The URL character encoding is the <a href="#script's-url-character-encoding">script's URL character encoding</a>.</dd>
+<!--CLEANUP-->
+     <dd>The URL character encoding is the <a href=#api-url-character-encoding>API URL character encoding</a> specified by the script's <a href=#settings-object>settings object</a>.</dd>
 
      <dt>If the URL came from a DOM node (e.g. from an element)</dt>
 
@@ -8387,10 +8390,12 @@
   their user interface. This is the primary mechanism by which a user can tell if a site is
   attempting to impersonate another.</p>
 
+<!--CLEANUP-->
   <p>When a <code><a href=#document>Document</a></code> is created by a <a href=#concept-script title=concept-script>script</a> using
   the <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> or <code title=dom-DOMImplementation-createHTMLDocument><a href=#dom-domimplementation-createhtmldocument>createHTMLDocument()</a></code> APIs, <a href="#the-document's-address">the
-  document's address</a> is the same as <a href="#the-document's-address">the document's address</a> of the <a href="#script's-document">script's
-  document</a>, and the <code><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
+  document's address</a> is the same as <a href="#the-document's-address">the document's address</a> of the <a href=#responsible-document>responsible
+  document</a> specified by the script's <a href=#settings-object>settings
+  object</a>, and the <code><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks>ready for post-load tasks</a> and
   <a href=#completely-loaded>completely loaded</a> immediately.</p>
 
   <p><dfn id="the-document's-referrer">The document's referrer</dfn> is an <a href=#absolute-url>absolute URL</a> that can be set when the
@@ -8820,6 +8825,8 @@
 
   </dl><div class=impl>
 
+<!--CLEANUP--><!-- multiple paragraphs -->
+
   <!-- these all return the same object each time because of a rule in
   the collection section -->
 
@@ -9086,8 +9093,10 @@
 --><li><p>Let <var title="">document</var> be the <code><a href=#xmldocument>XMLDocument</a></code> object on which the
    method was invoked.</li>
 
+<!--CLEANUP-->
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the method's first argument, relative to the
-   <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>. If this is not
+   <a href=#api-base-url>API base URL</a> specified by the
+   <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>. If this is not
    successful, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. Otherwise, let <var title="">url</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>
 
    <li><p>If the <a href=#origin>origin</a> of <var title="">url</var> is not the same as the
@@ -9112,9 +9121,10 @@
 
    <li><p>Let <var title="">success</var> be false.</li>
 
+<!--CLEANUP-->
    <li><p><a href=#fetch>Fetch</a><!--FETCH--> <var title="">url</var> from the <a href=#origin>origin</a> of
-   <var title="">document</var>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's
-   referrer source">referrer source</a>, with the <i title="">synchronous flag</i> set and the <i title="">force same-origin flag</i> set.</li>
+   <var title="">document</var>, using the <a href=#api-referrer-source>API referrer source</a> specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a>, with the <i title="">synchronous flag</i> set and the <i title="">force same-origin flag</i> set.</li>
 
    <li>
 
@@ -51847,29 +51857,33 @@
 
        <li>
 
+<!--CLEANUP-->
         <p>Let <var title="">old script element</var> be the value to which the
-        <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
+        <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
         initialized.</p>
 
        </li>
 
        <li>
 
-        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to the <code><a href=#the-script-element>script</a></code>
+<!--CLEANUP-->
+        <p>Initialize the <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to the <code><a href=#the-script-element>script</a></code>
         element.</p>
 
        </li>
 
        <li>
 
-        <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
-        <code><a href=#the-script-element>script</a></code> element node, using <var><a href="#the-script-block's-source">the script block's source</a></var>, the
-        <a href=#url>URL</a> from which the script was obtained, and <var><a href="#the-script-block's-type">the script block's
-        type</a></var>.</p>
+<!--CLEANUP-->
+        <p><a href=#create-a-script>Create a script</a>, using <var><a href="#the-script-block's-source">the script block's source</a></var>, the
+        <a href=#url>URL</a> from which the script was obtained, <var><a href="#the-script-block's-type">the script block's
+        type</a></var> as the scripting language, and the <a href=#script-settings-object>script settings object</a> of the <code><a href=#the-script-element>script</a></code> element's
+        <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>
 
+<!--CLEANUP-->
         <p>If the script came from a resource that was <a href=#fetch title=fetch>fetched</a> in the
-        steps above, and the resource was <a href=#cors-cross-origin>CORS-cross-origin</a>, then pass the <var title="">muted errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a>
-        algorithm.</p>
+        steps above, and the resource was <a href=#cors-cross-origin>CORS-cross-origin</a>, then pass the <var title="">muted errors</var> flag to the <a href=#create-a-script>create a script</a>
+        algorithm as well.</p>
 
         <p class=note>This is where the script is compiled and actually executed.</p>
 
@@ -51877,7 +51891,8 @@
 
        <li>
 
-        <p>Initialize the <code><a href=#document>Document</a></code> element's <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to <var title="">old script
+<!--CLEANUP-->
+        <p>Initialize the <code><a href=#the-script-element>script</a></code> element's <code><a href=#document>Document</a></code>'s <code title=dom-document-currentScript><a href=#dom-document-currentscript>currentScript</a></code> object to <var title="">old script
         element</var>.</p>
 
        </li>
@@ -64264,12 +64279,14 @@
   present, and as if all the properties of that <code><a href=#window>Window</a></code> object had their [[Enumerable]]
   attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
   script origin</a> that is not the same as the <code><a href=#window>Window</a></code> object's
   <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a separate set
   of objects. These objects must have the prototype chain appropriate for the script for which the
-  objects are created (not those that would be appropriate for scripts whose <a href="#script's-global-object">script's global
-  object</a> is the <code><a href=#window>Window</a></code> object in question).</p>
+  objects are created (not those that would be appropriate for scripts whose <a href=#global-object>global
+  object</a>, as specified by their <a href=#settings-object>settings object</a>,
+  is the <code><a href=#window>Window</a></code> object in question).</p>
 
   <div class=example>
 
@@ -64341,11 +64358,12 @@
 
   <p>The method has four arguments, though they are all optional.</p>
 
+<!--CLEANUP-->
   <p>The first argument, <var title="">url</var>, must be a <a href=#valid-non-empty-url>valid non-empty URL</a> for a
   page to load in the browsing context. If the first argument is the empty string, then the <var title="">url</var> argument must be interpreted as "<code><a href=#about:blank>about:blank</a></code>". Otherwise, the
   argument must be <a href=#resolve-a-url title="resolve a url">resolved</a> to an <a href=#absolute-url>absolute URL</a> (or
-  an error), relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-  URL</a>, when the method is invoked.</p>
+  an error), relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings 
+  object</a> when the method was invoked.</p>
 
   <p>The second argument, <var title="">target</var>, specifies the <a href=#browsing-context-name title="browsing context
   name">name</a> of the browsing context that is to be navigated. It must be a <a href=#valid-browsing-context-name-or-keyword>valid
@@ -64378,13 +64396,14 @@
   browsing context, then throw an <code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
   steps.</p>
 
+<!--CLEANUP-->
   <p>Otherwise, if <var title="">url</var> is not "<code><a href=#about:blank>about:blank</a></code>", the user agent must
   <a href=#navigate>navigate</a><!--DONAV window.open()--> the selected <a href=#browsing-context>browsing context</a> to the
   <a href=#absolute-url>absolute URL</a> obtained from <a href=#resolve-a-url title="resolve a url">resolving</a> <var title="">url</var> earlier. If the <var title="">replace</var> is true or if the <a href=#browsing-context>browsing
   context</a> was just created as part of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
   browsing context name</a>, then <a href=#replacement-enabled title="replacement enabled">replacement must be
-  enabled</a>. The navigation must be done with the <a href="#script's-browsing-context" title="script's browsing
-  context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source browsing
+  enabled</a>. The navigation must be done with the <a href=#responsible-browsing-context>responsible
+  browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a> as the <a href=#source-browsing-context>source browsing
   context</a>. If the <a href=#resolve-a-url>resolve a URL</a> algorithm failed, then the user agent may either
   instead <a href=#navigate>navigate</a> to an inline error page, using the same replacement behavior and
   source browsing context behavior as described earlier in this paragraph; or treat the <var title="">url</var> as "<code><a href=#about:blank>about:blank</a></code>", acting as described in the next paragraph.</p>
@@ -64415,11 +64434,15 @@
   <ul class=brief><li>The corresponding <a href=#browsing-context>browsing context</a> <var title="">A</var> is
    <a href=#script-closable>script-closable</a>.</li>
 
-   <li>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-   script</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>
+<!--CLEANUP-->
+   <li>The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+   script</a>'s <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar
+   with</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</li>
 
-   <li id=sandboxClose>The <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
-   <a href=#incumbent-script>incumbent script</a> is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
+<!--CLEANUP-->
+   <li id=sandboxClose>The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the
+   <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
+   is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
    context</a> <var title="">A</var>.</li>
 
   </ul><p>A <a href=#browsing-context>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if it is an <a href=#auxiliary-browsing-context>auxiliary
@@ -64462,13 +64485,15 @@
 
   </dl><div class=impl>
 
+<!--CLEANUP-->
   <p>The <dfn id=dom-length title=dom-length><code>length</code></dfn> IDL attribute on the <code><a href=#window>Window</a></code>
   interface must return the number of <a href=#child-browsing-context title="child browsing context">child browsing
   contexts</a> that are <a href=#browsing-context-nested-through title="browsing context nested through">nested through</a>
   elements that are <a href=#in-a-document title="in a document">in the <code>Document</code></a> that is the
   <a href=#active-document>active document</a> of that <code><a href=#window>Window</a></code> object, if that <code><a href=#window>Window</a></code>'s
-  <a href=#browsing-context>browsing context</a> shares the same <a href=#event-loop>event loop</a> as the <a href="#script's-browsing-context">script's
-  browsing context</a> of the <a href=#entry-script>entry script</a> accessing the IDL attribute; otherwise,
+  <a href=#browsing-context>browsing context</a> shares the same <a href=#event-loop>event loop</a> as the <a href=#responsible-document>responsible
+  document</a> specified by the <a href=#settings-object>settings object</a> of the
+  <a href=#entry-script>entry script</a> accessing the IDL attribute; otherwise,
   it must return zero.</p>
 
   <!-- in other words, frames are only accessible to same-thread processes -->
@@ -64585,8 +64610,10 @@
   objects have <a href=#implied-strong-reference title="implied strong reference">implied strong references</a> to the
   <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
 
-  <p>Each <a href=#concept-script title=concept-script>script</a> has a strong reference to its <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> and its <a href="#script's-document" title="script's
-  document">document</a>.</p>
+<!--CLEANUP-->
+  <p>Each <a href=#concept-script title=concept-script>script</a> has a strong reference to its <a href=#settings-object>settings
+  object</a>, and each <a href=#script-settings-object>script settings object</a>
+  has strong references to its <a href=#global-object>global object</a>, <a href=#responsible-browsing-context>responsible browsing context</a>, and <a href=#responsible-document>responsible document</a>.</p>
 
   <!-- discard a document -->
   <p>When a <a href=#browsing-context>browsing context</a> is to <dfn id=discard-a-document>discard a <code>Document</code></dfn>, the user
@@ -65921,8 +65948,9 @@
 
     <p>If the third argument is not null, run these substeps:</p>
 
-    <ol><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the third argument, relative to the
-     <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</li>
+    <ol><!--CLEANUP--><li><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the third argument, relative to the
+     <a href=#api-base-url>API base URL</a> specified by the
+     <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
      <li>If that fails, throw a <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
 
@@ -65932,9 +65960,10 @@
      <a href=#concept-url-query title=concept-url-query>query</a>, and <a href=#concept-url-fragment title=concept-url-fragment>fragment</a> components, then throw a
      <code><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</li>
 
+<!--CLEANUP-->
      <li>If the <a href=#origin>origin</a> of the resulting <a href=#absolute-url>absolute URL</a> is not the same as
-     the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
-     document">document</a>, and either the <a href=#concept-url-path title=concept-url-path>path</a> or <a href=#concept-url-query title=concept-url-query>query</a> components of the two <a href=#parsed-url title="parsed URL">parsed
+     the <a href=#origin>origin</a> of the <a href=#responsible-document>responsible document</a> specified by the <a href=#entry-script>entry script</a>'s
+     <a href=#settings-object>settings object</a>, and either the <a href=#concept-url-path title=concept-url-path>path</a> or <a href=#concept-url-query title=concept-url-query>query</a> components of the two <a href=#parsed-url title="parsed URL">parsed
      URLs</a> compared in the previous step differ, throw a <code><a href=#securityerror>SecurityError</a></code> exception
      and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
      origin.)</li>
@@ -66189,9 +66218,10 @@
   <p>The <i>relevant <code><a href=#document>Document</a></code></i> is the <code><a href=#location>Location</a></code> object's associated
   <code><a href=#document>Document</a></code> object's <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a>.</p>
 
+<!--CLEANUP-->
   <p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn>
   method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
-  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
+  to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>, and if that is
   successful, must <a href=#navigate>navigate</a><!--DONAV location.href/assign--> the <a href=#browsing-context>browsing
   context</a> to the specified <var title="">url</var>. If the <a href=#browsing-context>browsing context</a>'s
   <a href=#session-history>session history</a> contains only one <code><a href=#document>Document</a></code>, and that was the
@@ -66201,14 +66231,16 @@
   Safari doesn't check that. Thus this might need changing if testing shows the IE/Firefox behaviour
   is required here. -->
 
+<!--CLEANUP-->
   <p>When the <dfn id=dom-location-replace title=dom-location-replace><code>replace(<var title="">url</var>)</code></dfn>
   method is invoked, the UA must <a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative
-  to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, and if that is
+  to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>, and if that is
   successful, <a href=#navigate>navigate</a><!--DONAV location.href/replace--> the <a href=#browsing-context>browsing
   context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>
 
-  <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href="#script's-browsing-context" title="script's
-  browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <a href=#source-browsing-context>source
+<!--CLEANUP-->
+  <p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href=#responsible-browsing-context>responsible browsing context</a> specified by
+  the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a> as the <a href=#source-browsing-context>source
   browsing context</a>.</p>
 
   <p>If the <a href=#resolve-a-url title="resolve a url">resolving</a> step of the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods is not successful, then the user agent must
@@ -66272,9 +66304,10 @@
   input</a> algorithm with <a href="#the-document's-address" title="the document's address">the address</a> of the
   <i>relevant <code><a href=#document>Document</a></code></i> as the given value.</p>
 
+<!--CLEANUP-->
   <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base title=concept-uu-get-the-base>get the
-  base</a> algorithm must return the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base
-  URL">base URL</a>, if there is one, or null otherwise.</p>
+  base</a> algorithm must return the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s
+  <a href=#settings-object>settings object</a>, if there is one, or null otherwise.</p>
 
   <p>The element's <code><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding title=concept-uu-query-encoding>query
   encoding</a> is the <a href="#document's-character-encoding">document's character encoding</a>.</p>
@@ -66326,12 +66359,15 @@
   context</a>'s <a href=#active-document>active document</a>'s <a href=#effective-script-origin>effective script origin</a>, with the
   following exceptions:</p>
 
-  <ul><li>The <code title=dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#entry-script>entry script</a>'s
-   <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing
+  <ul><!--CLEANUP--><li>The <code title=dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#responsible-browsing-context>responsible browsing context</a>
+   specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar with</a> the <a href=#browsing-context>browsing
    context</a> with which the <code><a href=#location>Location</a></code> object is associated
 
-   <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#entry-script>entry
-   script</a>'s <a href="#script's-browsing-context">script's browsing context</a> is <a href=#familiar-with>familiar with</a> the
+<!--CLEANUP-->
+   <li>The <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#responsible-browsing-context>responsible
+   browsing context</a> specified by the <a href=#entry-script>entry script</a>'s
+   <a href=#settings-object>settings object</a> is <a href=#familiar-with>familiar with</a> the
    <a href=#browsing-context>browsing context</a> with which the <code><a href=#location>Location</a></code> object is associated
 
    <li>Any properties not defined in the IDL for the <code><a href=#location>Location</a></code> object or indirectly via
@@ -66345,12 +66381,13 @@
   properties, getters, setters, etc, were not present, and as if all the properties of that
   <code><a href=#location>Location</a></code> object had their [[Enumerable]] attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin>effective
   script origin</a> that is not the <a href=#same-origin>same origin</a> as the <code><a href=#location>Location</a></code>
   object's <code><a href=#document>Document</a></code>'s <a href=#effective-script-origin>effective script origin</a> must be provided with a
   separate set of objects. These objects must have the prototype chain appropriate for the script
   for which the objects are created (not those that would be appropriate for scripts whose
-  <a href="#script's-global-object">script's global object</a> is the <code><a href=#location>Location</a></code> object's <code><a href=#document>Document</a></code>'s
+  <a href=#settings-object>settings object</a> specifies a <a href=#global-object>global object</a> that is the <code><a href=#location>Location</a></code> object's <code><a href=#document>Document</a></code>'s
   <code><a href=#window>Window</a></code> object).</p>
 
   </div>
@@ -67757,7 +67794,7 @@
 
   <ol><li>
 
-    <p><a href=#make-disappear>Make disappear</a> any <code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor whose global object is the
+    <p><a href=#make-disappear>Make disappear</a> any <code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor from the
     <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</p>
 
     <p>If this affected any <code><a href=#websocket>WebSocket</a></code> objects, then set <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.</p>
@@ -69915,27 +69952,28 @@
     information).</p>
 
    </dd>
-<!--
-   <dt>A relationship with a <span>script settings object</span></dt>
 
+   <dt>A <dfn id=settings-object>settings object</dfn></dt>
+
    <dd>
 
-    <p>An object (defined below) that describes various settings that can be shared with other
-    scripts.</p>
+    <p>A <a href=#script-settings-object>script settings object</a>, various settings that are shared with other scripts in
+    the same context.</p>
 
    </dd>
 
-  </dl>
+   <dt>An <dfn title="">owner</dfn>, <dfn title="">origin</dfn>, and <dfn title="">effective origin</dfn></dt>
 
-  <hr>
+   <dd>
 
-  <p>Each global object has a <dfn>script settings object</dfn> shared by the scripts that use that
-  global object. A <span>script settings object</span> consists of the following:</p>
+    <p>There are defined in the <a href=#origin>origin</a> section.</p>
 
-  <dl>
--->
-   <dt>A <dfn id=script-execution-environment>script execution environment</dfn></dt>
+   </dd>
 
+  </dl><hr><p>A <dfn id=script-settings-object>script settings object</dfn> specifies algorithms for obtaining the following:</p>
+
+  <dl><dt>A <dfn id=script-execution-environment>script execution environment</dfn> for each language supported by the user agent</dt>
+
    <dd>
 
     <p>The characteristics of the script execution environment depend on the language, and are not
@@ -69947,19 +69985,18 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-global-object">script's global object</dfn></dt>
-
+   <dt>A <dfn id=global-object>global object</dfn></dt>
    <dd>
 
-    <p>An object that provides the APIs that the code can use.</p>
+    <p>An object that provides the APIs that can be called by the code in scripts that use this
+    <a href=#script-settings-object title="script settings object">settings object</a>.</p>
 
-    <p class=example>This is typically a <code><a href=#window>Window</a></code> object. In JavaScript, this
-    corresponds to the <i>global object</i>.</p>
+    <p class=note>This is typically a <code><a href=#window>Window</a></code> object or a
+    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object. When a <a href=#global-object>global object</a> is an empty object, it
+    can't do anything that interacts with the environment.</p>
 
-    <p class=note>When a <a href="#script's-global-object">script's global object</a> is an empty object, it can't do
-    anything that interacts with the environment.</p>
-
-    <p>If the <a href="#script's-global-object">script's global object</a> is a <code><a href=#window>Window</a></code> object, then in
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> is a <code><a href=#window>Window</a></code> object, then, in
     JavaScript, the ThisBinding of the global execution context for this script must be the
     <code><a href=#window>Window</a></code> object's <code><a href=#windowproxy>WindowProxy</a></code> object, rather than the global object. <a href=#refsECMA262>[ECMA262]</a></p>
 
@@ -69970,70 +70007,148 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-browsing-context">script's browsing context</dfn></dt>
+   <dt>A <dfn id=responsible-browsing-context>responsible browsing context</dfn></dt>
 
    <dd>
 
     <p>A <a href=#browsing-context>browsing context</a> that is assigned responsibility for actions taken by the
-    script.</p>
+    scripts that use this <a href=#script-settings-object>script settings object</a>.</p>
 
     <p class=example>When a script creates and <a href=#navigate title=navigate>navigates</a> a new
-    <a href=#top-level-browsing-context>top-level browsing context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute of
-    the new <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object will be set to the
-    <a href="#script's-browsing-context">script's browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
+    <a href=#top-level-browsing-context>top-level browsing context</a>, the <code title=dom-opener><a href=#dom-opener>opener</a></code> attribute
+    of the new <a href=#browsing-context>browsing context</a>'s <code><a href=#window>Window</a></code> object will be set to the
+    <a href=#responsible-browsing-context>responsible browsing context</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object.</p>
 
    </dd>
 
-   <dt>A relationship with the <dfn id="script's-document">script's document</dfn></dt>
+   <dt>A <dfn id=responsible-document>responsible document</dfn></dt>
 
    <dd>
 
-    <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the script.</p>
+    <p>A <code><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the scripts that
+    use this <a href=#script-settings-object>script settings object</a>.</p>
 
+<!--CLEANUP-->
     <p class=example>For example, the <a href="#the-document's-address" title="the document's address">address</a> of the
-    <a href="#script's-document">script's document</a> is used to set the <a href="#the-document's-address" title="the document's
-    address">address</a> of any <code><a href=#document>Document</a></code> elements created using <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>.</p>
+    <a href=#responsible-document>responsible document</a> is used to set the <a href="#the-document's-address" title="the document's
+    address">address</a> of any <code><a href=#document>Document</a></code>s created using <code title=dom-DOMImplementation-createDocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code>.</p>
 
    </dd>
 
-   <dt>The <dfn id="script's-referrer-source">script's referrer source</dfn></dt>
+   <dt>A <dfn id=responsible-event-loop>responsible event loop</dfn></dt>
 
    <dd>
 
-    <p>Either a <code><a href=#document>Document</a></code> (specifically, the <a href="#script's-document">script's document</a>), or a
+    <p>An <a href=#event-loop>event loop</a> that is used when it would not be immediately clear what event
+    loop to use.</p>
+
+   </dd>
+
+   <dt>An <dfn id=api-referrer-source>API referrer source</dfn></dt>
+
+   <dd>
+
+    <p>Either a <code><a href=#document>Document</a></code> (specifically, the <a href=#responsible-document>responsible document</a>), or a
     <a href=#url>URL</a>, which is used by some APIs to determine what value to use for the <code title=http-referer>Referer</code> (sic) header in calls to the <a href=#fetch title=fetch>fetching</a> algorithm.</p>
 
    </dd>
 
-   <dt>A <dfn id="script's-url-character-encoding" title="script's URL character encoding">URL character encoding</dfn></dt>
+   <dt>An <dfn id=api-url-character-encoding>API URL character encoding</dfn></dt>
 
    <dd>
 
-    <p>A character encoding, set when the script is created, used to encode URLs. <span id=sce-not-copy title="">If the character encoding is set from another source, e.g. a
-    <a href="#document's-character-encoding">document's character encoding</a>, then the <a href="#script's-url-character-encoding">script's URL character
-    encoding</a> must follow the source, so that if the source's changes, so does the
-    script's.</span></p>
+<!--CLEANUP-->
+    <p>A character encoding used to encode URLs by APIs called by scripts that use
+    this <a href=#script-settings-object>script settings object</a>.</p>
 
    </dd>
 
-   <dt>A <dfn id="script's-base-url" title="script's base URL">base URL</dfn></dt>
+   <dt>An <dfn id=api-base-url>API base URL</dfn></dt>
 
    <dd>
 
-    <p>A <a href=#url>URL</a>, set when the script is created, used to resolve <a href=#relative-url title="relative
-    URL">relative URLs</a>. <span id=sbu-not-copy title="">If the base URL is set from another
-    source, e.g. a <a href=#document-base-url>document base URL</a>, then the <a href="#script's-base-url">script's base URL</a> must
-    follow the source, so that if the source's changes, so does the script's.</span></p>
+<!--CLEANUP-->
+    <p>An <a href=#absolute-url>absolute URL</a> used by APIs called by scripts that use
+    this <a href=#script-settings-object>script settings object</a> to resolve <a href=#relative-url title="relative
+    URL">relative URLs</a>.</p>
 
    </dd>
 
-  </dl></div>
+  </dl><h5 id=script-settings-for-browsing-contexts><span class=secno>7.1.3.2 </span>Script settings for browsing contexts</h5>
 
+  <p>Whenever a new <code><a href=#window>Window</a></code> object is created, it must also create a <a href=#script-settings-object>script
+  settings object</a> whose algorithms are defined as follows:</p>
 
-  <div class=impl>
+  <dl><dt>The <a href=#script-execution-environment title="script execution environment">script execution environments</a></dt>
+   <dd>
 
-  <h5 id=calling-scripts><span class=secno>7.1.3.2 </span>Calling scripts</h5>
+    <p>When the <a href=#script-settings-object>script settings object</a> is created, for each language supported by the
+    user agent, create an appropriate execution environment as defined by the relevant
+    specification.</p>
 
+    <p>When a <a href=#script-execution-environment>script execution environment</a> is needed, return the appropriate one from
+    those created when the <a href=#script-settings-object>script settings object</a> was created.</p>
+
+   </dd>
+
+   <dt>The <a href=#global-object>global object</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#window>Window</a></code> object itself.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-browsing-context>responsible browsing context</a></dt>
+   <dd>
+
+    <p>Return the <a href=#browsing-context>browsing context</a> with which the <code><a href=#window>Window</a></code> object is
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-document>responsible document</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#responsible-event-loop>responsible event loop</a></dt>
+   <dd>
+
+    <p>Return the <a href=#event-loop>event loop</a> that is associated with the <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related
+    similar-origin browsing contexts</a> to which the <code><a href=#window>Window</a></code> object's <a href=#browsing-context>browsing
+    context</a> belongs.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-referrer-source>API referrer source</a></dt>
+   <dd>
+
+    <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-url-character-encoding>API URL character encoding</a></dt>
+   <dd>
+
+    <p>Return the current <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of
+    the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently associated.</p>
+
+   </dd>
+
+   <dt>The <a href=#api-base-url>API base URL</a></dt>
+   <dd>
+
+    <p>Return the current <a href=#document-base-url title="document base URL">base URL</a> of the
+    <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently associated.</p>
+
+   </dd>
+
+  </dl><h5 id=calling-scripts><span class=secno>7.1.3.3 </span>Calling scripts</h5>
+
   <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=stack-of-incumbent-scripts>stack of
   incumbent scripts</dfn>, which must be initially empty. When a new script is <i>pushed</i> onto
   this stack, the specified script is to be added to the stack; when the script on this stack that
@@ -70048,8 +70163,10 @@
    new incumbent <a href=#concept-script title=concept-script>script</a> and the owner <a href=#concept-script title=concept-script>script</a>. If this returns "do not run" then abort these
    steps.</li>
 
-   <li><p>Make the <a href=#script-execution-environment title="script execution environment">script execution environment</a>
-   for <var title="">s</var> execute the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
+<!--CLEANUP-->
+   <li><p>Make the appropriate <a href=#script-execution-environment>script execution environment</a>
+   specified by <var title="">s</var>'s <a href=#settings-object>settings
+   object</a> execute the <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
    entry-point</a>.</li>
 
    <li><p><a href=#clean-up-after-running-a-callback>Clean up after running a callback</a>.</li>
@@ -70059,11 +70176,12 @@
   <a href=#concept-script title=concept-script>script</a> <var title="">o</var>, and return either "run" or "do
   not run".</p>
 
-  <ol><li><p>If the <a href="#script's-global-object" title="script's global object">global object</a> of <var title="">o</var>
+  <ol><!--CLEANUP--><li><p>If the <a href=#global-object>global object</a> specified by <var title="">o</var>'s <a href=#settings-object>settings object</a>
    is a <code><a href=#window>Window</a></code> object whose <code><a href=#document>Document</a></code> object is not <a href=#fully-active>fully
    active</a>, then return "do not run" and abort these steps.</p>
 
-   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> for <var title="">o</var>'s <a href="#script's-browsing-context" title="script's browsing context">browsing context</a>, then return
+<!--CLEANUP-->
+   <li><p>If <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a> for the <a href=#responsible-browsing-context>responsible browsing context</a> specified by <var title="">o</var>'s <a href=#settings-object>settings object</a>, then return
    "do not run" and abort these steps.</p>
 
    <li><p>Push <var title="">s</var> onto the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a>, and label it
@@ -70102,7 +70220,7 @@
   <p>The <dfn id=entry-script>entry script</dfn> is the most-recently added <a href=#concept-script title=concept-script>script</a> in the <a href=#stack-of-incumbent-scripts>stack of incumbent scripts</a> that is
   labeled as a <a href=#candidate-entry-scripts title="candidate entry scripts">candidate entry script</a>. If the stack is
   empty, or has no entries labeled as such, then there is no <a href=#entry-script>entry script</a>. It is used
-  to obtain, amongst other things, the <a href="#script's-base-url">script's base URL</a> to <a href=#resolve-a-url title="resolve a
+  to obtain, amongst other things, the <a href=#api-base-url>API base URL</a> to <a href=#resolve-a-url title="resolve a
   url">resolve</a> relative <a href=#url title=URL>URLs</a> used in scripts running in that
   <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
 
@@ -70134,12 +70252,11 @@
 
   <div class=impl>
 
-  <h5 id=creating-scripts><span class=secno>7.1.3.3 </span>Creating scripts</h5>
+  <h5 id=creating-scripts><span class=secno>7.1.3.4 </span>Creating scripts</h5>
 
   <p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script title="create a script">created</dfn>, given some script source, a script source URL, its
-  scripting language, a global object, a browsing context, a document, a referrer source, a URL
-  character encoding, a base URL, and optionally a <var title="">muted errors</var> flag, the user
-  agent must run the following steps:</p>
+  scripting language, a <a href=#script-settings-object>script settings object</a>, and optionally a <var title="">muted
+  errors</var> flag, the user agent must run the following steps:</p>
 
   <ol><li><p>Let <var title="">script</var> be a new <a href=#concept-script title=concept-script>script</a> that
    this algorithm will subsequently initialize.</li>
@@ -70148,16 +70265,14 @@
    context</a> passed to this algorithm, then abort these steps, as if the script source
    described a program that did nothing but return void.</p>
 
-   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> as appropriate for the given scripting
-   language.</li>
+   <li><p>Obtain the appropriate <a href=#script-execution-environment>script execution environment</a> for the given scripting
+   language from the <a href=#script-settings-object>script settings object</a> provided.</li>
 
    <li><p>Parse/compile/initialize the source of the script using the <a href=#script-execution-environment>script execution
    environment</a>, as appropriate for the scripting language, and thus obtain <var title="">script</var>'s <a href=#code-entry-point>code entry-point</a>.</li>
 
-   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the <a href="#script's-browsing-context">script's browsing
-   context</a>, the <a href="#script's-document">script's document</a>, the <a href="#script's-referrer-source">script's referrer source</a>,
-   the <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the <a href="#script's-base-url">script's base URL</a> from the
-   settings passed to this algorithm.</li>
+   <li><p>Let <var title="">script</var>'s <a href=#settings-object>settings object</a> be the <a href=#script-settings-object>script
+   settings object</a> provided.</li>
 
    <li><p>If the <var title="">muted errors</var> flag was set, then set <var title="">script</var>'s <a href=#muted-errors>muted errors</a> flag.</li>
 
@@ -70167,45 +70282,20 @@
     <a href=#jump-to-a-code-entry-point title="jump to a code entry-point">Jump</a> to <var title="">script</var>'s <a href=#code-entry-point>code
     entry-point</a>.</p>
 
+<!--CLEANUP-->
     <p>Otherwise, <a href=#report-the-error>report the error</a> for <var title="">script</var>, with the problematic
-    position (line number and column number), using the <a href="#script's-global-object">script's global object</a> as the
+    position (line number and column number), using the <a href=#global-object>global object</a> specified by the <a href=#script-settings-object>script settings object</a> as the
     target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this,
     then the error may be reported to the user.</p>
 
    </li>
 
-  </ol><hr><p>When the specification says that a <a href=#concept-script title=concept-script>script</a> is to be <dfn id=create-a-script-from-a-node title="create a script from a node">created from a node</dfn> <var title="">node</var>, given some
-  script source, its URL, its scripting language, and optionally a <var title="">muted errors</var>
-  flag, the user agent must <a href=#create-a-script>create a script</a>, using the given script source, URL, and
-  scripting language, <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> <var title="">node</var>, and, if the <var title="">muted errors</var> flag was set in the call to this
-  algorithm, the <var title="">muted errors</var> flag.</p>
-
-  <p><dfn id=the-script-settings-determined-from-the-node>The script settings determined from the node</dfn> <var title="">node</var> are computed
-  as follows:</p>
-
-  <ol><li><p>Let <var title="">document</var> be the <code><a href=#document>Document</a></code> of <var title="">node</var>
-   (or <var title="">node</var> itself if it is a <code><a href=#document>Document</a></code>).</li>
-
-   <li><p>The global object is the <code><a href=#window>Window</a></code> object of <var title="">document</var>.</li>
-
-   <li><p>The browsing context is the <a href=#browsing-context>browsing context</a> of <var title="">document</var>.</p>
-
-   <li><p>The document is <var title="">document</var>.</p>
-
-   <li><p>The referrer source is <var title="">document</var>.</p>
-
-   <li><p>The URL character encoding is the <a href="#document's-character-encoding" title="document's character encoding">character
-   encoding</a> of <var title="">document</var>. (<a href=#sce-not-copy>This is a reference,
-   not a copy</a>.)</li>
-
-   <li><p>The base URL is the <a href=#document-base-url title="document base URL">base URL</a> of <var title="">document</var>. (<a href=#sbu-not-copy>This is a reference, not a copy</a>.)</li>
-
   </ol></div>
 
 
   <div class=impl>
 
-  <h5 id=killing-scripts><span class=secno>7.1.3.4 </span>Killing scripts</h5>
+  <h5 id=killing-scripts><span class=secno>7.1.3.5 </span>Killing scripts</h5>
 
   <p>User agents may impose resource limitations on scripts, for example CPU quotas, memory limits,
   total execution time limits, or bandwidth limitations. When a script exceeds a limit, the user
@@ -70241,7 +70331,7 @@
 
   <div class=impl>
 
-  <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script errors</h5>
+  <h5 id=runtime-script-errors><span class=secno>7.1.3.6 </span>Runtime script errors</h5>
 
   <p>When the user agent is required to <dfn id=report-the-error title="report the error">report an error</dfn> for a
   particular <a href=#concept-script title=concept-script>script</a> <var title="">script</var> with a particular
@@ -70314,11 +70404,12 @@
 
    <li><p>If <var title="">event</var> was canceled, then the error is <i title=concept-error-handled><a href=#concept-error-handled>handled</a></i>. Otherwise, the error is <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.</p>
 
-  </ol><h6 id=runtime-script-errors-in-documents><span class=secno>7.1.3.5.1 </span>Runtime script errors in documents</h6>
+  </ol><h6 id=runtime-script-errors-in-documents><span class=secno>7.1.3.6.1 </span>Runtime script errors in documents</h6>
 
+<!--CLEANUP-->
   <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
   <code><a href=#document>Document</a></code>, the user agent must <a href=#report-the-error>report the error</a> for the relevant <a href=#concept-script title=concept-script>script</a>, with the problematic position (line number and column
-  number) in the resource containing the script, using the <a href="#script's-global-object">script's global object</a> as
+  number) in the resource containing the script, using the <a href=#global-object>global object</a> specified by the script's <a href=#settings-object>settings object</a> as
   the target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this,
   then the error may be reported to the user.</p>
 
@@ -70326,7 +70417,7 @@
 
 
 
-  <h6 id=the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code><a href=#errorevent>ErrorEvent</a></code> interface</h6>
+  <h6 id=the-errorevent-interface><span class=secno>7.1.3.6.2 </span>The <code><a href=#errorevent>ErrorEvent</a></code> interface</h6>
 
   <pre class=idl>[Constructor(DOMString type, optional <a href=#erroreventinit>ErrorEventInit</a> eventInitDict)]
 interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event>Event</a> {
@@ -70437,7 +70528,7 @@
   the task was queued in the context of a <a href=#browsing-context>browsing context</a>, then it is the
   <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> at the time the task was queued; if
   the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is
-  the <a href="#script's-document">script's document</a>.</p>
+  the <a href=#responsible-document>responsible document</a> specified by the script's <a href=#settings-object>settings object</a>.</p>
 
   <p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
   the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>
@@ -70529,9 +70620,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><a href=#concept-mo-invoke title=concept-mo-invoke>Invoke <code>MutationObserver</code> objects</a> for the
-    <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> to which the <a href="#script's-browsing-context">script's
-    browsing context</a> belongs, using the <a href=#task-wrapper-algorithm>task wrapper algorithm</a> as the steps to
+    <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> to which the <a href=#responsible-browsing-context>responsible
+    browsing context</a> specified by the script's <a href=#settings-object>settings object</a> belongs, using the <a href=#task-wrapper-algorithm>task wrapper algorithm</a> as the steps to
     invoke each callback.</p>
 
     <p class=note>This will typically invoke scripted callbacks, which calls the <a href=#jump-to-a-code-entry-point>jump to a
@@ -70716,10 +70808,10 @@
       context</a> being navigated has a <a href=#creator-browsing-context>creator browsing context</a>, then let <var title="">address</var> be the <a href="#the-document's-address" title="the document's address">address</a> of the
       <a href=#creator-document>creator <code>Document</code></a> instead.</p>
 
-      <p><a href=#create-a-script-from-a-node title="create a script from a node">Create a script</a> from the
-      <code><a href=#document>Document</a></code> node of the <a href=#active-document>active document</a>, using the aforementioned
-      script source, the <a href=#url>URL</a> of the resource where the <code>javascript:</code> URL,
-      was found, and assuming the scripting language is JavaScript.</p>
+      <p><a href=#create-a-script>Create a script</a>, using the aforementioned script source, the <a href=#url>URL</a>
+      of the resource where the <code>javascript:</code> URL, was found, JavaScript as the scripting
+      language, and the <a href=#script-settings-object>script settings object</a> of the <code><a href=#window>Window</a></code> object of the
+      <a href=#active-document>active document</a>.</p>
 
       <p>Let <var title="">result</var> be the return value of the <a href=#code-entry-point>code entry-point</a>
       of this <a href=#concept-script title=concept-script>script</a>. If an exception was thrown, let <var title="">result</var> be void instead. (The result will be void also if <a href=#concept-bc-noscript title=concept-bc-noscript>scripting is disabled</a>.)</p>
@@ -70846,8 +70938,12 @@
 
   <ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to null.</li>
 
-   <li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for JavaScript.</li>
+   <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a> of the
+   <code><a href=#window>Window</a></code> object associated with the <a href=#browsing-context>browsing context</a> to which belongs the
+   <code><a href=#document>Document</a></code> of the element in question.</li>
 
+   <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
+
    <li><p>Let <var title="">body</var> be the <a href=#event-handler-content-attributes title="event handler content attributes">event
    handler content attribute</a>'s new value.</li>
 
@@ -70890,7 +70986,8 @@
 
    <li>
 
-    <p>Using the script execution environment created above, create a function object (as defined in
+<!--CLEANUP-->
+    <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function object (as defined in
     ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
 
     <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
@@ -70939,15 +71036,12 @@
 
      <dd>The value of <var title="">strict</var>.</dd>
 
-    </dl><p>Let this new function be the script's <a href=#code-entry-point>code entry-point</a>.</p>
+    </dl><!--CLEANUP--><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code entry-point</a>.</p>
 
    </li>
 
-   <li><p>Set up the <a href="#script's-global-object">script's global object</a>, the <a href="#script's-browsing-context">script's browsing
-   context</a>, the <a href="#script's-document">script's document</a>, the <a href="#script's-referrer-source">script's referrer source</a>,
-   the <a href="#script's-url-character-encoding">script's URL character encoding</a>, and the <a href="#script's-base-url">script's base URL</a> from
-   <a href=#the-script-settings-determined-from-the-node>the script settings determined from the node</a> on which the attribute is being
-   set.</li>
+   <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
+   <var title="">script settings</var>.</li>
 
    <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to the
    aforementioned function.</li>
@@ -71745,15 +71839,22 @@
    <li><p>Remove all child nodes of the document, without firing any mutation events.</li> <!--
    as of 2009-03-30, only WebKit fired mutation events here. -->
 
-   <li><p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
-   (This includes in particular the <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>,
-   <code><a href=#history-0>History</a></code>, <code><a href=#applicationcache>ApplicationCache</a></code>, and <code><a href=#navigator>Navigator</a></code>, objects, the
-   various <code><a href=#barprop>BarProp</a></code> objects, the two <code><a href=#storage-0>Storage</a></code> objects, the various
-   <code><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
-   <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
-   IDL prototypes in the JavaScript binding, including the <code><a href=#document>Document</a></code> object's
-   prototype.)</li>
+   <li>
 
+    <p>Replace the <code><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
+    (This includes in particular the <code><a href=#window>Window</a></code>, <code><a href=#location>Location</a></code>,
+    <code><a href=#history-0>History</a></code>, <code><a href=#applicationcache>ApplicationCache</a></code>, and <code><a href=#navigator>Navigator</a></code>, objects, the
+    various <code><a href=#barprop>BarProp</a></code> objects, the two <code><a href=#storage-0>Storage</a></code> objects, the various
+    <code><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
+    <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
+    IDL prototypes in the JavaScript binding, including the <code><a href=#document>Document</a></code> object's
+    prototype.)</p>
+
+    <p class=note>The new <code><a href=#window>Window</a></code> object has a new <a href=#script-settings-object>script settings
+    object</a>.</p>
+
+   </li>
+
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%20src%3D%22document%22%3E%3C%2Fiframe%3E%0A%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20f%20%3D%20document.getElementsByTagName('iframe')%5B0%5D%3B%20d%20%3D%20f.contentWindow.document%3B%20%7D%3C%2Fscript%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22w(d.documentElement.innerHTML)%22%20value%3D%22dump%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cscript%3Evar%20x%20%3D%20new%20XMLHttpRequest()%3Bx.open(%26quot%3BGET%26quot%3B%2C%20%26quot%3BGET%26quot%3B)%3Bx.onreadystatechange%3Dfunction()%20%7B%20alert(x.readyState)%3B%20%7D%3Bx.send(null)%3B%3C%2Fscript%3E')%3Bd.close()%3B%20setTimeout(function()%20%7B%20d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%20%7D%2C%200)%3B%22%20value%3D%22xhr%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.onclick%20%3D%20function()%20%7B%20w('click')%20%7D%22%20value%3D%22add%20click%20handler%22%3E%
 0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3E%3Cscript%3Ei%20%3D%200%3B%20setTimeout(%26quot%3Bparent.w(i%2B%2B)%26quot%3B%2C%202000)%3C%2Fscript%3E%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%20with%20timer%22%3E -->
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%3E%3C%2Fiframe%3E%0D%0A%3Cscript%3E%0D%0Aonload%20%3D%20function%20()%20%7B%0D%0A%20frames%5B0%5D.test%20%3D%201%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20var%20a%20%3D%20frames%5B0%5D.document.location.assign%3B%0D%0A%20w(a)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%20frames%5B0%5D.document.open()%3B%0D%0A%20frames%5B0%5D.document.write('%3Cscript%3Edocument.write(test)%3C%5C%2Fscript%3E')%3B%0D%0A%20frames%5B0%5D.document.close()%3B%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E -->
 
@@ -71765,8 +71866,10 @@
 
    <li><p>Set the <code><a href=#document>Document</a></code>'s <i title=concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state back to true.</li>
 
-   <li><p>Change <a href="#the-document's-address">the document's address</a> to the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's document">document</a>'s <a href="#the-document's-address" title="the document's
-   address">address</a>.</li>
+<!--CLEANUP-->
+   <li><p>Change <a href="#the-document's-address">the document's address</a> to the <a href="#the-document's-address" title="the document's
+   address">address</a> of the <a href=#responsible-document>responsible document</a> specified by
+   the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
    <!-- <span>the document's referrer</span> stays the same -->
 
@@ -72197,32 +72300,14 @@
 
          <li><p>Let <var title="">script language</var> be JavaScript.</li>
 
-         <li>
+         <li><p>Let <var title="">settings object</var> be <var title="">method context</var>'s
+         <a href=#script-settings-object>script settings object</a>.</li>
 
-          <p>If <var title="">method context</var> is a <code><a href=#window>Window</a></code> object, let <var title="">global object</var> be <var title="">method context</var>, let <var title="">browsing context</var> be the <a href=#browsing-context>browsing context</a> with which <var title="">global object</var> is associated, let <var title="">document</var> and <var title="">referrer source</var> be the <code><a href=#document>Document</a></code> associated with <var title="">global object</var>, let <var title="">character encoding</var> be the <a href="#document's-character-encoding" title="document's character encoding">character encoding</a> of the <code><a href=#document>Document</a></code>
-          associated with <var title="">global object</var> (<a href=#sce-not-copy>this is a
-          reference, not a copy</a>), and let <var title="">base URL</var> be the <a href=#document-base-url title="document base URL">base URL</a> of the <code><a href=#document>Document</a></code> associated with <var title="">global object</var> (<a href=#sbu-not-copy>this is a reference, not a
-          copy</a>).</p>
+         <li><!--CLEANUP--><!--no need for all this whitespace-->
 
-          <p>Otherwise, <var title="">method context</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
-          let <var title="">global object</var>, <var title="">browsing context</var>, <var title="">document</var>, <var title="">referrer source</var>, <var title="">character
-          encoding</var>, and <var title="">base URL</var> be the <a href="#script's-global-object">script's global object</a>,
-          <a href="#script's-browsing-context">script's browsing context</a>, <a href="#script's-document">script's document</a>, <a href="#script's-referrer-source">script's
-          referrer source</a>, <a href="#script's-url-character-encoding">script's URL character encoding</a>, and <a href="#script's-base-url">script's
-          base URL</a> (respectively) of the <a href=#concept-script title=concept-script>script</a> that the
-          <a href=#run-a-worker>run a worker</a> algorithm created when it created <var title="">method
-          context</var>.</p>
-
-         </li>
-
-         <li>
-
           <p><a href=#create-a-script>Create a script</a> using <var title="">script source</var> as the script
-          source, the <a href=#url>URL</a> where <var title="">script source</var> can be found, <var title="">scripting language</var> as the scripting language, <var title="">global
-          object</var> as the global object, <var title="">browsing context</var> as the browsing
-          context, <var title="">document</var> as the document, <var title="">referrer source</var>
-          as the referrer source, <var title="">character encoding</var> as the URL character
-          encoding, and <var title="">base URL</var> as the base URL.</p>
+          source, the <a href=#url>URL</a> where <var title="">script source</var> can be found, <var title="">scripting language</var> as the scripting language, and <var title="">settings
+          object</var> as the <a href=#script-settings-object>script settings object</a>.</p>
 
          </li>
 
@@ -72230,7 +72315,7 @@
 
       </dl></li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>If the <var title="">repeat</var> flag is true, then call <a href=#timer-initialization-steps>timer initialization
       steps</a> again, passing them the same method arguments, the same <var title="">method
@@ -72569,7 +72654,8 @@
   <ol><li>
 
     <p><a href=#resolve-a-url title="resolve a url">Resolve</a> <var title="">url</var> relative to the
-    <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>.</p>
+    <a href=#api-base-url>API base URL</a> specified by
+    <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</p>
 
     <p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
 
@@ -72598,9 +72684,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of the
-    <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-    script</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
+    <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
     then return the empty string and abort these steps.</p>
 
    </li>
@@ -72653,11 +72740,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Set all the flags in the new browsing context's <a href=#popup-sandboxing-flag-set>popup sandboxing flag set</a> that
     are set in the <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document>active document</a> of
-    the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent
-    script</a>. The <a href="#script's-browsing-context" title="script's browsing
-    context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
+    the <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a>. The <a href=#responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
     must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed
     navigator</a>.</p>
 
@@ -72689,9 +72776,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><a href=#navigate>Navigate</a><!--DONAV showModalDialog--> the new <a href=#browsing-context>browsing context</a> to
     the <a href=#absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url title="resolve a url">resolving</a>
-    <var title="">url</var> earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the <a href=#incumbent-script>incumbent script</a>
+    <var title="">url</var> earlier, with <a href=#replacement-enabled>replacement enabled</a>, and with the <a href=#responsible-browsing-context>responsible
+    browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>
     as the <a href=#source-browsing-context>source browsing context</a>.</p>
 
    </li>
@@ -73152,9 +73241,10 @@
     argument passed to one of these methods does not contain the exact literal string
     "<code>%s</code>".</p>
 
+<!--CLEANUP-->
     <p>User agents must throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception if <a href=#resolve-a-url title="resolve a
-    url">resolving</a> the <var title="">url</var> argument relative to the <a href=#entry-script>entry
-    script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, is not successful.</p>
+    url">resolving</a> the <var title="">url</var> argument relative to the
+    <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> is not successful.</p>
 
     <p class=note>The resulting <a href=#absolute-url>absolute URL</a> would by definition not be a <a href=#valid-url>valid
     URL</a> as it would include the string "<code title="">%s</code>" which is not a valid
@@ -73170,10 +73260,12 @@
     <p>The resulting <a href=#absolute-url>absolute URL</a> is the <dfn id=proto-url>proto-URL</dfn>. It identifies the
     handler for the purposes of the methods described below.</p>
 
+<!--CLEANUP-->
     <p>When the user agent uses this handler, it must replace the first occurrence of the exact
     literal string "<code title="">%s</code>" in the <var title="">url</var> argument with an
     escaped version of the <a href=#absolute-url>absolute URL</a> of the content in question (as defined below),
-    then <a href=#resolve-a-url title="resolve a url">resolve</a> the resulting URL, relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
+    then <a href=#resolve-a-url title="resolve a url">resolve</a> the resulting URL, relative to the <a href=#api-base-url>API
+    base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> at the time the <code title=dom-navigator-registerContentHandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code title=dom-navigator-registerProtocolHandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
     invoked, and then <a href=#navigate>navigate</a><!--DONAV user--> an appropriate <a href=#browsing-context>browsing
     context</a> to the resulting URL using the GET method (<a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a> for non-HTTP URLs).</p>
 
@@ -73381,7 +73473,9 @@
   <ol><li><p>If the string does not contain the substring "<code title="">%s</code>", abort these
    steps. There's no matching handler.</li>
 
-   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the string relative to the <a href="#script's-base-url" title="script's base URL">base URL</a> of the <a href=#entry-script>entry script</a>.</li>
+<!--CLEANUP-->
+   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the string relative to the <a href=#api-base-url>API base URL</a>
+   specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
    <li><p>If this fails, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception, aborting the
    method.</li>
@@ -74008,9 +74102,9 @@
     never does anything, or may arbitrarily ignore invocations with particular arguments for
     security, privacy, or usability reasons.</li>
 
+<!--CLEANUP-->
     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of the method's first argument
-    relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-    URL</a>.</li>
+    relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a>.</li>
 
     <li><p>If this fails, abort these steps.</li>
 
@@ -74032,9 +74126,10 @@
     <li><p>Let <var title="">host1</var> be the host component of the <a href=#origin>origin</a> of the
     <a href=#entry-script>entry script</a>.</li>
 
+<!--CLEANUP-->
     <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument
-    relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-    URL</a>.</li>
+    relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>.</li>
 
     <li><p>If this fails, return 0 and abort these steps.</li>
 
@@ -77969,9 +78064,9 @@
   settings, if any, in the form of an <code><a href=#eventsourceinit>EventSourceInit</a></code> dictionary. When the
   <code>EventSource()</code> constructor is invoked, the UA must run these steps:</p>
 
-  <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified in the first
-   argument, relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
-   URL</a>.
+  <ol><!--CLEANUP--><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <a href=#url>URL</a> specified in the first
+   argument, relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+   object</a>.
    </li>
 
    <li><p>If the previous step failed, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort
@@ -77990,9 +78085,10 @@
 
    <li><!-- if you change this, don't forget to update the reconnecting fetch lower down as well! -->
 
+<!--CLEANUP-->
     <p>Do a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a><!--FETCH--> of the resulting <a href=#absolute-url>absolute
-    URL</a> using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer source">referrer
-    source</a>, with the <i>mode</i> being <var title="">CORS mode</var>, and the <i title="">origin</i> being the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a><!--, and the
+    URL</a> using the <a href=#api-referrer-source>API referrer source</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>, with the <i>mode</i> being <var title="">CORS mode</var>, and the <i title="">origin</i> being the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a><!--, and the
     <i>default origin behaviour</i> set to <i>fail</i> (though it has no effect in the "Anonymous"
     and "Use Credentials" modes)-->, and process the resource obtained in this fashion, if any, as
     described below.</p>
@@ -79609,7 +79705,7 @@
 
     </ol></li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Let <var title="">message clone</var> be the result of obtaining a <a href=#structured-clone>structured
     clone</a> of the <var title="">message</var> argument, with <var title="">transfer map</var>
@@ -79623,14 +79719,14 @@
     <p>If the method was invoked with a third argument <var title="">transfer</var>, run these
     substeps:</p>
 
-    <ol><li>
+    <ol><li><!--CLEANUP--><!--no need for all this whitespace-->
 
-      <p>Let <var title="">new owner</var> be the <code><a href=#window>Window</a></code> object on which the method was
+      <p>Let <var title="">new owner</var> be the <a href=#script-settings-object>script settings object</a> of the <code><a href=#window>Window</a></code> object on which the method was
       invoked.</p>
 
      </li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new
       object <var title="">y</var> by <a href=#transfer-a-transferable-object title="transfer a Transferable
@@ -79642,7 +79738,7 @@
 
     </ol></li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a>
     array.</p>
@@ -79658,9 +79754,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <var title="">targetOrigin</var> argument is a single literal U+002F SOLIDUS character
     (/), and the <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which the method was
-    invoked does not have the <a href=#same-origin>same origin</a> as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's document">document</a>, then abort these steps silently.</p>
+    invoked does not have the <a href=#same-origin>same origin</a> as the <a href=#responsible-document>responsible document</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings
+    object</a>, then abort these steps silently.</p>
 
     <p>Otherwise, if the <var title="">targetOrigin</var> argument is an <a href=#absolute-url>absolute URL</a>,
     and the <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which the method was invoked
@@ -79674,12 +79772,16 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the
     <code><a href=#messageevent>MessageEvent</a></code> interface, with the event type <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
     default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
     initialized to the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialized to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an origin">Unicode serialization</a> of the
     <a href=#origin>origin</a> of the <a href=#incumbent-script>incumbent script</a>, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be initialized to the
-    <a href="#script's-global-object">script's global object</a>'s <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialized to the <var title="">new ports</var> array.
+    <code><a href=#windowproxy>WindowProxy</a></code> object corresponding to the
+    <a href=#global-object>global object</a> (a <code><a href=#window>Window</a></code> object) specified by the
+    <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>,
+    and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialized to the <var title="">new ports</var> array.
     </p>
     <!-- invariant: the global object is always a Window if the script can see this method -->
 
@@ -79914,11 +80016,14 @@
   <p>When the <dfn id=dom-messagechannel title=dom-MessageChannel><code>MessageChannel()</code></dfn> constructor is
   called, it must run the following algorithm:</p>
 
-  <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object">script's
-   global object</a>, and let <var title="">port1</var> be that object.</li>
+  <ol><!--CLEANUP--><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a>
+   of the <a href=#incumbent-script>incumbent script</a>, and let <var title="">port1</var> be that object.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object">script's
-   global object</a>, and let <var title="">port2</var> be that object.</li>
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a>
+   of the <a href=#incumbent-script>incumbent script</a>, and let <var title="">port2</var> be that object.</li>
 
    <li><p><a href=#entangle>Entangle</a> the <var title="">port1</var> and <var title="">port2</var>
    objects.</li>
@@ -80000,21 +80105,30 @@
   message queue</dfn>, initially empty. A <a href=#port-message-queue>port message queue</a> can be enabled or
   disabled, and is initially disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed altogether, which has much the
-  same effect). A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag. It must
-  initially be false.</p>
+  same effect). A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag, which must
+  initially be false, and an <dfn id=concept-port-owner title=concept-port-owner>owner</dfn>, which is a <a href=#settings-object>settings
+  object</a> set when the object is created, as described below.</p>
 
+<!--CLEANUP-->
   <p>When a port's <a href=#port-message-queue>port message queue</a> is enabled, the <a href=#event-loop>event loop</a> must use
-  it as one of its <a href=#task-source title="task source">task sources</a>.</p>
+  it as one of its <a href=#task-source title="task source">task sources</a>. All <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a task">queued</a> on the <a href=#port-message-queue>port
+  message queue</a> must be associated with the <a href=#responsible-document>responsible document</a> specified by
+  the port's <a href=#concept-port-owner title=concept-port-owner>owner</a>.</p>
 
-  <p class=note>If the <code><a href=#document>Document</a></code> of the port's event listeners' <a href="#script's-global-object" title="script's
-  global object">global object</a> is not <a href=#fully-active>fully active</a>, then the messages are
+<!--CLEANUP-->
+  <p class=note>If the port's <a href=#concept-port-owner title=concept-port-owner>owner</a> specifies a <a href=#responsible-document>responsible document</a> that is <a href=#fully-active>fully active</a>,
+  but the event listeners all have scripts whose <a href=#settings-object title="settings object">settings objects</a>
+  specify <a href=#responsible-document title="responsible document">responsible documents</a> that are <em>not</em> <a href=#fully-active>fully active</a>, then the messages will be
   lost.</p> <!-- because of the jump-to-entry-point algorithm first step -->
 
+<!--CLEANUP-->
   <p>Each <a href=#event-loop>event loop</a> has a <a href=#task-source>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
   message queue</dfn>. This is a virtual <a href=#task-source>task source</a>: it must act as if it contained
   the <a href=#concept-task title=concept-task>tasks</a> of each <a href=#port-message-queue>port message queue</a> of each
-  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false and whose <a href=#port-message-queue>port
-  message queue</a> is enabled, in the order in which they were added to their respective
+  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false, whose <a href=#port-message-queue>port
+  message queue</a> is enabled, and whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+  specifies that <a href=#event-loop>event loop</a> as the <a href=#responsible-event-loop>responsible event loop</a>,
+  in the order in which they were added to their respective
   <a href=#task-source>task source</a>. When a <a href=#concept-task title=concept-task>task</a> would be removed from the
   <a href=#unshipped-port-message-queue>unshipped port message queue</a>, it must instead be removed from its <a href=#port-message-queue>port message
   queue</a>.</p>
@@ -80029,9 +80143,10 @@
   is true, its <a href=#port-message-queue>port message queue</a> acts as a first-class <a href=#task-source>task source</a>,
   unaffected to any <a href=#unshipped-port-message-queue>unshipped port message queue</a>.</p>
 
-  <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> owned by a
-  <a href="#script's-global-object">script's global object</a> object <var title="">owner</var>, it must instantiate a new
-  <code><a href=#messageport>MessagePort</a></code> object, and let its owner be <var title="">owner</var>.</p>
+<!--CLEANUP-->
+  <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> with a particular
+  <a href=#settings-object>settings object</a> as its <var title="">owner</var>, it must instantiate a new
+  <code><a href=#messageport>MessagePort</a></code> object, and let its <a href=#concept-port-owner title=concept-port-owner>owner</a> be <var title="">owner</var>.</p>
 
   <p>When the user agent is to <dfn id=entangle>entangle</dfn> two <code><a href=#messageport>MessagePort</a></code> objects, it must run
   the following steps:</p>
@@ -80069,7 +80184,7 @@
   <ol><li><p>Set <var title="">original port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
    true.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">owner</var>, and let <var title="">new port</var> be that object.</li>
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">owner</var>, and let <var title="">new port</var> be that object.</li>
 
    <li><p>Set <var title="">new port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to true.</li>
 
@@ -80176,7 +80291,8 @@
 
     <ol><li>
 
-      <p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there
+<!--CLEANUP-->
+      <p>Let <var title="">new owner</var> be the <a href=#concept-port-owner title=concept-port-owner>owner</a> of <var title="">target port</var>, if there
       is a <var title="">target port</var>, or else some arbitrary owner. (This <var title="">new
       owner</var> is used when transferring objects below. If there is no <var title="">target
       port</var>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
@@ -80238,8 +80354,9 @@
 
    <li><p>Let <var title="">message</var> be the method's first argument.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span>script's
-   global object</span>, and let <var title="">port1</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   title="concept-port-owner">owner</span> is the <span>incumbent script</span>'s <span>settings
+   object</span>, and let <var title="">port1</var> be that object.</p></li>
 
    <li><p>If the <var title="">source port</var> is not entangled with another port, then return
    <var title="">port1</var> and abort these steps.</p></li> <!- - we don't throw an exception
@@ -80249,8 +80366,9 @@
    <li><p>Let <var title="">target port</var> be the port with which <var title="">source port</var>
    is entangled.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the owner of the <var
-   title="">target port</var>, and let <var title="">port2</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   title="concept-port-owner">owner</span> is the <span title="concept-port-owner">owner</span> of
+   the <var title="">target port</var>, and let <var title="">port2</var> be that object.</p></li>
 
    <li><p><span>Entangle</span> the <var title="">port1</var> and <var title="">port2</var>
    objects.</p></li>
@@ -80402,9 +80520,10 @@
 
   <div class=impl>
 
+<!--CLEANUP-->
   <p>When a <code><a href=#messageport>MessagePort</a></code> object <var title="">o</var> is entangled, user agents must
   either act as if <var title="">o</var>'s entangled <code><a href=#messageport>MessagePort</a></code> object has a strong
-  reference to <var title="">o</var>, or as if <var title="">o</var>'s owner has a strong reference
+  reference to <var title="">o</var>, or as if the <a href=#global-object>global object</a> specified by <var title="">o</var>'s <a href=#concept-port-owner title=concept-port-owner>owner</a> has a strong reference
   to <var title="">o</var>.</p>
 
   <div class=note>
@@ -81595,7 +81714,7 @@
   JavaScript</a> if the <a href=#javascript-global-environment>JavaScript global environment</a> is a <a href=#shared-worker-environment>shared worker
   environment</a>.</p>
 
-  <p>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on their global object for each
+  <p>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on their <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object for each
   connection.</p>
 
   <p>The <dfn id=dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name><code>name</code></dfn> attribute must return
@@ -81672,14 +81791,15 @@
   it must be removed from the list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of each
   worker whose list contains that <code><a href=#document>Document</a></code>.</p>
 
-  <p>Given a <a href="#script's-global-object">script's global object</a> <var title="">o</var> when creating or obtaining a
+<!--CLEANUP-->
+  <p>Given a <a href=#settings-object>settings object</a> <var title="">o</var> when creating or obtaining a
   worker, the <dfn id=list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to add</dfn> depends on the type
-  of <var title="">o</var>. If <var title="">o</var> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
+  of <a href=#global-object>global object</a> specified by <var title="">o</var>'s. If <var title="">o</var>
+  specifies a <a href=#global-object>global object</a> that is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
   (i.e. if we are creating a nested worker), then the relevant <code><a href=#document>Document</a></code>s are the
-  <code><a href=#document>Document</a></code>s that are in <var title="">o</var>'s own list of <a href="#the-worker's-documents">the worker's
-  <code>Document</code>s</a>. Otherwise, <var title="">o</var> is a <code><a href=#window>Window</a></code> object,
-  and the relevant <code><a href=#document>Document</a></code> is just the <code><a href=#document>Document</a></code> that is the <a href=#active-document>active
-  document</a> of the <code><a href=#window>Window</a></code> object <var title="">o</var>.</p>
+  <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of the <a href=#global-object>global object</a> specified by
+  <var title="">o</var>. Otherwise, <var title="">o</var> specifies a <a href=#global-object>global object</a> that is a <code><a href=#window>Window</a></code> object,
+  and the relevant <code><a href=#document>Document</a></code> is just the <a href=#responsible-document>responsible document</a> specified by <var title="">o</var>.</p>
 
   <hr><p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents">the worker's
   <code>Document</code>s</a> is not empty.</p>
@@ -81698,8 +81818,9 @@
 
   <h4 id=processing-model-7><span class=secno>10.2.4 </span>Processing model</h4>
 
-  <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url>URL</a> <var title="">url</var>, a <a href=#browsing-context>browsing context</a> <var title="">owner browsing context</var>, a
-  <code><a href=#document>Document</a></code> <var title="">owner document</var>, an <a href=#origin>origin</a> <var title="">owner origin</var>, and with global scope <var title="">worker global scope</var>, it
+<!--CLEANUP-->
+  <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url>URL</a> <var title="">url</var>, a <a href=#script-settings-object>script settings object</a> <var title="">settings object</var>,
+  and an <a href=#origin>origin</a> <var title="">owner origin</var>, it
   must run the following steps:</p>
 
   <ol><li id=worker-processing-model-top>
@@ -81712,6 +81833,9 @@
 
    </li>
 
+   <li><p>Let <var title="">worker global scope</var> be the <a href=#global-object>global object</a> specified
+   by <var title="">settings object</var>.</li>
+
    <li><p>If <var title="">worker global scope</var> is actually a
    <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker), and there are
    any <a href=#relevant-application-cache title="relevant application cache">relevant application caches</a> that are
@@ -81724,8 +81848,8 @@
    <li>
 
     <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> the resource identified by <var title="">url</var>,
-    from the <var title="">owner origin</var>, using <var title="">owner document</var> as the
-    <a href=#referrer-source>referrer source</a>, with the <i>synchronous flag</i> set and the <i>force same-origin
+    from the <var title="">owner origin</var>, using the <a href=#responsible-document>responsible document</a> specified by <var title="">settings object</var> as the
+    <a href=#referrer-source>referrer source</a> (not the specified <a href=#api-referrer-source>API referrer source</a>!), with the <i>synchronous flag</i> set and the <i>force same-origin
     flag</i> set.</p> <!-- not http-origin privacy sensitive (looking forward to CORS) -->
 
     <p>If the attempt fails, then for each <code><a href=#worker>Worker</a></code> or <code><a href=#sharedworker>SharedWorker</a></code> object
@@ -81745,7 +81869,7 @@
    </li>
 
    <li><p>In the newly created execution environment, create a <a href=#javascript-global-environment>JavaScript global
-   environment</a> whose <i>global object</i> is <var title="">worker global scope</var>. If <var title="">worker global scope</var> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this
+   environment</a> whose <i><a href=#global-object>global object</a></i> is <var title="">worker global scope</var>. If <var title="">worker global scope</var> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this
    is a <a href=#dedicated-worker-environment>dedicated worker environment</a>. Otherwise, <var title="">worker global
    scope</var> is a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object, and this is a <a href=#shared-worker-environment>shared worker
    environment</a>. (In either case, by definition, it is a <a href=#worker-environment>worker
@@ -81753,29 +81877,18 @@
 
    <li><!-- SCRIPT EXEC -->
 
-    <p>A new <a href=#concept-script title=concept-script>script</a> is now created, as follows.</p>
+    <p>Let <var title="">script</var> be a new <a href=#concept-script title=concept-script>script</a>.</p>
 
-    <p>Create a new <a href=#script-execution-environment>script execution environment</a> set up as appropriate for the
-    scripting language <var title="">language</var>.</p>
+    <p>Obtain the appropriate <a href=#script-execution-environment>script execution environment</a> for the scripting language
+    <var title="">language</var> from <var title="">settings object</var>.</p>
 
     <p>Parse/compile/initialize <var title="">source</var> using that <a href=#script-execution-environment>script execution
     environment</a>, as appropriate for <var title="">language</var>, and thus obtain a
     <a href=#code-entry-point>code entry-point</a>.</p>
 
-    <p>Set the <a href="#script's-global-object">script's global object</a> to <var title="">worker global scope</var>.</p>
+    <p>Let <var title="">script</var>'s <a href=#settings-object>settings object</a> be <var title="">settings
+    object</var>.</p>
 
-    <p>Set the <a href="#script's-browsing-context">script's browsing context</a> to <var title="">owner browsing
-    context</var>.</p>
-
-    <p>Set the <a href="#script's-document">script's document</a> to <var title="">owner document</var>.</p>
-
-    <p>Set the <a href="#script's-referrer-source">script's referrer source</a> to <var title="">url</var>.</p>
-
-    <p>Set the <a href="#script's-url-character-encoding">script's URL character encoding</a> to UTF-8. (This is just used for
-    encoding non-ASCII characters in the query component of URLs.)</p>
-
-    <p>Set the <a href="#script's-base-url">script's base URL</a> to <var title="">url</var>.</p>
-
    </li>
 
    <li>
@@ -81821,8 +81934,8 @@
 
    <li>
 
-    <p><strong><a href=#event-loop>Event loop<!-- labeled for ease of discussion --></a></strong>: Create a new <a href=#event-loop>event
-    loop</a>, and run it until it is destroyed.</p>
+    <p><strong><a href=#event-loop>Event loop<!-- labeled for ease of discussion --></a></strong>: Run the <a href=#responsible-event-loop>responsible
+    event loop</a> specified by <var title="">settings object</var> until it is destroyed.</p>
 
     <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task title=concept-task>tasks</a> run by the <a href=#event-loop>event loop</a> might get prematurely
     aborted by the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
@@ -81971,8 +82084,98 @@
   <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
    <tbody><tr><td><dfn id=handler-abstractworker-onerror title=handler-AbstractWorker-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
 <!-- v2-onclose    <tr><td><dfn title="handler-AbstractWorker-onclose"><code>onclose</code></dfn> <td> <code title="event-worker-close">close</code> -->
-  </table><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>
+  </table><h5 id=script-settings-for-workers><span class=secno>10.2.6.2 </span>Script settings for workers</h5>
 
+  <p>When the user agent is required to <dfn id=set-up-a-worker-script-settings-object>set up a worker script settings object</dfn>, given a
+  <var title="">worker global scope</var>, it must run the following steps:</p>
+
+  <ol><li><p>Let <var title="">inherited responsible browsing context</var> be the <a href=#responsible-browsing-context>responsible
+   browsing context</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings
+   object</a>.</li>
+
+   <li><p>Let <var title="">inherited responsible document</var> be the <a href=#responsible-document>responsible
+   document</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings
+   object</a>.</li>
+
+   <li><p>Let <var title="">worker event loop</var> be a newly created <a href=#event-loop>event
+   loop</a>.</li>
+
+   <li>
+
+    <p>Let <var title="">settings object</var> be a new <a href=#script-settings-object>script settings object</a> whose
+    algorithms are defined as follows:</p>
+
+    <dl><dt>The <a href=#script-execution-environment title="script execution environment">script execution environments</a></dt>
+     <dd>
+
+      <p>When the <a href=#script-settings-object>script settings object</a> is created, for each language supported by the
+      user agent, create an appropriate execution environment as defined by the relevant
+      specification.</p>
+
+      <p>When a <a href=#script-execution-environment>script execution environment</a> is needed, return the appropriate one from
+      those created when the <a href=#script-settings-object>script settings object</a> was created.</p>
+
+      <p class=note>Currently, workers only support JavaScript, so only a JavaScript execution
+      environment is actually needed here.</p>
+
+     </dd>
+
+     <dt>The <a href=#global-object>global object</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker global scope</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-browsing-context>responsible browsing context</a></dt>
+     <dd>
+
+      <p>Return <var title="">inherited responsible browsing context</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-document>responsible document</a></dt>
+     <dd>
+
+      <p>Return <var title="">inherited responsible document</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#responsible-event-loop>responsible event loop</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker event loop</var>.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-referrer-source>API referrer source</a></dt>
+     <dd>
+
+      <p>Return the <code><a href=#document>Document</a></code> with which the <code><a href=#window>Window</a></code> is currently
+      associated.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-url-character-encoding>API URL character encoding</a></dt>
+     <dd>
+
+      <p>Return UTF-8.</p>
+
+     </dd>
+
+     <dt>The <a href=#api-base-url>API base URL</a></dt>
+     <dd>
+
+      <p>Return <var title="">worker URL</var>.</p>
+
+     </dd>
+
+    </dl></li>
+
+   <li><p>Return <var title="">settings object</var>.</li>
+
+  </ol><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>10.2.6.3 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>
+
   <pre class=idl>[<a href=#dom-worker title=dom-Worker>Constructor</a>(DOMString scriptURL)]
 interface <dfn id=worker>Worker</dfn> : <a href=#eventtarget>EventTarget</a> {
   void <a href=#dom-worker-terminate title=dom-Worker-terminate>terminate</a>();
@@ -82027,17 +82230,21 @@
    the request violates a policy decision (e.g. if the user agent is configured to not allow the
    page to start dedicated workers).</li>
 
+<!--CLEANUP-->
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the <var title="">scriptURL</var> argument
-   relative to the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base URL</a>, when
-   the method is invoked.</li>
+   relative to the <a href=#api-base-url>API base URL</a> specified by the <a href=#entry-script>entry script</a>'s <a href=#settings-object>settings object</a> when
+   the method was invoked.</li>
 
    <li><p>If this fails, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>
 
+   <li><p>Let <var title="">worker URL</var> be the resulting <a href=#absolute-url>absolute URL</a>.</li>
+
    <li>
 
-    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of the resulting <a href=#parsed-url>parsed
-    URL</a> is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of the
-    resulting <a href=#absolute-url>absolute URL</a> is not the <a href=#same-origin title="same origin">same</a> as the
+<!--CLEANUP-->
+    <p>If the <a href=#concept-url-scheme title=concept-url-scheme>scheme</a> component of <var title="">worker URL</var>
+    is not "<code title=data-protocol>data</code>", and the <a href=#origin>origin</a> of <var title="">worker URL</var>
+    is not the <a href=#same-origin title="same origin">same</a> as the
     origin of the <a href=#entry-script>entry script</a>, then throw a <code><a href=#securityerror>SecurityError</a></code> exception and
     abort these steps.</p>
 
@@ -82052,16 +82259,22 @@
    origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
    scope</var> be this new object.</li>
 
+   <li><p><a href=#set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var title="">worker global
+   scope</var>, and let <var title="">settings object</var> be the result.</li>
+
    <li><p>Create a new <code><a href=#worker>Worker</a></code> object, associated with <var title="">worker global
    scope</var>. Let <var title="">worker</var> be this new object.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+   is the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
    this be the <var title="">outside port</var>.</li>
 
    <li><p>Associate the <var title="">outside port</var> with <var title="">worker</var>.</li>
 
-   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
-   global scope</var>. Let <var title="">inside port</var> be this new object.</li>
+<!--CLEANUP-->
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">script settings</var>
+   Let <var title="">inside port</var> be this new object.</li>
 
    <li><p>Associate <var title="">inside port</var> with <var title="">worker global
    scope</var>.</li>
@@ -82079,8 +82292,9 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
-    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
+    add</a> given the <a href=#settings-object>settings object</a> of the
     <a href=#incumbent-script>incumbent script</a>.</p>
 
    </li>
@@ -82095,25 +82309,24 @@
 
    <li>
 
-    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-    script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker),
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> specified by the <a href=#incumbent-script>incumbent
+    script</a>'s <a href=#settings-object>settings object</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker),
     add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of
-    the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
-    object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+    the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global object</a> of the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
    </li>
 
    <li>
 
-    <p><a href=#run-a-worker>Run a worker</a> for the resulting <a href=#absolute-url>absolute URL</a>, with the
-    <a href="#script's-browsing-context">script's browsing context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing context</var>, with the <a href="#script's-document">script's document</a> of the
-    <a href=#incumbent-script>incumbent script</a> as the <var title="">owner document</var>, with the
-    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner origin</var>,
-    and with <var title="">worker global scope</var> as the global scope.</p>
+    <p><a href=#run-a-worker>Run a worker</a> for the script with <a href=#url>URL</a> <var title="">worker
+    URL</var>, the <a href=#script-settings-object>script settings object</a> <var title="">settings object</var>, and the
+    <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner
+    origin</var>.</p>
 
    </li>
 
-  </ol><h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>
+  </ol><h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>10.2.6.4 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>
 
   <pre class=idl>[<a href=#dom-sharedworker title=dom-SharedWorker>Constructor</a>(DOMString scriptURL, optional DOMString name)]
 interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#eventtarget>EventTarget</a> {
@@ -82160,7 +82373,7 @@
    <li>
 
     <p>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
-    add</a> given the <a href="#script's-global-object" title="script's global object">global object</a> of the
+    add</a> given the <a href=#settings-object>settings object</a> of the
     <a href=#incumbent-script>incumbent script</a>.</p>
 
    </li>
@@ -82172,7 +82385,9 @@
     <ol><li><p>Create a new <code><a href=#sharedworker>SharedWorker</a></code> object, which will shortly be associated with a
      <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. Let this <code><a href=#sharedworker>SharedWorker</a></code> object be <var title="">worker</var>.</li>
 
-     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
+<!--CLEANUP-->
+     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+     is the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent script</a>. Let
      this be the <var title="">outside port</var>.</li>
 
      <li><p>Assign <var title="">outside port</var> to the <code title=dom-SharedWorker-port><a href=#dom-sharedworker-port>port</a></code> attribute of <var title="">worker</var>.</li>
@@ -82217,8 +82432,13 @@
        <li><p>Associate <var title="">worker</var> with <var title="">worker global
        scope</var>.</li>
 
-       <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker global scope</var>. Let this be the <var title="">inside port</var>.</li>
+       <li><p>Let <var title="">settings object</var> be the <a href=#script-settings-object>script settings object</a>
+       whose <a href=#global-object>global object</a> is <var title="">worker global scope</var>.</li>
 
+<!--CLEANUP-->
+       <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a>
+       is <var title="">settings object</var>. Let this be the <var title="">inside port</var>.</li>
+
        <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var>
        and <var title="">inside port</var>.</li>
 
@@ -82241,11 +82461,12 @@
 
        <li>
 
-        <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-        script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global
+<!--CLEANUP-->
+        <p>If the <a href=#global-object>global object</a> specified by the <a href=#incumbent-script>incumbent
+        script</a>'s <a href=#settings-object>settings object</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global
         scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
-        <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global
-        object">global object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+        <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global
+        object</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
        </li>
 
@@ -82253,17 +82474,23 @@
 
       </ol></li>
 
+     <!-- OTHERWISE: -->
+
      <li><p>Create a new <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#worker-origin>worker
      origin</a> is the origin of the <a href=#entry-script>entry script</a>. Let <var title="">worker global
      scope</var> be this new object.</li>
 
+     <li><p><a href=#set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var title="">worker global
+     scope</var>, and let <var title="">settings object</var> be the result.</li>
+
      <li><p>Associate <var title="">worker</var> with <var title="">worker global
      scope</var>.</li>
 
      <li><p>Set the <code title=dom-SharedWorkerGlobalScope-name><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute of <var title="">worker global scope</var> to <var title="">name</var>.</li>
 
-     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> owned by <var title="">worker
-     global scope</var>. Let <var title="">inside port</var> be this new object.</li>
+<!--CLEANUP-->
+     <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner title=concept-port-owner>owner</a> is <var title="">settings object</var>.
+     Let <var title="">inside port</var> be this new object.</li>
 
      <li><p><a href=#entangle>Entangle</a> <var title="">outside port</var> and <var title="">inside
      port</var>.</li>
@@ -82291,21 +82518,18 @@
 
    <li>
 
-    <p>If the <a href="#script's-global-object" title="script's global object">global object</a> of the <a href=#incumbent-script>incumbent
-    script</a> that invoked the constructor is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
-    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href="#script's-global-object" title="script's global object">global
-    object</a> of the <a href=#incumbent-script>incumbent script</a>.</p>
+<!--CLEANUP-->
+    <p>If the <a href=#global-object>global object</a> specified by the <a href=#settings-object>settings object</a> of the <a href=#incumbent-script>incumbent
+    script</a> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
+    <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object>global
+    object</a> specified by the <a href=#incumbent-script>incumbent script</a>'s <a href=#settings-object>settings object</a>.</p>
 
    </li>
 
    <li>
 
-    <p><a href=#run-a-worker>Run a worker</a> for <var title="">scriptURL</var>, with the <a href="#script's-browsing-context">script's browsing
-    context</a> of the <a href=#incumbent-script>incumbent script</a> as the <var title="">owner browsing
-    context</var>, with the <a href="#script's-document">script's document</a> of the <a href=#incumbent-script>incumbent script</a> the
-    <var title="">owner document</var>, with the <a href=#origin>origin</a> of the <a href=#entry-script>entry
-    script</a> as the <var title="">owner origin</var>, and with <var title="">worker global
-    scope</var> as the global scope.</p>
+    <p><a href=#run-a-worker>Run a worker</a> for the script with <a href=#url>URL</a> <var title="">scriptURL</var>, the <a href=#script-settings-object>script settings object</a> <var title="">settings
+    object</var>, and the <a href=#origin>origin</a> of the <a href=#entry-script>entry script</a> as the <var title="">owner origin</var>.</p>
 
    </li>
 
@@ -82336,15 +82560,19 @@
 
   <ol><li><p>If there are no arguments, return without doing anything. Abort these steps.</li>
 
+   <li><p>Let <var title="">settings object</var> be the <a href=#script-settings-object>script settings object</a> of the
+   <a href=#incumbent-script>incumbent script</a>.</li>
+
    <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> each argument.</li>
 
    <li><p>If any fail, throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</li>
 
    <li>
 
+<!--CLEANUP-->
     <p>Attempt to <a href=#fetch>fetch</a><!--FETCH--> each resource identified by the resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>, from the <a href=#entry-script>entry script</a>'s
-    <a href=#origin>origin</a>, using the <a href=#entry-script>entry script</a>'s <a href="#script's-referrer-source" title="script's referrer
-    source">referrer source</a>, and with the <i>synchronous flag</i> set.</p> <!-- not
+    <a href=#origin>origin</a>, using the <a href=#api-referrer-source>API referrer source</a> specified by <var title="">settings
+    object</var>, and with the <i>synchronous flag</i> set.</p> <!-- not
     http-origin privacy sensitive -->
 
    </li>
@@ -82373,14 +82601,13 @@
 
      <li>
 
-      <p><a href=#create-a-script>Create a script</a>, using <var title="">source</var> as the script source, the
-      <a href=#url>URL</a> from which <var title="">source</var> was obtained, and <var title="">language</var> as the scripting language, using the same global object, browsing
-      context, document, referrer source, URL character encoding, and base URL as the <a href=#concept-script title=concept-script>script</a> that was created by the worker's <a href=#run-a-worker>run a
-      worker</a> algorithm.</p>
+      <p><a href=#create-a-script>Create a script</a> using <var title="">source</var> as the script source, the
+      <a href=#url>URL</a> from which <var title="">source</var> was obtained, <var title="">language</var> as the scripting language, and <var title="">settings object</var> as
+      the <a href=#script-settings-object>script settings object</a>.</p>
 
       <p>If the script came from a resource whose <a href=#url>URL</a> does not have the <a href=#same-origin>same
       origin</a> as the <a href=#worker-origin>worker origin</a>, then pass the <var title="">muted
-      errors</var> flag to the <a href=#create-a-script-from-a-node>create a script from a node</a> algorithm.</p>
+      errors</var> flag to the <a href=#create-a-script>create a script</a> algorithm as well.</p>
 
       <p>Let the newly created <a href=#concept-script title=concept-script>script</a> run until it either
       returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
@@ -94972,7 +95199,7 @@
    <li>None of the elements in the <code><a href=#document>Document</a></code> are in any of the following namespaces: <a href=#html-namespace-0>HTML namespace</a>, <a href=#svg-namespace>SVG namespace</a>, <a href=#mathml-namespace>MathML namespace</a>
    <li>The <code><a href=#document>Document</a></code> has no <a href=#focusable>focusable</a> elements (e.g. from XLink).
    <li>The <code><a href=#document>Document</a></code> has no <a href=#hyperlink title=hyperlink>hyperlinks</a> (e.g. from XLink).
-   <li>There exists no <a href=#concept-script title=concept-script>script</a> whose <a href="#script's-document" title="script's document">document</a> is this <code><a href=#document>Document</a></code>.
+   <li>There exists no <a href=#concept-script title=concept-script>script</a> whose <a href=#settings-object>settings object</a> specifies this <code><a href=#document>Document</a></code> as the <a href=#responsible-document>responsible document</a>.
    <li>None of the elements in the <code><a href=#document>Document</a></code> have any registered event listeners.
   </ul><p><dfn id=an-unstyled-document-view>An unstyled document view</dfn> is one where the DOM is not rendered according to CSS
   (which would, since there are no applicable styles in this context, just result in a wall of

Modified: source
===================================================================
--- source	2013-10-28 21:49:17 UTC (rev 8246)
+++ source	2013-10-30 23:18:04 UTC (rev 8247)
@@ -6050,7 +6050,8 @@
 
      <dt>If the URL came from a script (e.g. as an argument to a method)</dt>
 
-     <dd>The URL character encoding is the <span>script's URL character encoding</span>.</dd>
+<!--CLEANUP-->
+     <dd>The URL character encoding is the <span>API URL character encoding</span> specified by the script's <span>settings object</span>.</dd>
 
      <dt>If the URL came from a DOM node (e.g. from an element)</dt>
 
@@ -8021,11 +8022,13 @@
   their user interface. This is the primary mechanism by which a user can tell if a site is
   attempting to impersonate another.</p>
 
+<!--CLEANUP-->
   <p>When a <code>Document</code> is created by a <span data-x="concept-script">script</span> using
   the <code data-x="dom-DOMImplementation-createDocument">createDocument()</code> or <code
   data-x="dom-DOMImplementation-createHTMLDocument">createHTMLDocument()</code> APIs, <span>the
-  document's address</span> is the same as <span>the document's address</span> of the <span>script's
-  document</span>, and the <code>Document</code> is both <span>ready for post-load tasks</span> and
+  document's address</span> is the same as <span>the document's address</span> of the <span>responsible
+  document</span> specified by the script's <span>settings
+  object</span>, and the <code>Document</code> is both <span>ready for post-load tasks</span> and
   <span>completely loaded</span> immediately.</p>
 
   <p><dfn>The document's referrer</dfn> is an <span>absolute URL</span> that can be set when the
@@ -8545,6 +8548,8 @@
 
   <div class="impl">
 
+<!--CLEANUP--><!-- multiple paragraphs -->
+
   <!-- these all return the same object each time because of a rule in
   the collection section -->
 
@@ -8865,8 +8870,10 @@
    <li><p>Let <var data-x="">document</var> be the <code>XMLDocument</code> object on which the
    method was invoked.</p></li>
 
+<!--CLEANUP-->
    <li><p><span data-x="resolve a url">Resolve</span> the method's first argument, relative to the
-   <span>entry script</span>'s <span data-x="script's base URL">base URL</span>. If this is not
+   <span>API base URL</span> specified by the
+   <span>entry script</span>'s <span>settings object</span>. If this is not
    successful, throw a <code>SyntaxError</code> exception and abort these steps. Otherwise, let <var
    data-x="">url</var> be the resulting <span>absolute URL</span>.</p></li>
 
@@ -8893,9 +8900,10 @@
 
    <li><p>Let <var data-x="">success</var> be false.</p></li>
 
+<!--CLEANUP-->
    <li><p><span>Fetch</span><!--FETCH--> <var data-x="">url</var> from the <span>origin</span> of
-   <var data-x="">document</var>, using the <span>entry script</span>'s <span data-x="script's
-   referrer source">referrer source</span>, with the <i data-x="">synchronous flag</i> set and the <i
+   <var data-x="">document</var>, using the <span>API referrer source</span> specified by the <span>entry script</span>'s
+   <span>settings object</span>, with the <i data-x="">synchronous flag</i> set and the <i
    data-x="">force same-origin flag</i> set.</p></li>
 
    <li>
@@ -57279,8 +57287,9 @@
 
        <li>
 
+<!--CLEANUP-->
         <p>Let <var data-x="">old script element</var> be the value to which the
-        <code>Document</code> element's <code
+        <code>script</code> element's <code>Document</code>'s <code
         data-x="dom-document-currentScript">currentScript</code> object was most recently
         initialized.</p>
 
@@ -57288,7 +57297,8 @@
 
        <li>
 
-        <p>Initialize the <code>Document</code> element's <code
+<!--CLEANUP-->
+        <p>Initialize the <code>script</code> element's <code>Document</code>'s <code
         data-x="dom-document-currentScript">currentScript</code> object to the <code>script</code>
         element.</p>
 
@@ -57296,15 +57306,17 @@
 
        <li>
 
-        <p><span data-x="create a script from a node">Create a script</span> from the
-        <code>script</code> element node, using <var>the script block's source</var>, the
-        <span>URL</span> from which the script was obtained, and <var>the script block's
-        type</var>.</p>
+<!--CLEANUP-->
+        <p><span>Create a script</span>, using <var>the script block's source</var>, the
+        <span>URL</span> from which the script was obtained, <var>the script block's
+        type</var> as the scripting language, and the <span>script settings object</span> of the <code>script</code> element's
+        <code>Document</code>'s <code>Window</code> object.</p>
 
+<!--CLEANUP-->
         <p>If the script came from a resource that was <span data-x="fetch">fetched</span> in the
         steps above, and the resource was <span>CORS-cross-origin</span>, then pass the <var
-        data-x="">muted errors</var> flag to the <span>create a script from a node</span>
-        algorithm.</p>
+        data-x="">muted errors</var> flag to the <span>create a script</span>
+        algorithm as well.</p>
 
         <p class="note">This is where the script is compiled and actually executed.</p>
 
@@ -57312,7 +57324,8 @@
 
        <li>
 
-        <p>Initialize the <code>Document</code> element's <code
+<!--CLEANUP-->
+        <p>Initialize the <code>script</code> element's <code>Document</code>'s <code
         data-x="dom-document-currentScript">currentScript</code> object to <var data-x="">old script
         element</var>.</p>
 
@@ -71495,12 +71508,14 @@
   present, and as if all the properties of that <code>Window</code> object had their [[Enumerable]]
   attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <span>effective
   script origin</span> that is not the same as the <code>Window</code> object's
   <code>Document</code>'s <span>effective script origin</span> must be provided with a separate set
   of objects. These objects must have the prototype chain appropriate for the script for which the
-  objects are created (not those that would be appropriate for scripts whose <span>script's global
-  object</span> is the <code>Window</code> object in question).</p>
+  objects are created (not those that would be appropriate for scripts whose <span>global
+  object</span>, as specified by their <span>settings object</span>,
+  is the <code>Window</code> object in question).</p>
 
   <div class="example">
 
@@ -71578,12 +71593,13 @@
 
   <p>The method has four arguments, though they are all optional.</p>
 
+<!--CLEANUP-->
   <p>The first argument, <var data-x="">url</var>, must be a <span>valid non-empty URL</span> for a
   page to load in the browsing context. If the first argument is the empty string, then the <var
   data-x="">url</var> argument must be interpreted as "<code>about:blank</code>". Otherwise, the
   argument must be <span data-x="resolve a url">resolved</span> to an <span>absolute URL</span> (or
-  an error), relative to the <span>entry script</span>'s <span data-x="script's base URL">base
-  URL</span>, when the method is invoked.</p>
+  an error), relative to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings 
+  object</span> when the method was invoked.</p>
 
   <p>The second argument, <var data-x="">target</var>, specifies the <span data-x="browsing context
   name">name</span> of the browsing context that is to be navigated. It must be a <span>valid
@@ -71618,14 +71634,15 @@
   browsing context, then throw an <code>InvalidAccessError</code> exception and abort these
   steps.</p>
 
+<!--CLEANUP-->
   <p>Otherwise, if <var data-x="">url</var> is not "<code>about:blank</code>", the user agent must
   <span>navigate</span><!--DONAV window.open()--> the selected <span>browsing context</span> to the
   <span>absolute URL</span> obtained from <span data-x="resolve a url">resolving</span> <var
   data-x="">url</var> earlier. If the <var data-x="">replace</var> is true or if the <span>browsing
   context</span> was just created as part of <span>the rules for choosing a browsing context given a
   browsing context name</span>, then <span data-x="replacement enabled">replacement must be
-  enabled</span>. The navigation must be done with the <span data-x="script's browsing
-  context">browsing context</span> of the <span>incumbent script</span> as the <span>source browsing
+  enabled</span>. The navigation must be done with the <span>responsible
+  browsing context</span> specified by the <span>incumbent script</span>'s <span>settings object</span> as the <span>source browsing
   context</span>. If the <span>resolve a URL</span> algorithm failed, then the user agent may either
   instead <span>navigate</span> to an inline error page, using the same replacement behavior and
   source browsing context behavior as described earlier in this paragraph; or treat the <var
@@ -71665,12 +71682,16 @@
    <li>The corresponding <span>browsing context</span> <var data-x="">A</var> is
    <span>script-closable</span>.</li>
 
-   <li>The <span data-x="script's browsing context">browsing context</span> of the <span>incumbent
-   script</span> is <span>familiar with</span> the <span>browsing context</span> <var
+<!--CLEANUP-->
+   <li>The <span>responsible browsing context</span> specified by the <span>incumbent
+   script</span>'s <span>settings object</span> is <span>familiar
+   with</span> the <span>browsing context</span> <var
    data-x="">A</var>.</li>
 
-   <li id="sandboxClose">The <span data-x="script's browsing context">browsing context</span> of the
-   <span>incumbent script</span> is <span>allowed to navigate</span> the <span>browsing
+<!--CLEANUP-->
+   <li id="sandboxClose">The <span>responsible browsing context</span> specified by the
+   <span>incumbent script</span>'s <span>settings object</span>
+   is <span>allowed to navigate</span> the <span>browsing
    context</span> <var data-x="">A</var>.</li>
 
   </ul>
@@ -71719,13 +71740,15 @@
 
   <div class="impl">
 
+<!--CLEANUP-->
   <p>The <dfn data-x="dom-length"><code>length</code></dfn> IDL attribute on the <code>Window</code>
   interface must return the number of <span data-x="child browsing context">child browsing
   contexts</span> that are <span data-x="browsing context nested through">nested through</span>
   elements that are <span data-x="in a document">in the <code>Document</code></span> that is the
   <span>active document</span> of that <code>Window</code> object, if that <code>Window</code>'s
-  <span>browsing context</span> shares the same <span>event loop</span> as the <span>script's
-  browsing context</span> of the <span>entry script</span> accessing the IDL attribute; otherwise,
+  <span>browsing context</span> shares the same <span>event loop</span> as the <span>responsible
+  document</span> specified by the <span>settings object</span> of the
+  <span>entry script</span> accessing the IDL attribute; otherwise,
   it must return zero.</p>
 
   <!-- in other words, frames are only accessible to same-thread processes -->
@@ -71869,9 +71892,10 @@
   objects have <span data-x="implied strong reference">implied strong references</span> to the
   <code>WindowProxy</code> object.</p>
 
-  <p>Each <span data-x="concept-script">script</span> has a strong reference to its <span
-  data-x="script's browsing context">browsing context</span> and its <span data-x="script's
-  document">document</span>.</p>
+<!--CLEANUP-->
+  <p>Each <span data-x="concept-script">script</span> has a strong reference to its <span>settings
+  object</span>, and each <span>script settings object</span>
+  has strong references to its <span>global object</span>, <span>responsible browsing context</span>, and <span>responsible document</span>.</p>
 
   <!-- discard a document -->
   <p>When a <span>browsing context</span> is to <dfn>discard a <code>Document</code></dfn>, the user
@@ -73416,8 +73440,10 @@
 
     <ol>
 
+<!--CLEANUP-->
      <li><span data-x="resolve a url">Resolve</span> the value of the third argument, relative to the
-     <span>entry script</span>'s <span data-x="script's base URL">base URL</span>.</li>
+     <span>API base URL</span> specified by the
+     <span>entry script</span>'s <span>settings object</span>.</li>
 
      <li>If that fails, throw a <code>SecurityError</code> exception and abort these steps.</li>
 
@@ -73428,9 +73454,10 @@
      data-x="concept-url-fragment">fragment</span> components, then throw a
      <code>SecurityError</code> exception and abort these steps.</li>
 
+<!--CLEANUP-->
      <li>If the <span>origin</span> of the resulting <span>absolute URL</span> is not the same as
-     the <span>origin</span> of the <span>entry script</span>'s <span data-x="script's
-     document">document</span>, and either the <span data-x="concept-url-path">path</span> or <span
+     the <span>origin</span> of the <span>responsible document</span> specified by the <span>entry script</span>'s
+     <span>settings object</span>, and either the <span data-x="concept-url-path">path</span> or <span
      data-x="concept-url-query">query</span> components of the two <span data-x="parsed URL">parsed
      URLs</span> compared in the previous step differ, throw a <code>SecurityError</code> exception
      and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
@@ -73712,9 +73739,10 @@
   <p>The <i>relevant <code>Document</code></i> is the <code>Location</code> object's associated
   <code>Document</code> object's <span>browsing context</span>'s <span>active document</span>.</p>
 
+<!--CLEANUP-->
   <p>When the <dfn data-x="dom-location-assign"><code>assign(<var data-x="">url</var>)</code></dfn>
   method is invoked, the UA must <span data-x="resolve a url">resolve</span> the argument, relative
-  to the <span>entry script</span>'s <span data-x="script's base URL">base URL</span>, and if that is
+  to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings object</span>, and if that is
   successful, must <span>navigate</span><!--DONAV location.href/assign--> the <span>browsing
   context</span> to the specified <var data-x="">url</var>. If the <span>browsing context</span>'s
   <span>session history</span> contains only one <code>Document</code>, and that was the
@@ -73724,15 +73752,17 @@
   Safari doesn't check that. Thus this might need changing if testing shows the IE/Firefox behaviour
   is required here. -->
 
+<!--CLEANUP-->
   <p>When the <dfn data-x="dom-location-replace"><code>replace(<var data-x="">url</var>)</code></dfn>
   method is invoked, the UA must <span data-x="resolve a url">resolve</span> the argument, relative
-  to the <span>entry script</span>'s <span data-x="script's base URL">base URL</span>, and if that is
+  to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings object</span>, and if that is
   successful, <span>navigate</span><!--DONAV location.href/replace--> the <span>browsing
   context</span> to the specified <var data-x="">url</var> with <span>replacement enabled</span>.</p>
 
+<!--CLEANUP-->
   <p>Navigation for the <code data-x="dom-location-assign">assign()</code> and <code
-  data-x="dom-location-replace">replace()</code> methods must be done with the <span data-x="script's
-  browsing context">browsing context</span> of the <span>incumbent script</span> as the <span>source
+  data-x="dom-location-replace">replace()</code> methods must be done with the <span>responsible browsing context</span> specified by
+  the <span>incumbent script</span>'s <span>settings object</span> as the <span>source
   browsing context</span>.</p>
 
   <p>If the <span data-x="resolve a url">resolving</span> step of the <code
@@ -73806,9 +73836,10 @@
   input</span> algorithm with <span data-x="the document's address">the address</span> of the
   <i>relevant <code>Document</code></i> as the given value.</p>
 
+<!--CLEANUP-->
   <p>The element's <code>URLUtils</code> interface's <span data-x="concept-uu-get-the-base">get the
-  base</span> algorithm must return the <span>entry script</span>'s <span data-x="script's base
-  URL">base URL</span>, if there is one, or null otherwise.</p>
+  base</span> algorithm must return the <span>API base URL</span> specified by the <span>entry script</span>'s
+  <span>settings object</span>, if there is one, or null otherwise.</p>
 
   <p>The element's <code>URLUtils</code> interface's <span data-x="concept-uu-query-encoding">query
   encoding</span> is the <span>document's character encoding</span>.</p>
@@ -73874,12 +73905,16 @@
 
   <ul>
 
-   <li>The <code data-x="dom-url-href">href</code> setter, if the <span>entry script</span>'s
-   <span>script's browsing context</span> is <span>familiar with</span> the <span>browsing
+<!--CLEANUP-->
+   <li>The <code data-x="dom-url-href">href</code> setter, if the <span>responsible browsing context</span>
+   specified by the <span>entry script</span>'s
+   <span>settings object</span> is <span>familiar with</span> the <span>browsing
    context</span> with which the <code>Location</code> object is associated
 
-   <li>The <code data-x="dom-location-replace">replace()</code> method, if the <span>entry
-   script</span>'s <span>script's browsing context</span> is <span>familiar with</span> the
+<!--CLEANUP-->
+   <li>The <code data-x="dom-location-replace">replace()</code> method, if the <span>responsible
+   browsing context</span> specified by the <span>entry script</span>'s
+   <span>settings object</span> is <span>familiar with</span> the
    <span>browsing context</span> with which the <code>Location</code> object is associated
 
    <li>Any properties not defined in the IDL for the <code>Location</code> object or indirectly via
@@ -73896,12 +73931,13 @@
   properties, getters, setters, etc, were not present, and as if all the properties of that
   <code>Location</code> object had their [[Enumerable]] attribute set to false.</p>
 
+<!--CLEANUP-->
   <p>For members that return objects (including function objects), each distinct <span>effective
   script origin</span> that is not the <span>same origin</span> as the <code>Location</code>
   object's <code>Document</code>'s <span>effective script origin</span> must be provided with a
   separate set of objects. These objects must have the prototype chain appropriate for the script
   for which the objects are created (not those that would be appropriate for scripts whose
-  <span>script's global object</span> is the <code>Location</code> object's <code>Document</code>'s
+  <span>settings object</span> specifies a <span>global object</span> that is the <code>Location</code> object's <code>Document</code>'s
   <code>Window</code> object).</p>
 
   </div>
@@ -75522,7 +75558,7 @@
    <li>
 
     <p><span>Make disappear</span> any <code>WebSocket</code> objects that were created by the <code
-    data-x="dom-WebSocket">WebSocket()</code> constructor whose global object is the
+    data-x="dom-WebSocket">WebSocket()</code> constructor from the
     <code>Document</code>'s <code>Window</code> object.</p>
 
     <p>If this affected any <code>WebSocket</code> objects, then set <code>Document</code>'s <i
@@ -78026,27 +78062,34 @@
     information).</p>
 
    </dd>
-<!--
-   <dt>A relationship with a <span>script settings object</span></dt>
 
+   <dt>A <dfn>settings object</dfn></dt>
+
    <dd>
 
-    <p>An object (defined below) that describes various settings that can be shared with other
-    scripts.</p>
+    <p>A <span>script settings object</span>, various settings that are shared with other scripts in
+    the same context.</p>
 
    </dd>
 
+   <dt>An <dfn data-x="">owner</dfn>, <dfn data-x="">origin</dfn>, and <dfn data-x="">effective origin</dfn></dt>
+
+   <dd>
+
+    <p>There are defined in the <span>origin</span> section.</p>
+
+   </dd>
+
   </dl>
 
   <hr>
 
-  <p>Each global object has a <dfn>script settings object</dfn> shared by the scripts that use that
-  global object. A <span>script settings object</span> consists of the following:</p>
+  <p>A <dfn>script settings object</dfn> specifies algorithms for obtaining the following:</p>
 
   <dl>
--->
-   <dt>A <dfn>script execution environment</dfn></dt>
 
+   <dt>A <dfn>script execution environment</dfn> for each language supported by the user agent</dt>
+
    <dd>
 
     <p>The characteristics of the script execution environment depend on the language, and are not
@@ -78058,19 +78101,18 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn>script's global object</dfn></dt>
-
+   <dt>A <dfn>global object</dfn></dt>
    <dd>
 
-    <p>An object that provides the APIs that the code can use.</p>
+    <p>An object that provides the APIs that can be called by the code in scripts that use this
+    <span data-x="script settings object">settings object</span>.</p>
 
-    <p class="example">This is typically a <code>Window</code> object. In JavaScript, this
-    corresponds to the <i>global object</i>.</p>
+    <p class="note">This is typically a <code>Window</code> object or a
+    <code>WorkerGlobalScope</code> object. When a <span>global object</span> is an empty object, it
+    can't do anything that interacts with the environment.</p>
 
-    <p class="note">When a <span>script's global object</span> is an empty object, it can't do
-    anything that interacts with the environment.</p>
-
-    <p>If the <span>script's global object</span> is a <code>Window</code> object, then in
+<!--CLEANUP-->
+    <p>If the <span>global object</span> is a <code>Window</code> object, then, in
     JavaScript, the ThisBinding of the global execution context for this script must be the
     <code>Window</code> object's <code>WindowProxy</code> object, rather than the global object. <a
     href="#refsECMA262">[ECMA262]</a></p>
@@ -78084,74 +78126,160 @@
 
    </dd>
 
-   <dt>A relationship with the <dfn>script's browsing context</dfn></dt>
+   <dt>A <dfn>responsible browsing context</dfn></dt>
 
    <dd>
 
     <p>A <span>browsing context</span> that is assigned responsibility for actions taken by the
-    script.</p>
+    scripts that use this <span>script settings object</span>.</p>
 
     <p class="example">When a script creates and <span data-x="navigate">navigates</span> a new
-    <span>top-level browsing context</span>, the <code data-x="dom-opener">opener</code> attribute of
-    the new <span>browsing context</span>'s <code>Window</code> object will be set to the
-    <span>script's browsing context</span>'s <code>WindowProxy</code> object.</p>
+    <span>top-level browsing context</span>, the <code data-x="dom-opener">opener</code> attribute
+    of the new <span>browsing context</span>'s <code>Window</code> object will be set to the
+    <span>responsible browsing context</span>'s <code>WindowProxy</code> object.</p>
 
    </dd>
 
-   <dt>A relationship with the <dfn>script's document</dfn></dt>
+   <dt>A <dfn>responsible document</dfn></dt>
 
    <dd>
 
-    <p>A <code>Document</code> that is assigned responsibility for actions taken by the script.</p>
+    <p>A <code>Document</code> that is assigned responsibility for actions taken by the scripts that
+    use this <span>script settings object</span>.</p>
 
+<!--CLEANUP-->
     <p class="example">For example, the <span data-x="the document's address">address</span> of the
-    <span>script's document</span> is used to set the <span data-x="the document's
-    address">address</span> of any <code>Document</code> elements created using <code
+    <span>responsible document</span> is used to set the <span data-x="the document's
+    address">address</span> of any <code>Document</code>s created using <code
     data-x="dom-DOMImplementation-createDocument">createDocument()</code>.</p>
 
    </dd>
 
-   <dt>The <dfn>script's referrer source</dfn></dt>
+   <dt>A <dfn>responsible event loop</dfn></dt>
 
    <dd>
 
-    <p>Either a <code>Document</code> (specifically, the <span>script's document</span>), or a
+    <p>An <span>event loop</span> that is used when it would not be immediately clear what event
+    loop to use.</p>
+
+   </dd>
+
+   <dt>An <dfn>API referrer source</dfn></dt>
+
+   <dd>
+
+    <p>Either a <code>Document</code> (specifically, the <span>responsible document</span>), or a
     <span>URL</span>, which is used by some APIs to determine what value to use for the <code
     data-x="http-referer">Referer</code> (sic) header in calls to the <span
     data-x="fetch">fetching</span> algorithm.</p>
 
    </dd>
 
-   <dt>A <dfn data-x="script's URL character encoding">URL character encoding</dfn></dt>
+   <dt>An <dfn>API URL character encoding</dfn></dt>
 
    <dd>
 
-    <p>A character encoding, set when the script is created, used to encode URLs. <span
-    id="sce-not-copy" data-x="">If the character encoding is set from another source, e.g. a
-    <span>document's character encoding</span>, then the <span>script's URL character
-    encoding</span> must follow the source, so that if the source's changes, so does the
-    script's.</span></p>
+<!--CLEANUP-->
+    <p>A character encoding used to encode URLs by APIs called by scripts that use
+    this <span>script settings object</span>.</p>
 
    </dd>
 
-   <dt>A <dfn data-x="script's base URL">base URL</dfn></dt>
+   <dt>An <dfn>API base URL</dfn></dt>
 
    <dd>
 
-    <p>A <span>URL</span>, set when the script is created, used to resolve <span data-x="relative
-    URL">relative URLs</span>. <span id="sbu-not-copy" data-x="">If the base URL is set from another
-    source, e.g. a <span>document base URL</span>, then the <span>script's base URL</span> must
-    follow the source, so that if the source's changes, so does the script's.</span></p>
+<!--CLEANUP-->
+    <p>An <span>absolute URL</span> used by APIs called by scripts that use
+    this <span>script settings object</span> to resolve <span data-x="relative
+    URL">relative URLs</span>.</p>
 
    </dd>
 
   </dl>
 
-  </div>
 
 
-  <div class="impl">
+  <h5>Script settings for browsing contexts</h5>
 
+  <p>Whenever a new <code>Window</code> object is created, it must also create a <span>script
+  settings object</span> whose algorithms are defined as follows:</p>
+
+  <dl>
+
+   <dt>The <span data-x="script execution environment">script execution environments</span></dt>
+   <dd>
+
+    <p>When the <span>script settings object</span> is created, for each language supported by the
+    user agent, create an appropriate execution environment as defined by the relevant
+    specification.</p>
+
+    <p>When a <span>script execution environment</span> is needed, return the appropriate one from
+    those created when the <span>script settings object</span> was created.</p>
+
+   </dd>
+
+   <dt>The <span>global object</span></dt>
+   <dd>
+
+    <p>Return the <code>Window</code> object itself.</p>
+
+   </dd>
+
+   <dt>The <span>responsible browsing context</span></dt>
+   <dd>
+
+    <p>Return the <span>browsing context</span> with which the <code>Window</code> object is
+    associated.</p>
+
+   </dd>
+
+   <dt>The <span>responsible document</span></dt>
+   <dd>
+
+    <p>Return the <code>Document</code> with which the <code>Window</code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <span>responsible event loop</span></dt>
+   <dd>
+
+    <p>Return the <span>event loop</span> that is associated with the <span>unit of related
+    similar-origin browsing contexts</span> to which the <code>Window</code> object's <span>browsing
+    context</span> belongs.</p>
+
+   </dd>
+
+   <dt>The <span>API referrer source</span></dt>
+   <dd>
+
+    <p>Return the <code>Document</code> with which the <code>Window</code> is currently
+    associated.</p>
+
+   </dd>
+
+   <dt>The <span>API URL character encoding</span></dt>
+   <dd>
+
+    <p>Return the current <span data-x="document's character encoding">character encoding</span> of
+    the <code>Document</code> with which the <code>Window</code> is currently associated.</p>
+
+   </dd>
+
+   <dt>The <span>API base URL</span></dt>
+   <dd>
+
+    <p>Return the current <span data-x="document base URL">base URL</span> of the
+    <code>Document</code> with which the <code>Window</code> is currently associated.</p>
+
+   </dd>
+
+  </dl>
+
+
+
+
   <h5>Calling scripts</h5>
 
   <p>Each <span>unit of related similar-origin browsing contexts</span> has a <dfn>stack of
@@ -78173,8 +78301,10 @@
    data-x="concept-script">script</span>. If this returns "do not run" then abort these
    steps.</p></li>
 
-   <li><p>Make the <span data-x="script execution environment">script execution environment</span>
-   for <var data-x="">s</var> execute the <span data-x="concept-script">script</span>'s <span>code
+<!--CLEANUP-->
+   <li><p>Make the appropriate <span>script execution environment</span>
+   specified by <var data-x="">s</var>'s <span>settings
+   object</span> execute the <span data-x="concept-script">script</span>'s <span>code
    entry-point</span>.</p></li>
 
    <li><p><span>Clean up after running a callback</span>.</p></li>
@@ -78188,12 +78318,14 @@
 
   <ol>
 
-   <li><p>If the <span data-x="script's global object">global object</span> of <var data-x="">o</var>
+<!--CLEANUP-->
+   <li><p>If the <span>global object</span> specified by <var data-x="">o</var>'s <span>settings object</span>
    is a <code>Window</code> object whose <code>Document</code> object is not <span>fully
    active</span>, then return "do not run" and abort these steps.</p>
 
-   <li><p>If <span data-x="concept-bc-noscript">scripting is disabled</span> for <var
-   data-x="">o</var>'s <span data-x="script's browsing context">browsing context</span>, then return
+<!--CLEANUP-->
+   <li><p>If <span data-x="concept-bc-noscript">scripting is disabled</span> for the <span>responsible browsing context</span> specified by <var
+   data-x="">o</var>'s <span>settings object</span>, then return
    "do not run" and abort these steps.</p>
 
    <li><p>Push <var data-x="">s</var> onto the <span>stack of incumbent scripts</span>, and label it
@@ -78244,7 +78376,7 @@
   data-x="concept-script">script</span> in the <span>stack of incumbent scripts</span> that is
   labeled as a <span data-x="candidate entry scripts">candidate entry script</span>. If the stack is
   empty, or has no entries labeled as such, then there is no <span>entry script</span>. It is used
-  to obtain, amongst other things, the <span>script's base URL</span> to <span data-x="resolve a
+  to obtain, amongst other things, the <span>API base URL</span> to <span data-x="resolve a
   url">resolve</span> relative <span data-x="URL">URLs</span> used in scripts running in that
   <span>unit of related similar-origin browsing contexts</span>.</p>
 
@@ -78284,9 +78416,8 @@
 
   <p>When the specification says that a <span data-x="concept-script">script</span> is to be <dfn
   data-x="create a script">created</dfn>, given some script source, a script source URL, its
-  scripting language, a global object, a browsing context, a document, a referrer source, a URL
-  character encoding, a base URL, and optionally a <var data-x="">muted errors</var> flag, the user
-  agent must run the following steps:</p>
+  scripting language, a <span>script settings object</span>, and optionally a <var data-x="">muted
+  errors</var> flag, the user agent must run the following steps:</p>
 
   <ol>
 
@@ -78297,17 +78428,15 @@
    context</span> passed to this algorithm, then abort these steps, as if the script source
    described a program that did nothing but return void.</p>
 
-   <li><p>Set up a <span>script execution environment</span> as appropriate for the given scripting
-   language.</p></li>
+   <li><p>Obtain the appropriate <span>script execution environment</span> for the given scripting
+   language from the <span>script settings object</span> provided.</p></li>
 
    <li><p>Parse/compile/initialize the source of the script using the <span>script execution
    environment</span>, as appropriate for the scripting language, and thus obtain <var
    data-x="">script</var>'s <span>code entry-point</span>.</p></li>
 
-   <li><p>Set up the <span>script's global object</span>, the <span>script's browsing
-   context</span>, the <span>script's document</span>, the <span>script's referrer source</span>,
-   the <span>script's URL character encoding</span>, and the <span>script's base URL</span> from the
-   settings passed to this algorithm.</p></li>
+   <li><p>Let <var data-x="">script</var>'s <span>settings object</span> be the <span>script
+   settings object</span> provided.</p></li>
 
    <li><p>If the <var data-x="">muted errors</var> flag was set, then set <var
    data-x="">script</var>'s <span>muted errors</span> flag.</p></li>
@@ -78318,8 +78447,9 @@
     <span data-x="jump to a code entry-point">Jump</span> to <var data-x="">script</var>'s <span>code
     entry-point</span>.</p>
 
+<!--CLEANUP-->
     <p>Otherwise, <span>report the error</span> for <var data-x="">script</var>, with the problematic
-    position (line number and column number), using the <span>script's global object</span> as the
+    position (line number and column number), using the <span>global object</span> specified by the <span>script settings object</span> as the
     target. If the error is still <i data-x="concept-error-nothandled">not handled</i> after this,
     then the error may be reported to the user.</p>
 
@@ -78327,43 +78457,6 @@
 
   </ol>
 
-  <hr>
-
-  <p>When the specification says that a <span data-x="concept-script">script</span> is to be <dfn
-  data-x="create a script from a node">created from a node</dfn> <var data-x="">node</var>, given some
-  script source, its URL, its scripting language, and optionally a <var data-x="">muted errors</var>
-  flag, the user agent must <span>create a script</span>, using the given script source, URL, and
-  scripting language, <span>the script settings determined from the node</span> <var
-  data-x="">node</var>, and, if the <var data-x="">muted errors</var> flag was set in the call to this
-  algorithm, the <var data-x="">muted errors</var> flag.</p>
-
-  <p><dfn>The script settings determined from the node</dfn> <var data-x="">node</var> are computed
-  as follows:</p>
-
-  <ol>
-
-   <li><p>Let <var data-x="">document</var> be the <code>Document</code> of <var data-x="">node</var>
-   (or <var data-x="">node</var> itself if it is a <code>Document</code>).</p></li>
-
-   <li><p>The global object is the <code>Window</code> object of <var
-   data-x="">document</var>.</p></li>
-
-   <li><p>The browsing context is the <span>browsing context</span> of <var
-   data-x="">document</var>.</p>
-
-   <li><p>The document is <var data-x="">document</var>.</p>
-
-   <li><p>The referrer source is <var data-x="">document</var>.</p>
-
-   <li><p>The URL character encoding is the <span data-x="document's character encoding">character
-   encoding</span> of <var data-x="">document</var>. (<a href="#sce-not-copy">This is a reference,
-   not a copy</a>.)</p></li>
-
-   <li><p>The base URL is the <span data-x="document base URL">base URL</span> of <var
-   data-x="">document</var>. (<a href="#sbu-not-copy">This is a reference, not a copy</a>.)</p></li>
-
-  </ol>
-
   </div>
 
 
@@ -78495,10 +78588,11 @@
 
   <h6>Runtime script errors in documents</h6>
 
+<!--CLEANUP-->
   <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
   <code>Document</code>, the user agent must <span>report the error</span> for the relevant <span
   data-x="concept-script">script</span>, with the problematic position (line number and column
-  number) in the resource containing the script, using the <span>script's global object</span> as
+  number) in the resource containing the script, using the <span>global object</span> specified by the script's <span>settings object</span> as
   the target. If the error is still <i data-x="concept-error-nothandled">not handled</i> after this,
   then the error may be reported to the user.</p>
 
@@ -78621,7 +78715,7 @@
   the task was queued in the context of a <span>browsing context</span>, then it is the
   <span>browsing context</span>'s <span>active document</span> at the time the task was queued; if
   the task was queued by or for a <span data-x="concept-script">script</span> then the document is
-  the <span>script's document</span>.</p>
+  the <span>responsible document</span> specified by the script's <span>settings object</span>.</p>
 
   <p>A <span data-x="concept-task">task</span> is intended for a specific <span>event loop</span>:
   the <span>event loop</span> that is handling <span data-x="concept-task">tasks</span> for the <span
@@ -78735,9 +78829,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><span data-x="concept-mo-invoke">Invoke <code>MutationObserver</code> objects</span> for the
-    <span>unit of related similar-origin browsing contexts</span> to which the <span>script's
-    browsing context</span> belongs, using the <span>task wrapper algorithm</span> as the steps to
+    <span>unit of related similar-origin browsing contexts</span> to which the <span>responsible
+    browsing context</span> specified by the script's <span>settings object</span> belongs, using the <span>task wrapper algorithm</span> as the steps to
     invoke each callback.</p>
 
     <p class="note">This will typically invoke scripted callbacks, which calls the <span>jump to a
@@ -78970,10 +79065,10 @@
       data-x="">address</var> be the <span data-x="the document's address">address</span> of the
       <span>creator <code>Document</code></span> instead.</p>
 
-      <p><span data-x="create a script from a node">Create a script</span> from the
-      <code>Document</code> node of the <span>active document</span>, using the aforementioned
-      script source, the <span>URL</span> of the resource where the <code>javascript:</code> URL,
-      was found, and assuming the scripting language is JavaScript.</p>
+      <p><span>Create a script</span>, using the aforementioned script source, the <span>URL</span>
+      of the resource where the <code>javascript:</code> URL, was found, JavaScript as the scripting
+      language, and the <span>script settings object</span> of the <code>Window</code> object of the
+      <span>active document</span>.</p>
 
       <p>Let <var data-x="">result</var> be the return value of the <span>code entry-point</span>
       of this <span data-x="concept-script">script</span>. If an exception was thrown, let <var
@@ -79118,8 +79213,13 @@
 
    <li><p>Set the corresponding <span data-x="event handlers">event handler</span> to null.</p></li>
 
-   <li><p>Set up a <span>script execution environment</span> for JavaScript.</p></li>
+   <li><p>Let <var data-x="">script settings</var> be the <span>script settings object</span> of the
+   <code>Window</code> object associated with the <span>browsing context</span> to which belongs the
+   <code>Document</code> of the element in question.</p></li>
 
+   <li><p>Obtain the <span>script execution environment</span> for JavaScript from <var
+   data-x="">script settings</var>.</p></li>
+
    <li><p>Let <var data-x="">body</var> be the <span data-x="event handler content attributes">event
    handler content attribute</span>'s new value.</p></li>
 
@@ -79164,7 +79264,8 @@
 
    <li>
 
-    <p>Using the script execution environment created above, create a function object (as defined in
+<!--CLEANUP-->
+    <p>Using the <span>script execution environment</span> obtained above, create a function object (as defined in
     ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
 
     <dl>
@@ -79227,15 +79328,13 @@
 
     </dl>
 
-    <p>Let this new function be the script's <span>code entry-point</span>.</p>
+<!--CLEANUP-->
+    <p>Let this new function be a new <span data-x="concept-script">script</span>'s <span>code entry-point</span>.</p>
 
    </li>
 
-   <li><p>Set up the <span>script's global object</span>, the <span>script's browsing
-   context</span>, the <span>script's document</span>, the <span>script's referrer source</span>,
-   the <span>script's URL character encoding</span>, and the <span>script's base URL</span> from
-   <span>the script settings determined from the node</span> on which the attribute is being
-   set.</p></li>
+   <li><p>Let that <span data-x="concept-script">script</span>'s <span>settings object</span> be
+   <var data-x="">script settings</var>.</p></li>
 
    <li><p>Set the corresponding <span data-x="event handlers">event handler</span> to the
    aforementioned function.</p></li>
@@ -80142,15 +80241,22 @@
    <li><p>Remove all child nodes of the document, without firing any mutation events.</p></li> <!--
    as of 2009-03-30, only WebKit fired mutation events here. -->
 
-   <li><p>Replace the <code>Document</code>'s singleton objects with new instances of those objects.
-   (This includes in particular the <code>Window</code>, <code>Location</code>,
-   <code>History</code>, <code>ApplicationCache</code>, and <code>Navigator</code>, objects, the
-   various <code>BarProp</code> objects, the two <code>Storage</code> objects, the various
-   <code>HTMLCollection</code> objects, and objects defined by other specifications, like
-   <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
-   IDL prototypes in the JavaScript binding, including the <code>Document</code> object's
-   prototype.)</p></li>
+   <li>
 
+    <p>Replace the <code>Document</code>'s singleton objects with new instances of those objects.
+    (This includes in particular the <code>Window</code>, <code>Location</code>,
+    <code>History</code>, <code>ApplicationCache</code>, and <code>Navigator</code>, objects, the
+    various <code>BarProp</code> objects, the two <code>Storage</code> objects, the various
+    <code>HTMLCollection</code> objects, and objects defined by other specifications, like
+    <code>Selection</code> and the document's <code>UndoManager</code>. It also includes all the Web
+    IDL prototypes in the JavaScript binding, including the <code>Document</code> object's
+    prototype.)</p>
+
+    <p class="note">The new <code>Window</code> object has a new <span>script settings
+    object</span>.</p>
+
+   </li>
+
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%20src%3D%22document%22%3E%3C%2Fiframe%3E%0A%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20f%20%3D%20document.getElementsByTagName('iframe')%5B0%5D%3B%20d%20%3D%20f.contentWindow.document%3B%20%7D%3C%2Fscript%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22w(d.documentElement.innerHTML)%22%20value%3D%22dump%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cscript%3Evar%20x%20%3D%20new%20XMLHttpRequest()%3Bx.open(%26quot%3BGET%26quot%3B%2C%20%26quot%3BGET%26quot%3B)%3Bx.onreadystatechange%3Dfunction()%20%7B%20alert(x.readyState)%3B%20%7D%3Bx.send(null)%3B%3C%2Fscript%3E')%3Bd.close()%3B%20setTimeout(function()%20%7B%20d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%20%7D%2C%200)%3B%22%20value%3D%22xhr%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.onclick%20%3D%20function()%20%7B%20w('click')%20%7D%22%20value%3D%22add%20click%20handler%22%3E%
 0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3Etest%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%22%3E%0A%3Cinput%20type%3Dbutton%20onclick%3D%22d.open()%3B%20d.write('%3Cp%3E%3Cscript%3Ei%20%3D%200%3B%20setTimeout(%26quot%3Bparent.w(i%2B%2B)%26quot%3B%2C%202000)%3C%2Fscript%3E%3C%2Fp%3E')%3B%20d.close()%22%20value%3D%22replace%20with%20timer%22%3E -->
    <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A...%3Ciframe%3E%3C%2Fiframe%3E%0D%0A%3Cscript%3E%0D%0Aonload%20%3D%20function%20()%20%7B%0D%0A%20frames%5B0%5D.test%20%3D%201%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20var%20a%20%3D%20frames%5B0%5D.document.location.assign%3B%0D%0A%20w(a)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%20frames%5B0%5D.document.open()%3B%0D%0A%20frames%5B0%5D.document.write('%3Cscript%3Edocument.write(test)%3C%5C%2Fscript%3E')%3B%0D%0A%20frames%5B0%5D.document.close()%3B%0D%0A%20w(frames%5B0%5D.test)%3B%0D%0A%20w(frames%5B0%5D.document.location.assign%20%3D%3D%3D%20a)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E -->
 
@@ -80163,9 +80269,10 @@
    <li><p>Set the <code>Document</code>'s <i
    data-x="concept-document-salvageable">salvageable</i> state back to true.</p></li>
 
-   <li><p>Change <span>the document's address</span> to the <span>entry script</span>'s <span
-   data-x="script's document">document</span>'s <span data-x="the document's
-   address">address</span>.</p></li>
+<!--CLEANUP-->
+   <li><p>Change <span>the document's address</span> to the <span data-x="the document's
+   address">address</span> of the <span>responsible document</span> specified by
+   the <span>entry script</span>'s <span>settings object</span>.</p></li>
 
    <!-- <span>the document's referrer</span> stays the same -->
 
@@ -80649,42 +80756,15 @@
 
          <li><p>Let <var data-x="">script language</var> be JavaScript.</p></li>
 
-         <li>
+         <li><p>Let <var data-x="">settings object</var> be <var data-x="">method context</var>'s
+         <span>script settings object</span>.</p></li>
 
-          <p>If <var data-x="">method context</var> is a <code>Window</code> object, let <var
-          data-x="">global object</var> be <var data-x="">method context</var>, let <var
-          data-x="">browsing context</var> be the <span>browsing context</span> with which <var
-          data-x="">global object</var> is associated, let <var data-x="">document</var> and <var
-          data-x="">referrer source</var> be the <code>Document</code> associated with <var
-          data-x="">global object</var>, let <var data-x="">character encoding</var> be the <span
-          data-x="document's character encoding">character encoding</span> of the <code>Document</code>
-          associated with <var data-x="">global object</var> (<a href="#sce-not-copy">this is a
-          reference, not a copy</a>), and let <var data-x="">base URL</var> be the <span
-          data-x="document base URL">base URL</span> of the <code>Document</code> associated with <var
-          data-x="">global object</var> (<a href="#sbu-not-copy">this is a reference, not a
-          copy</a>).</p>
+         <li><!--CLEANUP--><!--no need for all this whitespace-->
 
-          <p>Otherwise, <var data-x="">method context</var> is a <code>WorkerGlobalScope</code> object;
-          let <var data-x="">global object</var>, <var data-x="">browsing context</var>, <var
-          data-x="">document</var>, <var data-x="">referrer source</var>, <var data-x="">character
-          encoding</var>, and <var data-x="">base URL</var> be the <span>script's global object</span>,
-          <span>script's browsing context</span>, <span>script's document</span>, <span>script's
-          referrer source</span>, <span>script's URL character encoding</span>, and <span>script's
-          base URL</span> (respectively) of the <span data-x="concept-script">script</span> that the
-          <span>run a worker</span> algorithm created when it created <var data-x="">method
-          context</var>.</p>
-
-         </li>
-
-         <li>
-
           <p><span>Create a script</span> using <var data-x="">script source</var> as the script
           source, the <span>URL</span> where <var data-x="">script source</var> can be found, <var
-          data-x="">scripting language</var> as the scripting language, <var data-x="">global
-          object</var> as the global object, <var data-x="">browsing context</var> as the browsing
-          context, <var data-x="">document</var> as the document, <var data-x="">referrer source</var>
-          as the referrer source, <var data-x="">character encoding</var> as the URL character
-          encoding, and <var data-x="">base URL</var> as the base URL.</p>
+          data-x="">scripting language</var> as the scripting language, and <var data-x="">settings
+          object</var> as the <span>script settings object</span>.</p>
 
          </li>
 
@@ -80696,7 +80776,7 @@
 
      </li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>If the <var data-x="">repeat</var> flag is true, then call <span>timer initialization
       steps</span> again, passing them the same method arguments, the same <var data-x="">method
@@ -81084,7 +81164,8 @@
    <li>
 
     <p><span data-x="resolve a url">Resolve</span> <var data-x="">url</var> relative to the
-    <span>entry script</span>'s <span data-x="script's base URL">base URL</span>.</p>
+    <span>API base URL</span> specified by
+    <span>entry script</span>'s <span>settings object</span>.</p>
 
     <p>If this fails, then throw a <code>SyntaxError</code> exception and abort these steps.</p>
 
@@ -81114,9 +81195,10 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <span>active sandboxing flag set</span> of the <span>active document</span> of the
-    <span data-x="script's browsing context">browsing context</span> of the <span>incumbent
-    script</span> has its <span>sandboxed auxiliary navigation browsing context flag</span> set,
+    <span>responsible browsing context</span> specified by the <span>incumbent
+    script</span>'s <span>settings object</span> has its <span>sandboxed auxiliary navigation browsing context flag</span> set,
     then return the empty string and abort these steps.</p>
 
    </li>
@@ -81176,11 +81258,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Set all the flags in the new browsing context's <span>popup sandboxing flag set</span> that
     are set in the <span>active sandboxing flag set</span> of the <span>active document</span> of
-    the <span data-x="script's browsing context">browsing context</span> of the <span>incumbent
-    script</span>. The <span data-x="script's browsing
-    context">browsing context</span> of the <span>incumbent script</span>
+    the <span>responsible browsing context</span> specified by the <span>incumbent
+    script</span>'s <span>settings object</span>. The <span>responsible browsing context</span> specified by the <span>incumbent script</span>'s <span>settings object</span>
     must be set as the new browsing context's <span>one permitted sandboxed
     navigator</span>.</p>
 
@@ -81213,10 +81295,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p><span>Navigate</span><!--DONAV showModalDialog--> the new <span>browsing context</span> to
     the <span>absolute URL</span> that resulted from <span data-x="resolve a url">resolving</span>
-    <var data-x="">url</var> earlier, with <span>replacement enabled</span>, and with the <span
-    data-x="script's browsing context">browsing context</span> of the <span>incumbent script</span>
+    <var data-x="">url</var> earlier, with <span>replacement enabled</span>, and with the <span>responsible
+    browsing context</span> specified by the <span>incumbent script</span>'s <span>settings object</span>
     as the <span>source browsing context</span>.</p>
 
    </li>
@@ -81729,9 +81812,10 @@
     argument passed to one of these methods does not contain the exact literal string
     "<code>%s</code>".</p>
 
+<!--CLEANUP-->
     <p>User agents must throw a <code>SyntaxError</code> exception if <span data-x="resolve a
-    url">resolving</span> the <var data-x="">url</var> argument relative to the <span>entry
-    script</span>'s <span data-x="script's base URL">base URL</span>, is not successful.</p>
+    url">resolving</span> the <var data-x="">url</var> argument relative to the
+    <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings object</span> is not successful.</p>
 
     <p class="note">The resulting <span>absolute URL</span> would by definition not be a <span>valid
     URL</span> as it would include the string "<code data-x="">%s</code>" which is not a valid
@@ -81747,11 +81831,12 @@
     <p>The resulting <span>absolute URL</span> is the <dfn>proto-URL</dfn>. It identifies the
     handler for the purposes of the methods described below.</p>
 
+<!--CLEANUP-->
     <p>When the user agent uses this handler, it must replace the first occurrence of the exact
     literal string "<code data-x="">%s</code>" in the <var data-x="">url</var> argument with an
     escaped version of the <span>absolute URL</span> of the content in question (as defined below),
-    then <span data-x="resolve a url">resolve</span> the resulting URL, relative to the <span
-    data-x="script's base URL">base URL</span> of the <span>entry script</span> at the time the <code
+    then <span data-x="resolve a url">resolve</span> the resulting URL, relative to the <span>API
+    base URL</span> specified by the <span>entry script</span>'s <span>settings object</span> at the time the <code
     data-x="dom-navigator-registerContentHandler">registerContentHandler()</code> or <code
     data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> methods were
     invoked, and then <span>navigate</span><!--DONAV user--> an appropriate <span>browsing
@@ -81994,8 +82079,9 @@
    <li><p>If the string does not contain the substring "<code data-x="">%s</code>", abort these
    steps. There's no matching handler.</p></li>
 
-   <li><p><span data-x="resolve a URL">Resolve</span> the string relative to the <span
-   data-x="script's base URL">base URL</span> of the <span>entry script</span>.</p></li>
+<!--CLEANUP-->
+   <li><p><span data-x="resolve a URL">Resolve</span> the string relative to the <span>API base URL</span>
+   specified by the <span>entry script</span>'s <span>settings object</span>.</p></li>
 
    <li><p>If this fails, then throw a <code>SyntaxError</code> exception, aborting the
    method.</p></li>
@@ -82717,9 +82803,9 @@
     never does anything, or may arbitrarily ignore invocations with particular arguments for
     security, privacy, or usability reasons.</p></li>
 
+<!--CLEANUP-->
     <li><p><span data-x="resolve a url">Resolve</span> the value of the method's first argument
-    relative to the <span>entry script</span>'s <span data-x="script's base URL">base
-    URL</span>.</p></li>
+    relative to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings object</span>.</p></li>
 
     <li><p>If this fails, abort these steps.</p></li>
 
@@ -82746,9 +82832,10 @@
     <li><p>Let <var data-x="">host1</var> be the host component of the <span>origin</span> of the
     <span>entry script</span>.</p></li>
 
+<!--CLEANUP-->
     <li><p><span data-x="resolve a url">Resolve</span> the <var data-x="">scriptURL</var> argument
-    relative to the <span>entry script</span>'s <span data-x="script's base URL">base
-    URL</span>.</p></li>
+    relative to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings
+    object</span>.</p></li>
 
     <li><p>If this fails, return 0 and abort these steps.</p></li>
 
@@ -87304,9 +87391,10 @@
 
   <ol>
 
+<!--CLEANUP-->
    <li><p><span data-x="resolve a url">Resolve</span> the <span>URL</span> specified in the first
-   argument, relative to the <span>entry script</span>'s <span data-x="script's base URL">base
-   URL</span>.
+   argument, relative to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings
+   object</span>.
    <!--END complete-->
    <a href="#refsHTML">[HTML]</a>
    <!--START complete-->
@@ -87332,9 +87420,10 @@
 
    <li><!-- if you change this, don't forget to update the reconnecting fetch lower down as well! -->
 
+<!--CLEANUP-->
     <p>Do a <span>potentially CORS-enabled fetch</span><!--FETCH--> of the resulting <span>absolute
-    URL</span> using the <span>entry script</span>'s <span data-x="script's referrer source">referrer
-    source</span>, with the <i>mode</i> being <var data-x="">CORS mode</var>, and the <i
+    URL</span> using the <span>API referrer source</span> specified by the <span>entry script</span>'s <span>settings
+    object</span>, with the <i>mode</i> being <var data-x="">CORS mode</var>, and the <i
     data-x="">origin</i> being the <span>entry script</span>'s <span>origin</span><!--, and the
     <i>default origin behaviour</i> set to <i>fail</i> (though it has no effect in the "Anonymous"
     and "Use Credentials" modes)-->, and process the resource obtained in this fashion, if any, as
@@ -89237,7 +89326,7 @@
 
    </li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Let <var data-x="">message clone</var> be the result of obtaining a <span>structured
     clone</span> of the <var data-x="">message</var> argument, with <var data-x="">transfer map</var>
@@ -89253,14 +89342,14 @@
 
     <ol>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
-      <p>Let <var data-x="">new owner</var> be the <code>Window</code> object on which the method was
+      <p>Let <var data-x="">new owner</var> be the <span>script settings object</span> of the <code>Window</code> object on which the method was
       invoked.</p>
 
      </li>
 
-     <li>
+     <li><!--CLEANUP--><!--no need for all this whitespace-->
 
       <p>For each object <var data-x="">x</var> in <var data-x="">transfer</var> in turn, obtain a new
       object <var data-x="">y</var> by <span data-x="transfer a Transferable
@@ -89275,7 +89364,7 @@
 
    </li>
 
-   <li>
+   <li><!--CLEANUP--><!--no need for all this whitespace-->
 
     <p>Make <var data-x="">new ports</var> into a <span data-x="dfn-read-only-array">read only</span>
     array.</p>
@@ -89291,10 +89380,11 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>If the <var data-x="">targetOrigin</var> argument is a single literal U+002F SOLIDUS character
     (/), and the <code>Document</code> of the <code>Window</code> object on which the method was
-    invoked does not have the <span>same origin</span> as the <span>entry script</span>'s <span
-    data-x="script's document">document</span>, then abort these steps silently.</p>
+    invoked does not have the <span>same origin</span> as the <span>responsible document</span> specified by the <span>entry script</span>'s <span>settings
+    object</span>, then abort these steps silently.</p>
 
     <p>Otherwise, if the <var data-x="">targetOrigin</var> argument is an <span>absolute URL</span>,
     and the <code>Document</code> of the <code>Window</code> object on which the method was invoked
@@ -89308,6 +89398,7 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Create a <span data-x="concept-events-trusted">trusted</span> event that uses the
     <code>MessageEvent</code> interface, with the event type <code
     data-x="event-message">message</code>, which does not bubble, is not cancelable, and has no
@@ -89317,7 +89408,10 @@
     data-x="Unicode serialization of an origin">Unicode serialization</span> of the
     <span>origin</span> of the <span>incumbent script</span>, the <code
     data-x="dom-MessageEvent-source">source</code> attribute must be initialized to the
-    <span>script's global object</span>'s <code>WindowProxy</code> object, and the <code
+    <code>WindowProxy</code> object corresponding to the
+    <span>global object</span> (a <code>Window</code> object) specified by the
+    <span>incumbent script</span>'s <span>settings object</span>,
+    and the <code
     data-x="dom-MessageEvent-ports">ports</code> attribute must be initialized to the <var
     data-x="">new ports</var> array.
     <!--END complete-->
@@ -89575,11 +89669,15 @@
 
   <ol>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span>script's
-   global object</span>, and let <var data-x="">port1</var> be that object.</p></li>
+<!--CLEANUP-->
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span>
+   is the <span>settings object</span>
+   of the <span>incumbent script</span>, and let <var data-x="">port1</var> be that object.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span>script's
-   global object</span>, and let <var data-x="">port2</var> be that object.</p></li>
+<!--CLEANUP-->
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span>
+   is the <span>settings object</span>
+   of the <span>incumbent script</span>, and let <var data-x="">port2</var> be that object.</p></li>
 
    <li><p><span>Entangle</span> the <var data-x="">port1</var> and <var data-x="">port2</var>
    objects.</p></li>
@@ -89670,21 +89768,31 @@
   message queue</dfn>, initially empty. A <span>port message queue</span> can be enabled or
   disabled, and is initially disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed altogether, which has much the
-  same effect). A <code>MessagePort</code> also has a <dfn>has been shipped</dfn> flag. It must
-  initially be false.</p>
+  same effect). A <code>MessagePort</code> also has a <dfn>has been shipped</dfn> flag, which must
+  initially be false, and an <dfn data-x="concept-port-owner">owner</dfn>, which is a <span>settings
+  object</span> set when the object is created, as described below.</p>
 
+<!--CLEANUP-->
   <p>When a port's <span>port message queue</span> is enabled, the <span>event loop</span> must use
-  it as one of its <span data-x="task source">task sources</span>.</p>
+  it as one of its <span data-x="task source">task sources</span>. All <span
+  data-x="concept-task">tasks</span> <span data-x="queue a task">queued</span> on the <span>port
+  message queue</span> must be associated with the <span>responsible document</span> specified by
+  the port's <span data-x="concept-port-owner">owner</span>.</p>
 
-  <p class="note">If the <code>Document</code> of the port's event listeners' <span data-x="script's
-  global object">global object</span> is not <span>fully active</span>, then the messages are
+<!--CLEANUP-->
+  <p class="note">If the port's <span data-x="concept-port-owner">owner</span> specifies a <span>responsible document</span> that is <span>fully active</span>,
+  but the event listeners all have scripts whose <span data-x="settings object">settings objects</span>
+  specify <span data-x="responsible document">responsible documents</span> that are <em>not</em> <span>fully active</span>, then the messages will be
   lost.</p> <!-- because of the jump-to-entry-point algorithm first step -->
 
+<!--CLEANUP-->
   <p>Each <span>event loop</span> has a <span>task source</span> called the <dfn>unshipped port
   message queue</dfn>. This is a virtual <span>task source</span>: it must act as if it contained
   the <span data-x="concept-task">tasks</span> of each <span>port message queue</span> of each
-  <code>MessagePort</code> whose <span>has been shipped</span> flag is false and whose <span>port
-  message queue</span> is enabled, in the order in which they were added to their respective
+  <code>MessagePort</code> whose <span>has been shipped</span> flag is false, whose <span>port
+  message queue</span> is enabled, and whose <span data-x="concept-port-owner">owner</span>
+  specifies that <span>event loop</span> as the <span>responsible event loop</span>,
+  in the order in which they were added to their respective
   <span>task source</span>. When a <span data-x="concept-task">task</span> would be removed from the
   <span>unshipped port message queue</span>, it must instead be removed from its <span>port message
   queue</span>.</p>
@@ -89699,9 +89807,10 @@
   is true, its <span>port message queue</span> acts as a first-class <span>task source</span>,
   unaffected to any <span>unshipped port message queue</span>.</p>
 
-  <p>When the user agent is to <dfn>create a new <code>MessagePort</code> object</dfn> owned by a
-  <span>script's global object</span> object <var data-x="">owner</var>, it must instantiate a new
-  <code>MessagePort</code> object, and let its owner be <var data-x="">owner</var>.</p>
+<!--CLEANUP-->
+  <p>When the user agent is to <dfn>create a new <code>MessagePort</code> object</dfn> with a particular
+  <span>settings object</span> as its <var data-x="">owner</var>, it must instantiate a new
+  <code>MessagePort</code> object, and let its <span data-x="concept-port-owner">owner</span> be <var data-x="">owner</var>.</p>
 
   <p>When the user agent is to <dfn>entangle</dfn> two <code>MessagePort</code> objects, it must run
   the following steps:</p>
@@ -89745,7 +89854,7 @@
    <li><p>Set <var data-x="">original port</var>'s <span>has been shipped</span> flag to
    true.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by <var
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span> is <var
    data-x="">owner</var>, and let <var data-x="">new port</var> be that object.</p></li>
 
    <li><p>Set <var data-x="">new port</var>'s <span>has been shipped</span> flag to true.</p></li>
@@ -89872,7 +89981,8 @@
 
      <li>
 
-      <p>Let <var data-x="">new owner</var> be the owner of <var data-x="">target port</var>, if there
+<!--CLEANUP-->
+      <p>Let <var data-x="">new owner</var> be the <span data-x="concept-port-owner">owner</span> of <var data-x="">target port</var>, if there
       is a <var data-x="">target port</var>, or else some arbitrary owner. (This <var data-x="">new
       owner</var> is used when transferring objects below. If there is no <var data-x="">target
       port</var>, the <code>Transferable</code> objects given in the second argument, if any, are
@@ -89943,8 +90053,9 @@
 
    <li><p>Let <var data-x="">message</var> be the method's first argument.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span>script's
-   global object</span>, and let <var data-x="">port1</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   data-x="concept-port-owner">owner</span> is the <span>incumbent script</span>'s <span>settings
+   object</span>, and let <var data-x="">port1</var> be that object.</p></li>
 
    <li><p>If the <var data-x="">source port</var> is not entangled with another port, then return
    <var data-x="">port1</var> and abort these steps.</p></li> <!- - we don't throw an exception
@@ -89954,8 +90065,9 @@
    <li><p>Let <var data-x="">target port</var> be the port with which <var data-x="">source port</var>
    is entangled.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the owner of the <var
-   data-x="">target port</var>, and let <var data-x="">port2</var> be that object.</p></li>
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
+   data-x="concept-port-owner">owner</span> is the <span data-x="concept-port-owner">owner</span> of
+   the <var data-x="">target port</var>, and let <var data-x="">port2</var> be that object.</p></li>
 
    <li><p><span>Entangle</span> the <var data-x="">port1</var> and <var data-x="">port2</var>
    objects.</p></li>
@@ -90132,9 +90244,10 @@
 
   <div class="impl">
 
+<!--CLEANUP-->
   <p>When a <code>MessagePort</code> object <var data-x="">o</var> is entangled, user agents must
   either act as if <var data-x="">o</var>'s entangled <code>MessagePort</code> object has a strong
-  reference to <var data-x="">o</var>, or as if <var data-x="">o</var>'s owner has a strong reference
+  reference to <var data-x="">o</var>, or as if the <span>global object</span> specified by <var data-x="">o</var>'s <span data-x="concept-port-owner">owner</span> has a strong reference
   to <var data-x="">o</var>.</p>
 
   <div class="note">
@@ -90729,7 +90842,7 @@
   environment</span>.</p>
 
   <p>Shared workers receive message ports through <code
-  data-x="event-WorkerGlobalScope-connect">connect</code> events on their global object for each
+  data-x="event-WorkerGlobalScope-connect">connect</code> events on their <code>SharedWorkerGlobalScope</code> object for each
   connection.</p>
 
   <p>The <dfn data-x="dom-SharedWorkerGlobalScope-name"><code>name</code></dfn> attribute must return
@@ -90820,14 +90933,15 @@
   it must be removed from the list of <span>the worker's <code>Document</code>s</span> of each
   worker whose list contains that <code>Document</code>.</p>
 
-  <p>Given a <span>script's global object</span> <var data-x="">o</var> when creating or obtaining a
+<!--CLEANUP-->
+  <p>Given a <span>settings object</span> <var data-x="">o</var> when creating or obtaining a
   worker, the <dfn>list of relevant <code>Document</code> objects to add</dfn> depends on the type
-  of <var data-x="">o</var>. If <var data-x="">o</var> is a <code>WorkerGlobalScope</code> object
+  of <span>global object</span> specified by <var data-x="">o</var>'s. If <var data-x="">o</var>
+  specifies a <span>global object</span> that is a <code>WorkerGlobalScope</code> object
   (i.e. if we are creating a nested worker), then the relevant <code>Document</code>s are the
-  <code>Document</code>s that are in <var data-x="">o</var>'s own list of <span>the worker's
-  <code>Document</code>s</span>. Otherwise, <var data-x="">o</var> is a <code>Window</code> object,
-  and the relevant <code>Document</code> is just the <code>Document</code> that is the <span>active
-  document</span> of the <code>Window</code> object <var data-x="">o</var>.</p>
+  <span>the worker's <code>Document</code>s</span> of the <span>global object</span> specified by
+  <var data-x="">o</var>. Otherwise, <var data-x="">o</var> specifies a <span>global object</span> that is a <code>Window</code> object,
+  and the relevant <code>Document</code> is just the <span>responsible document</span> specified by <var data-x="">o</var>.</p>
 
   <hr>
 
@@ -90848,10 +90962,10 @@
 
   <h4>Processing model</h4>
 
+<!--CLEANUP-->
   <p>When a user agent is to <dfn>run a worker</dfn> for a script with <span>URL</span> <var
-  data-x="">url</var>, a <span>browsing context</span> <var data-x="">owner browsing context</var>, a
-  <code>Document</code> <var data-x="">owner document</var>, an <span>origin</span> <var
-  data-x="">owner origin</var>, and with global scope <var data-x="">worker global scope</var>, it
+  data-x="">url</var>, a <span>script settings object</span> <var data-x="">settings object</var>,
+  and an <span>origin</span> <var data-x="">owner origin</var>, it
   must run the following steps:</p>
 
   <ol>
@@ -90866,6 +90980,9 @@
 
    </li>
 
+   <li><p>Let <var data-x="">worker global scope</var> be the <span>global object</span> specified
+   by <var data-x="">settings object</var>.</p></li>
+
    <li><p>If <var data-x="">worker global scope</var> is actually a
    <code>SharedWorkerGlobalScope</code> object (i.e. the worker is a shared worker), and there are
    any <span data-x="relevant application cache">relevant application caches</span> that are
@@ -90878,8 +90995,8 @@
    <li>
 
     <p>Attempt to <span>fetch</span><!--FETCH--> the resource identified by <var data-x="">url</var>,
-    from the <var data-x="">owner origin</var>, using <var data-x="">owner document</var> as the
-    <span>referrer source</span>, with the <i>synchronous flag</i> set and the <i>force same-origin
+    from the <var data-x="">owner origin</var>, using the <span>responsible document</span> specified by <var data-x="">settings object</var> as the
+    <span>referrer source</span> (not the specified <span>API referrer source</span>!), with the <i>synchronous flag</i> set and the <i>force same-origin
     flag</i> set.</p> <!-- not http-origin privacy sensitive (looking forward to CORS) -->
 
     <p>If the attempt fails, then for each <code>Worker</code> or <code>SharedWorker</code> object
@@ -90908,30 +91025,18 @@
 
    <li><!-- SCRIPT EXEC -->
 
-    <p>A new <span data-x="concept-script">script</span> is now created, as follows.</p>
+    <p>Let <var data-x="">script</var> be a new <span data-x="concept-script">script</span>.</p>
 
-    <p>Create a new <span>script execution environment</span> set up as appropriate for the
-    scripting language <var data-x="">language</var>.</p>
+    <p>Obtain the appropriate <span>script execution environment</span> for the scripting language
+    <var data-x="">language</var> from <var data-x="">settings object</var>.</p>
 
     <p>Parse/compile/initialize <var data-x="">source</var> using that <span>script execution
     environment</span>, as appropriate for <var data-x="">language</var>, and thus obtain a
     <span>code entry-point</span>.</p>
 
-    <p>Set the <span>script's global object</span> to <var data-x="">worker global scope</var>.</p>
+    <p>Let <var data-x="">script</var>'s <span>settings object</span> be <var data-x="">settings
+    object</var>.</p>
 
-    <p>Set the <span>script's browsing context</span> to <var data-x="">owner browsing
-    context</var>.</p>
-
-    <p>Set the <span>script's document</span> to <var data-x="">owner document</var>.</p>
-
-    <p>Set the <span>script's referrer source</span> to <var
-    data-x="">url</var>.</p>
-
-    <p>Set the <span>script's URL character encoding</span> to UTF-8. (This is just used for
-    encoding non-ASCII characters in the query component of URLs.)</p>
-
-    <p>Set the <span>script's base URL</span> to <var data-x="">url</var>.</p>
-
    </li>
 
    <li>
@@ -90980,8 +91085,8 @@
 
    <li>
 
-    <p><strong>Event loop<!-- labeled for ease of discussion --></strong>: Create a new <span>event
-    loop</span>, and run it until it is destroyed.</p>
+    <p><strong>Event loop<!-- labeled for ease of discussion --></strong>: Run the <span>responsible
+    event loop</span> specified by <var data-x="">settings object</var> until it is destroyed.</p>
 
     <p class="note">The handling of events or the execution of callbacks by <span
     data-x="concept-task">tasks</span> run by the <span>event loop</span> might get prematurely
@@ -91166,7 +91271,105 @@
   </table>
 
 
+  <h5>Script settings for workers</h5>
 
+  <p>When the user agent is required to <dfn>set up a worker script settings object</dfn>, given a
+  <var data-x="">worker global scope</var>, it must run the following steps:</p>
+
+  <ol>
+
+   <li><p>Let <var data-x="">inherited responsible browsing context</var> be the <span>responsible
+   browsing context</span> specified by the <span>incumbent script</span>'s <span>settings
+   object</span>.</p></li>
+
+   <li><p>Let <var data-x="">inherited responsible document</var> be the <span>responsible
+   document</span> specified by the <span>incumbent script</span>'s <span>settings
+   object</span>.</p></li>
+
+   <li><p>Let <var data-x="">worker event loop</var> be a newly created <span>event
+   loop</span>.</p></li>
+
+   <li>
+
+    <p>Let <var data-x="">settings object</var> be a new <span>script settings object</span> whose
+    algorithms are defined as follows:</p>
+
+    <dl>
+
+     <dt>The <span data-x="script execution environment">script execution environments</span></dt>
+     <dd>
+
+      <p>When the <span>script settings object</span> is created, for each language supported by the
+      user agent, create an appropriate execution environment as defined by the relevant
+      specification.</p>
+
+      <p>When a <span>script execution environment</span> is needed, return the appropriate one from
+      those created when the <span>script settings object</span> was created.</p>
+
+      <p class="note">Currently, workers only support JavaScript, so only a JavaScript execution
+      environment is actually needed here.</p>
+
+     </dd>
+
+     <dt>The <span>global object</span></dt>
+     <dd>
+
+      <p>Return <var data-x="">worker global scope</var>.</p>
+
+     </dd>
+
+     <dt>The <span>responsible browsing context</span></dt>
+     <dd>
+
+      <p>Return <var data-x="">inherited responsible browsing context</var>.</p>
+
+     </dd>
+
+     <dt>The <span>responsible document</span></dt>
+     <dd>
+
+      <p>Return <var data-x="">inherited responsible document</var>.</p>
+
+     </dd>
+
+     <dt>The <span>responsible event loop</span></dt>
+     <dd>
+
+      <p>Return <var data-x="">worker event loop</var>.</p>
+
+     </dd>
+
+     <dt>The <span>API referrer source</span></dt>
+     <dd>
+
+      <p>Return the <code>Document</code> with which the <code>Window</code> is currently
+      associated.</p>
+
+     </dd>
+
+     <dt>The <span>API URL character encoding</span></dt>
+     <dd>
+
+      <p>Return UTF-8.</p>
+
+     </dd>
+
+     <dt>The <span>API base URL</span></dt>
+     <dd>
+
+      <p>Return <var data-x="">worker URL</var>.</p>
+
+     </dd>
+
+    </dl>
+
+   </li>
+
+   <li><p>Return <var data-x="">settings object</var>.</p></li>
+
+  </ol>
+
+
   <h5>Dedicated workers and the <code>Worker</code> interface</h5>
 
   <pre class="idl">[<span data-x="dom-Worker">Constructor</span>(DOMString scriptURL)]
@@ -91234,17 +91437,21 @@
    the request violates a policy decision (e.g. if the user agent is configured to not allow the
    page to start dedicated workers).</p></li>
 
+<!--CLEANUP-->
    <li><p><span data-x="resolve a url">Resolve</span> the <var data-x="">scriptURL</var> argument
-   relative to the <span>entry script</span>'s <span data-x="script's base URL">base URL</span>, when
-   the method is invoked.</p></li>
+   relative to the <span>API base URL</span> specified by the <span>entry script</span>'s <span>settings object</span> when
+   the method was invoked.</p></li>
 
    <li><p>If this fails, throw a <code>SyntaxError</code> exception and abort these steps.</p></li>
 
+   <li><p>Let <var data-x="">worker URL</var> be the resulting <span>absolute URL</span>.</p></li>
+
    <li>
 
-    <p>If the <span data-x="concept-url-scheme">scheme</span> component of the resulting <span>parsed
-    URL</span> is not "<code data-x="data-protocol">data</code>", and the <span>origin</span> of the
-    resulting <span>absolute URL</span> is not the <span data-x="same origin">same</span> as the
+<!--CLEANUP-->
+    <p>If the <span data-x="concept-url-scheme">scheme</span> component of <var data-x="">worker URL</var>
+    is not "<code data-x="data-protocol">data</code>", and the <span>origin</span> of <var data-x="">worker URL</var>
+    is not the <span data-x="same origin">same</span> as the
     origin of the <span>entry script</span>, then throw a <code>SecurityError</code> exception and
     abort these steps.</p>
 
@@ -91260,17 +91467,22 @@
    origin</span> is the origin of the <span>entry script</span>. Let <var data-x="">worker global
    scope</var> be this new object.</p></li>
 
+   <li><p><span>Set up a worker script settings object</span> with <var data-x="">worker global
+   scope</var>, and let <var data-x="">settings object</var> be the result.</p></li>
+
    <li><p>Create a new <code>Worker</code> object, associated with <var data-x="">worker global
    scope</var>. Let <var data-x="">worker</var> be this new object.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span
-   data-x="script's global object">global object</span> of the <span>incumbent script</span>. Let
+<!--CLEANUP-->
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span>
+   is the <span>settings object</span> of the <span>incumbent script</span>. Let
    this be the <var data-x="">outside port</var>.</p></li>
 
    <li><p>Associate the <var data-x="">outside port</var> with <var data-x="">worker</var>.</p></li>
 
-   <li><p><span>Create a new <code>MessagePort</code> object</span> owned by <var data-x="">worker
-   global scope</var>. Let <var data-x="">inside port</var> be this new object.</p></li>
+<!--CLEANUP-->
+   <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span> is <var data-x="">script settings</var>
+   Let <var data-x="">inside port</var> be this new object.</p></li>
 
    <li><p>Associate <var data-x="">inside port</var> with <var data-x="">worker global
    scope</var>.</p></li>
@@ -91288,8 +91500,9 @@
 
    <li>
 
+<!--CLEANUP-->
     <p>Let <var data-x="">docs</var> be the <span>list of relevant <code>Document</code> objects to
-    add</span> given the <span data-x="script's global object">global object</span> of the
+    add</span> given the <span>settings object</span> of the
     <span>incumbent script</span>.</p>
 
    </li>
@@ -91304,22 +91517,20 @@
 
    <li>
 
-    <p>If the <span data-x="script's global object">global object</span> of the <span>incumbent
-    script</span> is a <code>WorkerGlobalScope</code> object (i.e. we are creating a nested worker),
+<!--CLEANUP-->
+    <p>If the <span>global object</span> specified by the <span>incumbent
+    script</span>'s <span>settings object</span> is a <code>WorkerGlobalScope</code> object (i.e. we are creating a nested worker),
     add <var data-x="">worker global scope</var> to the list of <span>the worker's workers</span> of
-    the <code>WorkerGlobalScope</code> object that is the <span data-x="script's global
-    object">global object</span> of the <span>incumbent script</span>.</p>
+    the <code>WorkerGlobalScope</code> object that is the <span>global object</span> of the <span>incumbent script</span>'s <span>settings object</span>.</p>
 
    </li>
 
    <li>
 
-    <p><span>Run a worker</span> for the resulting <span>absolute URL</span>, with the
-    <span>script's browsing context</span> of the <span>incumbent script</span> as the <var
-    data-x="">owner browsing context</var>, with the <span>script's document</span> of the
-    <span>incumbent script</span> as the <var data-x="">owner document</var>, with the
-    <span>origin</span> of the <span>entry script</span> as the <var data-x="">owner origin</var>,
-    and with <var data-x="">worker global scope</var> as the global scope.</p>
+    <p><span>Run a worker</span> for the script with <span>URL</span> <var data-x="">worker
+    URL</var>, the <span>script settings object</span> <var data-x="">settings object</var>, and the
+    <span>origin</span> of the <span>entry script</span> as the <var data-x="">owner
+    origin</var>.</p>
 
    </li>
 
@@ -91379,7 +91590,7 @@
    <li>
 
     <p>Let <var data-x="">docs</var> be the <span>list of relevant <code>Document</code> objects to
-    add</span> given the <span data-x="script's global object">global object</span> of the
+    add</span> given the <span>settings object</span> of the
     <span>incumbent script</span>.</p>
 
    </li>
@@ -91394,8 +91605,9 @@
      <code>SharedWorkerGlobalScope</code> object. Let this <code>SharedWorker</code> object be <var
      data-x="">worker</var>.</p></li>
 
-     <li><p><span>Create a new <code>MessagePort</code> object</span> owned by the <span
-     data-x="script's global object">global object</span> of the <span>incumbent script</span>. Let
+<!--CLEANUP-->
+     <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span>
+     is the <span>settings object</span> of the <span>incumbent script</span>. Let
      this be the <var data-x="">outside port</var>.</p></li>
 
      <li><p>Assign <var data-x="">outside port</var> to the <code
@@ -91451,9 +91663,13 @@
        <li><p>Associate <var data-x="">worker</var> with <var data-x="">worker global
        scope</var>.</p></li>
 
-       <li><p><span>Create a new <code>MessagePort</code> object</span> owned by <var
-       data-x="">worker global scope</var>. Let this be the <var data-x="">inside port</var>.</p></li>
+       <li><p>Let <var data-x="">settings object</var> be the <span>script settings object</span>
+       whose <span>global object</span> is <var data-x="">worker global scope</var>.</p></li>
 
+<!--CLEANUP-->
+       <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span>
+       is <var data-x="">settings object</var>. Let this be the <var data-x="">inside port</var>.</p></li>
+
        <li><p><span>Entangle</span> <var data-x="">outside port</var>
        and <var data-x="">inside port</var>.</p></li>
 
@@ -91479,11 +91695,12 @@
 
        <li>
 
-        <p>If the <span data-x="script's global object">global object</span> of the <span>incumbent
-        script</span> is a <code>WorkerGlobalScope</code> object, add <var data-x="">worker global
+<!--CLEANUP-->
+        <p>If the <span>global object</span> specified by the <span>incumbent
+        script</span>'s <span>settings object</span> is a <code>WorkerGlobalScope</code> object, add <var data-x="">worker global
         scope</var> to the list of <span>the worker's workers</span> of the
-        <code>WorkerGlobalScope</code> object that is the <span data-x="script's global
-        object">global object</span> of the <span>incumbent script</span>.</p>
+        <code>WorkerGlobalScope</code> object that is the <span>global
+        object</span> specified by the <span>incumbent script</span>'s <span>settings object</span>.</p>
 
        </li>
 
@@ -91493,18 +91710,24 @@
 
      </li>
 
+     <!-- OTHERWISE: -->
+
      <li><p>Create a new <code>SharedWorkerGlobalScope</code> object whose <span>worker
      origin</span> is the origin of the <span>entry script</span>. Let <var data-x="">worker global
      scope</var> be this new object.</p></li>
 
+     <li><p><span>Set up a worker script settings object</span> with <var data-x="">worker global
+     scope</var>, and let <var data-x="">settings object</var> be the result.</p></li>
+
      <li><p>Associate <var data-x="">worker</var> with <var data-x="">worker global
      scope</var>.</p></li>
 
      <li><p>Set the <code data-x="dom-SharedWorkerGlobalScope-name">name</code> attribute of <var
      data-x="">worker global scope</var> to <var data-x="">name</var>.</p></li>
 
-     <li><p><span>Create a new <code>MessagePort</code> object</span> owned by <var data-x="">worker
-     global scope</var>. Let <var data-x="">inside port</var> be this new object.</p></li>
+<!--CLEANUP-->
+     <li><p><span>Create a new <code>MessagePort</code> object</span> whose <span data-x="concept-port-owner">owner</span> is <var data-x="">settings object</var>.
+     Let <var data-x="">inside port</var> be this new object.</p></li>
 
      <li><p><span>Entangle</span> <var data-x="">outside port</var> and <var data-x="">inside
      port</var>.</p></li>
@@ -91536,22 +91759,21 @@
 
    <li>
 
-    <p>If the <span data-x="script's global object">global object</span> of the <span>incumbent
-    script</span> that invoked the constructor is a <code>WorkerGlobalScope</code> object, add <var
+<!--CLEANUP-->
+    <p>If the <span>global object</span> specified by the <span>settings object</span> of the <span>incumbent
+    script</span> is a <code>WorkerGlobalScope</code> object, add <var
     data-x="">worker global scope</var> to the list of <span>the worker's workers</span> of the
-    <code>WorkerGlobalScope</code> object that is the <span data-x="script's global object">global
-    object</span> of the <span>incumbent script</span>.</p>
+    <code>WorkerGlobalScope</code> object that is the <span>global
+    object</span> specified by the <span>incumbent script</span>'s <span>settings object</span>.</p>
 
    </li>
 
    <li>
 
-    <p><span>Run a worker</span> for <var data-x="">scriptURL</var>, with the <span>script's browsing
-    context</span> of the <span>incumbent script</span> as the <var data-x="">owner browsing
-    context</var>, with the <span>script's document</span> of the <span>incumbent script</span> the
-    <var data-x="">owner document</var>, with the <span>origin</span> of the <span>entry
-    script</span> as the <var data-x="">owner origin</var>, and with <var data-x="">worker global
-    scope</var> as the global scope.</p>
+    <p><span>Run a worker</span> for the script with <span>URL</span> <var
+    data-x="">scriptURL</var>, the <span>script settings object</span> <var data-x="">settings
+    object</var>, and the <span>origin</span> of the <span>entry script</span> as the <var
+    data-x="">owner origin</var>.</p>
 
    </li>
 
@@ -91594,16 +91816,20 @@
 
    <li><p>If there are no arguments, return without doing anything. Abort these steps.</p></li>
 
+   <li><p>Let <var data-x="">settings object</var> be the <span>script settings object</span> of the
+   <span>incumbent script</span>.</p></li>
+
    <li><p><span data-x="resolve a url">Resolve</span> each argument.</p></li>
 
    <li><p>If any fail, throw a <code>SyntaxError</code> exception and abort these steps.</p></li>
 
    <li>
 
+<!--CLEANUP-->
     <p>Attempt to <span>fetch</span><!--FETCH--> each resource identified by the resulting <span
     data-x="absolute URL">absolute URLs</span>, from the <span>entry script</span>'s
-    <span>origin</span>, using the <span>entry script</span>'s <span data-x="script's referrer
-    source">referrer source</span>, and with the <i>synchronous flag</i> set.</p> <!-- not
+    <span>origin</span>, using the <span>API referrer source</span> specified by <var data-x="">settings
+    object</var>, and with the <i>synchronous flag</i> set.</p> <!-- not
     http-origin privacy sensitive -->
 
    </li>
@@ -91634,16 +91860,14 @@
 
      <li>
 
-      <p><span>Create a script</span>, using <var data-x="">source</var> as the script source, the
-      <span>URL</span> from which <var data-x="">source</var> was obtained, and <var
-      data-x="">language</var> as the scripting language, using the same global object, browsing
-      context, document, referrer source, URL character encoding, and base URL as the <span
-      data-x="concept-script">script</span> that was created by the worker's <span>run a
-      worker</span> algorithm.</p>
+      <p><span>Create a script</span> using <var data-x="">source</var> as the script source, the
+      <span>URL</span> from which <var data-x="">source</var> was obtained, <var
+      data-x="">language</var> as the scripting language, and <var data-x="">settings object</var> as
+      the <span>script settings object</span>.</p>
 
       <p>If the script came from a resource whose <span>URL</span> does not have the <span>same
       origin</span> as the <span>worker origin</span>, then pass the <var data-x="">muted
-      errors</var> flag to the <span>create a script from a node</span> algorithm.</p>
+      errors</var> flag to the <span>create a script</span> algorithm as well.</p>
 
       <p>Let the newly created <span data-x="concept-script">script</span> run until it either
       returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
@@ -105612,7 +105836,7 @@
    <li>None of the elements in the <code>Document</code> are in any of the following namespaces: <span>HTML namespace</span>, <span>SVG namespace</span>, <span>MathML namespace</span>
    <li>The <code>Document</code> has no <span>focusable</span> elements (e.g. from XLink).
    <li>The <code>Document</code> has no <span data-x="hyperlink">hyperlinks</span> (e.g. from XLink).
-   <li>There exists no <span data-x="concept-script">script</span> whose <span data-x="script's document">document</span> is this <code>Document</code>.
+   <li>There exists no <span data-x="concept-script">script</span> whose <span>settings object</span> specifies this <code>Document</code> as the <span>responsible document</span>.
    <li>None of the elements in the <code>Document</code> have any registered event listeners.
   </ul>
 




More information about the Commit-Watchers mailing list