HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2084Further work on the event loop front. (<script>, database API, remote events, and other bits and bobs)2008-08-19 09:00
@@ -16333,24 +16333,24 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
   referred to as <dfn>media data</dfn> in this section, since this
   section applies equally to <span title="media element">media
   elements</span> for audio or for video. The term <dfn>media
   resource</dfn> is used to refer to the complete set of media data,
   e.g. the complete video file, or complete audio file.</p>
 
   <p><span title="media element">Media elements</span> use two <span
   title="task queue">task queues</span>, the <dfn>media element event
   task source</dfn> for asynchronous events and callbacks, and the
   <dfn>media element new resource task source</dfn> for handling
-  implicit loads. Unless otherwise specified, all the tasks <span
-  title="queue a task">queued</span> in this section and its
-  subsections use the <span>media element event task
-  source</span>.</p>
+  implicit loads. Unless otherwise specified, the <span>task
+  source</span> for all the tasks <span title="queue a
+  task">queued</span> in this section and its subsections is the
+  <span>media element event task source</span>.</p>
 
 
 
   <h5>Error codes</h5>
 
   <p>All <span title="media element">media elements</span> have an
   associated error status, which records the last error the element
   encountered since the <code title="dom-media-load">load()</code>
   method was last invoked. The <dfn
   title="dom-media-error"><code>error</code></dfn> attribute, on
@@ -23928,21 +23928,21 @@ function AddCloud(data, x, y) { ... }</pre>
    <li>
 
     <p>If the element has a <code title="attr-script-src">src</code>
     attribute, then the specified resource must be <span
     title="fetch">fetched</span>.</p>
 
     <p>For historical reasons, if the <span>URL</span> is a <span
     title="javascript protocol"><code title="">javascript:</code>
     URL</span>, then the user agent must not, despite the requirements
     in the definition of the <span title="fetch">fetching</span>
-    algorithm, actually execute the given script, and instead the user
+    algorithm, actually execute the given script; instead the user
     agent must act as if it had received an empty HTTP 400
     response.</p>
 
     <p>Once the fetching process has completed, and the script has
     <dfn>completed loading</dfn>, the user agent will have to complete
     <span title="when a script completes loading">the steps described
     below</span>. (If the parser is still active at that time, those
     steps defer to the parser to handle the execution of pending
     scripts.)</p>
 
@@ -24028,23 +24028,23 @@ function AddCloud(data, x, y) { ... }</pre>
 
     </dl>
 
    </li>
 
   </ol>
 
   <p><dfn>When a script completes loading</dfn>: If the script's
   element was added to one of the lists mentioned above and the
   document is still being parsed, then the parser handles
-  it. Otherwise, the UA must run the following steps as soon as as any
-  other scripts that may be executing have finished executing:</p>
-  <!-- XXX queue -->
+  it. Otherwise, the UA must run the following steps as the <span
+  title="concept-task">task</span> that the <span>networking task
+  source</span> places on the <span>task queue</span>:</p>
 
   <dl class="switch">
 
    <dt>If the script's element was added to the <dfn>list of scripts
    that will execute when the document has finished parsing</dfn>:</dt>
 
    <dd>
 
     <ol>
 
@@ -28056,20 +28056,26 @@ menu li:not(:first-child)::before { content: ' | '; }</pre>
   title="dom-registrationMark"><code>registrationMark</code></dfn> DOM
   attribute must <span>reflect</span> the <code
   title="attr-registrationmark">registrationmark</code> content
   attribute.</p>
 
 
 
   <h4>Processing model</h4>
   <!-- ua side -->
 
+  <p>The <span>event source</span> for all <span
+  title="concept-task">tasks</span> <span title="queue a
+  task">queued</span> by algorithms in this section and its
+  subsections is the <dfn>template event source</dfn>.</p>
+
+
   <h5>The <code title="dom-originalContent">originalContent</code> DOM
   attribute</h5>
 
   <p>The <dfn
   title="dom-originalContent"><code>originalContent</code></dfn> is
   set to a <code>DocumentFragment</code> to hold the original children
   of an element that has been replaced by content generated for a data
   template. Initially, it must be null. Its value is set when the
   <code title="attr-template">template</code> attribute is set to a
   usable value, and is unset when the attribute is removed.</p>
@@ -28099,24 +28105,22 @@ menu li:not(:first-child)::before { content: ' | '; }</pre>
 
   <p>If the resource specified by the <code
   title="attr-template">template</code> attribute is not the current
   document<!-- XXX xref --> and does not have an XML MIME type, or if
   an XML parse error is found while parsing the resource, then the
   resource cannot be successfully parsed, and the user agent must jump
   to the <span title="datatemplate-template-failed">failed to
   parse</span> steps below.</p>
 
   <p>Once the DOM in question has been parsed, assuming that it indeed
-  can be parsed and does so successfully, the user agent must wait for
-  no scripts to be executing, and as soon as that opportunity
-  arises<!-- XXX queue; xref to a strict definition of this -->, run the
-  following algorithm:</p>
+  can be parsed and does so successfully, the user agent must
+  <span>queue a task</span> to run the following algorithm:</p>
 
   <ol>
    <!-- precondition: the originalContent is null and the element
         contains its original content. -->
 
    <li>
 
     <p>If the <code title="attr-template">template</code> attribute's
     value has a fragment identifier, and, in the DOM in question, it
     identifies<!-- XXX how --> a <code>datatemplate</code> element,
@@ -28228,24 +28232,22 @@ menu li:not(:first-child)::before { content: ' | '; }</pre>
 
   <p>If the resource specified by the <code
   title="attr-ref">ref</code> attribute is not the current
   document<!-- XXX xref --> and does not have an XML MIME type, or if
   an XML parse error is found while parsing the resource, then the
   resource cannot be successfully parsed, and the user agent must jump
   to the <span title="datatemplate-ref-failed">failed to parse</span>
   steps below.</p>
 
   <p>Once the DOM in question has been parsed, assuming that it indeed
-  can be parsed and does so successfully, the user agent must wait for
-  no scripts to be executing, and as soon as that opportunity
-  arises<!-- XXX; queue xref to a strict definition of this -->, run
-  the following algorithm:</p>
+  can be parsed and does so successfully, the user agent must
+  <span>queue a task</span> to run the following algorithm:</p>
 
   <ol>
 
    <li>
 
     <p>If the <code title="attr-ref">ref</code> attribute value does
     not have a fragment identifier, then set the <code
     title="dom-refNode">refNode</code> DOM attribute to the
     <code>Document</code> node of that DOM.</p>
 
@@ -35025,34 +35027,32 @@ user reload must be equivalent to .reload()
   <p>Multiple browsing contexts must be able to access the local
   storage areas simultaneously in a predictable manner. Scripts must
   not be able to detect any concurrent script execution.</p>
 
   <p>This is required to guarantee that the <code
   title="dom-Storage-length">length</code> attribute of a
   <code>Storage</code> object never changes while a script is
   executing, other than in a way that is predictable by the script
   itself.</p>
 
-  <p>There are various ways of implementing this requirement. One is
-  that if a script running in one browsing context accesses a local
-  storage area, the UA blocks scripts in other browsing contexts when
-  they try to access the local storage area for the <span>same
-  origin</span> until the first script has executed to completion <!--
-  xxx queue -->. (Similarly, when a script in one browsing context
-  accesses its session storage area, any scripts that have the same
-  top level browsing context and the <span>same origin</span> would
-  block when accessing their session storage area until the first
-  script has executed to completion.) Another (potentially more
-  efficient but probably more complex) implementation strategy is to
-  use optimistic transactional script execution. This specification
-  does not require any particular implementation strategy, so long as
-  the requirement above is met.</p>
+  <p class="note">There are various ways of implementing this
+  requirement. One is to just have one <span>event loop</span> for all
+  <span title="browsing context">browsing contexts</span>. Another is
+  that if a script running in one browsing context accesses a storage
+  area, the user agent blocks scripts in other browsing contexts when
+  they try to access the same storage area until the <span>event
+  loop</span> running the first script has completed running the task
+  that started that script. Another (potentially more efficient but
+  certainly more complex) implementation strategy is to use optimistic
+  transactional script execution. This specification does not require
+  any particular implementation strategy, so long as the requirement
+  above is met.</p>
 
 
 
 
   <h4 id="sql">Database storage</h4>
 
   <!-- Feature requests for future versions (v2):
         * deleting databases
         * determining how much storage room is left
         * handling the database getting corrupted
@@ -35487,23 +35487,24 @@ interface <dfn>SQLStatementErrorCallback</dfn> {
 
    <li><p>If an error occurred in the opening of the transaction, jump
    to the last step.</p></li>
 
    <li><p>If a <i>preflight operation</i> was defined for this
    instance of the transaction steps, run that. If it fails, then jump
    to the last step. (This is basically a hook for the <code
    title="dom-database-changeVersion">changeVersion()</code>
    method.)</p></li>
 
-   <li><p><!-- XXX queue --> Invoke the <i>transaction callback</i>
-   with the aforementioned <code>SQLTransaction</code> object as its
-   only argument.</p></li>
+   <li><p><span>Queue a task</span> to invoke the <i>transaction
+   callback</i> with the aforementioned <code>SQLTransaction</code>
+   object as its only argument, and wait for that task to be
+   run.</p></li>
 
    <li><p>If the callback couldn't be called (e.g. it was null), or if
    the callback was invoked and raised an exception, jump to the last
    step.</p></li>
 <!--
    <li><p>If the callback could be called and returned false, let
    <i>callback-canceled</i> be true. Otherwise, let it be
    false.</p></li>
 -->
    <li><p>While there are any statements queued up in the transaction,
@@ -35519,44 +35520,46 @@ interface <dfn>SQLStatementErrorCallback</dfn> {
 
      <li><p>Execute the statement in the context of the transaction.
      <a href="#refsSQL">[SQL]</a></p>
 
      <li><p>If the statement failed, jump to the "in case of error"
      steps below.</p></li>
 
      <li><p>Create a <code>SQLResultSet</code> object that represents
      the result of the statement.</p></li>
 
-     <li><p><!-- XXX queue --> If the statement has a result set
-     callback, invoke it with the <code>SQLTransaction</code> object
-     as its first argument and the new <code>SQLResultSet</code>
-     object as its second argument.</p></li>
+     <li><p>If the statement has a result set callback, <span>queue a
+     task</span> to invoke it with the <code>SQLTransaction</code>
+     object as its first argument and the new
+     <code>SQLResultSet</code> object as its second argument, and wait
+     for that task to be run.</p></li>
 
      <li><p>If the callback was invoked and raised an exception, jump
      to the last step in the overall steps.</p></li>
 
      <li><p>Move on to the next statement, if any, or onto the next
      overall step otherwise.</p></li>
 
     </ol>
 
     <p>In case of error (or more specifically, if the above substeps
     say to jump to the "in case of error" steps), run the following
     substeps:</p>
 
     <ol>
 
      <li><p>If the statement had an associated error callback, then
-     invoke that error callback with the <code>SQLTransaction</code>
-     object and a newly constructed <code>SQLError</code> object that
-     represents the error that caused these substeps to be run as the
-     two arguments, respectively.</p></li>
+     <span>queue a task</span> to invoke that error callback with the
+     <code>SQLTransaction</code> object and a newly constructed
+     <code>SQLError</code> object that represents the error that
+     caused these substeps to be run as the two arguments,
+     respectively, and wait for the task to be run.</p></li>
 
      <li><p>If the error callback returns false, then move on to the
      next statement, if any, or onto the next overall step
      otherwise.</p></li>
 
      <li><p>Otherwise, the error callback did not return false, or
      there was no error callback. Jump to the last step in the overall
      steps.</p></li>
 
     </ol>
@@ -35568,29 +35571,31 @@ interface <dfn>SQLStatementErrorCallback</dfn> {
    to the last step. <!--The operation, if any, might depend
    <i>callback-canceled</i>.--> (This is basically a hook for the
    <code title="dom-database-changeVersion">changeVersion()</code>
    method.)</p></li>
 
    <li><p>Commit the transaction.</p></li>
 
    <li><p>If an error occurred in the committing of the transaction,
    jump to the last step.</p></li>
 
-   <li><p>Invoke the <i>success callback</i>.</p></li>
+   <li><p><span>Queue a task</span> to invoke the <i>success
+   callback</i>.</p></li>
 
    <li><p>End these steps. The next step is only used when something
    goes wrong.</p></li>
 
-   <li><p>Call the <i>error callback</i> with a newly constructed
-   <code>SQLError</code> object that represents the last error to have
-   occurred in this transaction. Rollback the transaction. Any
-   still-pending statements in the transaction are discarded.</p></li>
+   <li><p><span>Queue a task</span> to invoke the <i>error
+   callback</i> with a newly constructed <code>SQLError</code> object
+   that represents the last error to have occurred in this
+   transaction. Rollback the transaction. Any still-pending statements
+   in the transaction are discarded.</p></li>
 
   </ol>
 
 
 
   <h4>Disk space</h4>
 
   <p>User agents should limit the total amount of space allowed for
   storage areas and databases.</p>
 
@@ -40186,25 +40191,42 @@ XXX Once we resolve the style="" issue, address these:
   URL fails to resolve, the user agent does nothing.</p>
 
 
   <h4>Connecting to an event stream</h4>
 
   <p>Each object implementing the <code>EventTarget</code> and
   <code>RemoteEventTarget</code> interfaces has a <dfn
   title="concept-eventsource-list">list of event sources</dfn> that
   are registered for that object.</p>
 
-  <p>When a new URI is added to this list, the user agent should, as
-  soon as all currently executing scripts (if any) have finished
-  executing<!-- XXX queue -->, and if the specified URL isn't removed
-  from the list before they do so, <span>fetch</span> the resource
-  identified by that URL.</p>
+  <p>When a new <span>absolute URL</span> is added to this list, the
+  user agent should <span>queue a task</span> to run the following
+  steps with the new <span>absolute URL</span>:</p>
+
+  <ol>
+
+   <li><p>If the entry for the new <span>absolute URL</span> has been
+   removed from the list, then abort these steps.</p></li>
+
+   <li>
+
+    <p><span>Fetch</span> the resource identified by that
+    <span>absolute URL</span>.</p>
+
+    <p>As data is received, the <span
+    title="concept-task">tasks</span> queued by the <span>networking
+    event source</span> to handle the data must consist of following
+    the rules given in the following sections.</p>
+
+   </li>
+
+  </ol>
 
   <p>When an event source is removed from the list of event sources
   for an object, if that resource is still being fetched, then the
   relevant connection must be closed.</p>
 
   <p>Since connections established to remote servers for such
   resources are expected to be long-lived, UAs should ensure that
   appropriate buffering is used. In particular, while line buffering
   may be safe if lines are defined to end with a single U+000A LINE
   FEED character, block buffering or line buffering with different
@@ -40520,23 +40542,25 @@ XXX Once we resolve the style="" issue, address these:
    source.</p></li>
    
    <li><p>If the <var title="">event name</var> buffer has a value
    other than the empty string, change the type of the newly created
    event to equal the value of the <var title="">event name</var>
    buffer.</p></li>
 
    <li><p>Set the <var title="">data</var> buffer and the <var
    title="">event name</var> buffer to the empty string.</p></li>
 
-   <li><p>Dispatch the newly created event at the
-   <code>RemoteEventTarget</code> object to which the event stream is
-   registered.</p></li>
+   <li><p><span>Queue a task</span> to dispatch the newly created
+   event at the <code>RemoteEventTarget</code> object to which the
+   event stream is registered. The <span>task source</span> for this
+   <span title="concept-task">task</span> is the <dfn>remote event
+   task source</dfn>.</p></li>
 
   </ol>
 
   <p class="note">If an event doesn't have an "id" field, but an
   earlier event did set the event source's <span>last event ID
   string</span>, then the event's <code
   title="dom-MessageEvent-lastEventId">lastEventId</code> field will
   be set to the value of whatever the last seen "id" field was.</p>
 
 

|