NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 259 - Define 'URL' and 'valid URL'. Define 'script document context'. Introduce the term 'script browsing context' for the existing concept of 'browsing context associated with a script execution context' and use that term where appropriate. Define origin of...
Define 'URL' and 'valid URL'. Define 'script document context'. Introduce the...
Status: NEW
Product: Validator.nu
Classification: Unclassified
Component: Datatype library
HEAD
All All
: P2 normal
Assigned To: Nobody
http://svn.whatwg.org/webapps/source?...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-22 15:34 CEST by Henri Sivonen
Modified: 2009-11-23 17:16 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henri Sivonen 2008-07-22 15:34:11 CEST
Index: source
===================================================================
--- source	(revision 1790)
+++ source	(revision 1791)
@@ -945,6 +945,39 @@
 
   <h3>URLs</h3><!-- XXXURL -->
 
+  <p class="big-issue">The text in this section is not yet integrated
+  with the rest of the specification.</p>
+
+  <h4>Terminology</h4>
+
+  <p>A <dfn>URL</dfn> is a string used to identify a resource. A
+  <span>URL</span> is always associated with a <code>Document</code>,
+  either explicitly when the URL is created or defined; or through a
+  DOM node, in which case the associated <code>Document</code> is the
+  node's <code>Document</code>; or through a script, in which case the
+  associated <code>Document</code> is the script's <span>script
+  document context</span>.</p>
+
+  <p>A <span>URL</span> is a <dfn>valid URL</dfn> if at least one of
+  the following conditions holds:</p>
+
+  <ul>
+
+   <li><p>The <span>URL</span> is a valid URI.</p></li>
+
+   <li><p>The <span>URL</span> is a valid IRI and it has no query
+   component.</p></li>
+
+   <li><p>The <span>URL</span> is a valid IRI and its query component
+   contains no unescaped non-ASCII characters.</p></li>
+
+   <li><p>The <span>URL</span> is a valid IRI and the <span
+   title="document's character encoding">character encoding</span> of
+   the URL's <code>Document</code> is UTF-8.</p></li>
+
+  </ul>
+
+
   <div class="big-issue">
 
    <p>This section will do the following:</p>
@@ -18203,8 +18236,9 @@
   title="clipping region">clipping region</span>, and <span
   title="dom-context-2d-globalCompositeOperation">global composition
   operators</span>. (Transformations affect the path when the path is
-  created, not when it is painted, though the stroke <em>style</em> is
-  still affected by the transformation during painting.)</p>
+  created, not when it is painted, though the stroke <em
+  title="">style</em> is still affected by the transformation during
+  painting.)</p>
 
   <p>Zero-length line segments must be pruned before stroking a
   path. Empty subpaths must be ignored.</p>
@@ -22584,6 +22618,7 @@
 
       </dl>
 
+      <!-- SCRIPT EXEC -->
       <p>In any case, the user agent must execute the script according to
       the semantics defined by the language associated with <var>the
       script's type</var> (see the <a href="#scriptingLanguages">scripting
@@ -22593,6 +22628,10 @@
       be the <code>Window</code> object of that <span>browsing
       context</span>.</p>
 
+      <p>The <span>script document context</span> of the script must
+      be the <code>Document</code> object that owns the
+      <code>script</code> element.</p>
+
       <p class="note">The element's attributes' values might have changed
       between when the element was inserted into the document and when the
       script has finished loading, as may its other attributes; similarly,
@@ -27526,14 +27565,8 @@
   <span>browsing context</span> was just created as part of the
   <span>the rules for choosing a browsing context given a browsing
   context name</span>. The navigation must be done with the
-  <span>browsing context</span> corresponding to the
-  <code>Window</code> object that is the <span>script execution
-  context</span> of the script that invoked the method as the
-  <span>source browsing context</span>.</p>
-
-  <p class="note">If the <span>script execution context</span> of a
-  script isn't a <code>Window</code> object, then it can't ever get to
-  a <code>Window</code> object to call this method.</p>
+  <span>script browsing context</span> of the script that invoked the
+  method as the <span>source browsing context</span>.</p>
 
   <p>The method must return the <code>Window</code> object of the
   default view of the <span>browsing context</span> that was
@@ -27665,6 +27698,12 @@
      <code>script</code> element belongs.</dd>
 
 
+     <dt>If a script is in an <span title="event handler content attributes">event handler content attribute</span></dt>
+
+     <dd>The owner is the <code>Document</code> to which the
+     attribute node belongs.</dd>
+
+
      <dt>If a script is a function or other code reference created by
      another script</dt>
 
@@ -28057,20 +28096,35 @@
 
   </ul>
 
+  <p>When a script is created<!-- which is marked by SCRIPT EXEC in
+  this spec -->, it is associated with a <span>script execution
+  context</span>, a <span>script browsing context</span>, and a
+  <span>script document context</span>.</p>
 
 
+
+  <!-- SCRIPT EXEC -->
   <h4>Script execution contexts</h4>
 
   <p>The <dfn>script execution context</dfn> of a script is defined
-  when that script is created. It is typically a <code>Window</code>
-  object.</p>
+  when that script is created. It is either a <code>Window</code>
+  object or an empty object.</p>
+
+  <p>When the <span>script execution context</span> of a script is an
+  empty object, it can't do anything that interacts with the
+  environment.</p>
+
+  <hr>
 
   <p>A <span>script execution context</span> always has an associated
-  <span>browsing context</span>. If the <span>script execution
-  context</span> is a <code>Window</code> object, then that object's
-  <span>browsing context</span> is it. Otherwise, the <span>script
-  execution context</span> is associated explicitly with a
-  <span>browsing context</span> when it is created.</p>
+  <span>browsing context</span>, known as the <dfn>script browsing
+  context</dfn>. If the <span>script execution context</span> is a
+  <code>Window</code> object, then that object's <span>browsing
+  context</span> is it. Otherwise, the <span>script execution
+  context</span> is associated explicitly with a <span>browsing
+  context</span> when it is created.</p>
+
+  <hr>
 
   <p>It is said that <dfn>scripting is disabled</dfn> in a
   <span>script execution context</span> when any of the following
@@ -28098,7 +28152,7 @@
   </ul>
 
   <p>A node is said to be <dfn>without script</dfn> if either the
-  <code>Document</code> object of the node (the node itself, it is
+  <code>Document</code> object of the node (the node itself, if it is
   itself a <code>Document</code> object) does not have an associated
   <span>browsing context</span>, or <span>scripting is disabled</span>
   in that <span>browsing context</span>.</p>
@@ -28119,6 +28173,14 @@
   event handler attributes, event listeners, timeouts, etc, that were
   set by scripts in the document.</p>
 
+  <hr>
+
+  <p>Every script whose <span>script execution context</span> is a
+  <code>Window</code> object is also associated with a
+  <code>Document</code> object, known as its <dfn>script document
+  context</dfn>. It is used to resolve URLs. The document is assigned
+  when the script is created, as with the <span>script browsing
+  context</span>.</p>
 
 
   <h4>Security exceptions</h4>
@@ -28126,6 +28188,7 @@
   <p class="big-issue">Define <dfn>security exception</dfn>.</p>
 
 
+  <!-- SCRIPT EXEC -->
   <h4 id="javascript-protocol"><dfn title="javascript protocol">The <code title="">javascript:</code> protocol</dfn></h4>
 
   <!-- XXXURL merge into URLs section? (we could define 'fetch'/'download' while we're at it?) -->
@@ -28150,7 +28213,8 @@
   the <span>same origin</span> as the script given by that URI, the
   <span>script execution context</span> must be the
   <code>Window</code> object of the <span>browsing context</span>
-  being navigated.</p>
+  being navigated, and the <span>script document context</span> must
+  be that <span>active document</span>.</p>
 
   <!-- XXXURL JSURL issue -->
   <p>When a browsing context is <span
@@ -28159,8 +28223,7 @@
   <span>origin</span> that is <em>not</em> the <span title="same
   origin">same</span> as that of the script given by the URI, the
   <span>script execution context</span> must be an empty object, and
-  the <span>script execution context</span>'s associated
-  <span>browsing context</span> must be the <span>browsing
+  the <span>script browsing context</span> must be the <span>browsing
   context</span> being <span title="navigate">navigated</span>.</p>
 
   <!-- XXXURL JSURL issue -->
@@ -28253,6 +28316,7 @@
   title="">FunctionBody</code> production. <a
   href="#refsECMA262">[ECMA262]</a></p>
 
+  <!-- SCRIPT EXEC -->
   <p>When an event handler content attribute is set, its new value
   must be interpreted as the body of an anonymous function with a
   single argument called <code>event</code>, with the new function's
@@ -28275,7 +28339,9 @@
 
   <p>The <span>script execution context</span> of the event handler
   must be the <code>Window</code> object at the end of the scope
-  chain.</p>
+  chain. The <span>script document context</span> of the event handler
+  must be the <code>Document</code> object that owns the event handler
+  content attribute that was set.</p>
 
   <p class="big-issue">How do we allow non-JS event handlers?</p>
 
@@ -28956,15 +29022,10 @@
 
     <p><span>Navigate</span> the new browsing context to <var
     title="">url</var>, with <span>replacement enabled</span>, and
-    with the <span>browsing context</span> of the <code>Window</code>
-    object that is the <span>script execution context</span> of the
-    script that invoked the method as the <span>source browsing
+    with the <span>script browsing context</span> of the script that
+    invoked the method as the <span>source browsing
     context</span>.</p>
 
-    <p class="note">If the <span>script execution context</span> of a
-    script isn't a <code>Window</code> object, then it can't ever get
-    to a <code>Window</code> object to call this method.</p>
-
    </li>
 
    <li>
@@ -29073,24 +29134,22 @@
   cause the user agent to show a notification.</p>
 
   <p id="sandboxNotifications">If the method was invoked from a script
-  whose <span>script execution context</span>'s associated
-  <span>browsing context</span> has the <span>sandboxed annoyances
-  browsing context flag</span> set, then the notification must be
-  shown within that <span>browsing context</span>. The notification is
-  said to be a <dfn>sandboxed notification</dfn>.</p>
-
-  <p>Otherwise, if the <span>origin</span> of the <span>browsing
-  context</span> associated with the <span>script execution
-  context</span> of the script that invoked the method is <em>not</em>
-  flagged as being a <span>trusted notification source</span>, then
-  the notification should be rendered within the <span>top-level
-  browsing context</span> of the <span>browsing context</span>
-  associated with the <span>script execution context</span> of the
-  script that invoked the method. The notification is said to be a
-  <dfn>normal notification</dfn>. User agents should provide a way to
-  set the origin's <span>trusted notification source</span> flag from
-  the notification, so that the user can benefit from notifications
-  even when the user agent is not the active application.</p>
+  whose <span>script browsing context</span> has the <span>sandboxed
+  annoyances browsing context flag</span> set, then the notification
+  must be shown within that <span>browsing context</span>. The
+  notification is said to be a <dfn>sandboxed notification</dfn>.</p>
+
+  <p>Otherwise, if the <span>origin</span> of the <span>script
+  browsing context</span> of the script that invoked the method is
+  <em>not</em> flagged as being a <span>trusted notification
+  source</span>, then the notification should be rendered within the
+  <span>top-level browsing context</span> of the <span>script browsing
+  context</span> of the script that invoked the method. The
+  notification is said to be a <dfn>normal notification</dfn>. User
+  agents should provide a way to set the origin's <span>trusted
+  notification source</span> flag from the notification, so that the
+  user can benefit from notifications even when the user agent is not
+  the active application.</p>
 
   <p>Otherwise, the <span>origin</span> is flagged as a <span>trusted
   notification source</span>, and the notification should be shown
@@ -29134,17 +29193,16 @@
   <p>When a <span>normal notification</span> (but not a
   <span>sandboxed notification</span>) is shown, the user agent may
   bring the user's attention to the <span>top-level browsing
-  context</span> of the <span>browsing context</span> associated with
-  the <span>script execution context</span> of the script that invoked
-  the method, if that would be useful; but user agents should not use
-  system-wide notification mechanisms to do so.</p>
+  context</span> of the <span>script browsing context</span> of the
+  script that invoked the method, if that would be useful; but user
+  agents should not use system-wide notification mechanisms to do
+  so.</p>
 
   <p>When a <span>trusted notification</span> is shown, the user agent
   should bring the user's attention to the notification and the
-  <span>browsing context</span> associated with the <span>script
-  execution context</span> of the script that invoked the method, as
-  per the platform conventions for attracting the user's attention to
-  applications.</p>
+  <span>script browsing context</span> of the script that invoked the
+  method, as per the platform conventions for attracting the user's
+  attention to applications.</p>
 
   <div class="example">
 
@@ -29171,9 +29229,8 @@
    <li>The <span title="meta-application-name">application
    name</span>, if available, or else the <span
    title="dom-document-title">document title</span>, of the
-   <span>active document</span> of the <span>browsing context</span>
-   associated with the <span>script execution context</span> of the
-   script that invoked the method.</li>
+   <span>active document</span> of the <span>script browsing
+   context</span> of the script that invoked the method.</li>
 
    <li>An icon chosen from the <span title="external resource
    link">external resource links</span> of type <code
@@ -29216,9 +29273,8 @@
   <p>User agents should support user interaction with notifications,
   if and as appropriate given the platform conventions. If a user
   activates a notification, and the <var title="">onclick</var>
-  callback argument was present and is not null, then the
-  <span>browsing context</span> associated with the <span>script
-  execution context</span> of the function given by <var
+  callback argument was present and is not null, then the <span>script
+  browsing context</span> of the function given by <var
   title="">onclick</var> should be brought to the user's attention,
   and the <var title="">onclick</var> callback should then be
   invoked.</p>
@@ -31542,14 +31598,8 @@
   <p>Navigation for the <code
   title="dom-location-assign">assign()</code> and <code
   title="dom-location-replace">replace()</code> methods must be done
-  with the <span>browsing context</span> of the <code>Window</code>
-  object that is the <span>script execution context</span> of the
-  script that invoked the method as the <span>source browsing
-  context</span>.</p>
-
-  <p class="note">If the <span>script execution context</span> of a
-  script isn't a <code>Window</code> object, then it can't ever get to
-  a <code>Location</code> object to call these methods.</p>
+  with the <span>script browsing context</span> of the script that
+  invoked the method as the <span>source browsing context</span>.</p>
 
   <!-- XXXURL algorithms -->
   <p>Relative <var title="">url</var> arguments for <code
Comment 1 Henri Sivonen 2009-08-21 10:20:11 CEST
The original summary for this bug was longer than 255 characters, and so it was truncated when Bugzilla was upgraded. The original summary was:

Define 'URL' and 'valid URL'. Define 'script document context'. Introduce the term 'script browsing context' for the existing concept of 'browsing context associated with a script execution context' and use that term where appropriate. Define origin of onfoo='' scripts. Fix xref errors. Minor editorial fixes.