hixie: Fix setTimeout() and setInterval() to check whether the imteout has been cleared before running the task, not before queuing the task. This prevents tasks from being queued after the lists are emptied when shutting down. (whatwg r4769)

hixie: Fix setTimeout() and setInterval() to check whether the imteout
has been cleared before running the task, not before queuing the task.
This prevents tasks from being queued after the lists are emptied when
shutting down. (whatwg r4769)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3816&r2=1.3817&f=h
http://html5.org/tools/web-apps-tracker?from=4768&to=4769

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3816
retrieving revision 1.3817
diff -u -d -r1.3816 -r1.3817
--- Overview.html 18 Feb 2010 00:44:43 -0000 1.3816
+++ Overview.html 18 Feb 2010 01:57:14 -0000 1.3817
@@ -45692,7 +45692,15 @@
   <hr><p>The <dfn id="dom-windowtimers-settimeout" title="dom-windowtimers-setTimeout"><code>setTimeout()</code></dfn>
   method must run the following steps:
 
-  <ol><li><p><a href="#get-the-timed-task">Get the timed task</a>, and let <var title="">task</var> be the result.</li>
+  <ol><li><p>Let <var title="">handle</var> be a user-agent-defined integer
+   that is greater than zero that will identify the timeout to be set
+   by this call.</li>
+
+   <li><p>Add an entry to the <a href="#list-of-active-timeouts">list of active timeouts</a> for
+   <var title="">handle</var>.</li>
+
+   <li><p><a href="#get-the-timed-task">Get the timed task</a> <var title="">handle</var> in
+   the <a href="#list-of-active-timeouts">list of active timeouts</a>, and let <var title="">task</var> be the result.</li>
 
    <li><p><a href="#get-the-timeout">Get the timeout</a>, and let <var title="">timeout</var> be the result.</li>
 
@@ -45701,12 +45709,7 @@
    method, and <var title="">timeout</var> is less than 4, then
    increase <var title="">timeout</var> to 4.</li>
 
-   <li><p>Add an entry to the <a href="#list-of-active-timeouts">list of active timeouts</a>,
-   identified by a user-agent-defined integer that is greater than
-   zero.</li>
-
-   <li><p>Return the number identifying the newly added entry in the
-   <a href="#list-of-active-timeouts">list of active timeouts</a>, and then continue running
+   <li><p>Return <var title="">handle</var>, and then continue running
    this algorithm asynchronously.</li>
 
    <li>
@@ -45731,10 +45734,6 @@
    this one whose <var title="">timeout</var> is equal to or less than
    this one's have completed.</li>
 
-   <li><p>If the entry in the <a href="#list-of-active-timeouts">list of active timeouts</a>
-   that was added in the earlier step has been cleared, then abort
-   this algorithm.</li>
-
    <li><p><a href="#queue-a-task" title="queue a task">Queue</a> the <var title="">task</var> <a href="#concept-task" title="concept-task">task</a>.</li>
 
   </ol><p>The <dfn id="dom-windowtimers-cleartimeout" title="dom-windowtimers-clearTimeout"><code>clearTimeout()</code></dfn>
@@ -45747,7 +45746,15 @@
   <hr><p>The <dfn id="dom-windowtimers-setinterval" title="dom-windowtimers-setInterval"><code>setInterval()</code></dfn>
   method must run the following steps:
 
-  <ol><li><p><a href="#get-the-timed-task">Get the timed task</a>, and let <var title="">task</var> be the result.</li>
+  <ol><li><p>Let <var title="">handle</var> be a user-agent-defined integer
+   that is greater than zero that will identify the interval to be set
+   by this call.</li>
+
+   <li><p>Add an entry to the <a href="#list-of-active-intervals">list of active intervals</a> for
+   <var title="">handle</var>.</li>
+
+   <li><p><a href="#get-the-timed-task">Get the timed task</a> <var title="">handle</var> in
+   the <a href="#list-of-active-intervals">list of active intervals</a>, and let <var title="">task</var> be the result.</li>
 
    <li><p><a href="#get-the-timeout">Get the timeout</a>, and let <var title="">timeout</var> be the result.</li>
 
@@ -45755,12 +45762,7 @@
    increase <var title="">timeout</var> to 10.</li> <!-- (but see
    note below about IE) -->
 
-   <li><p>Add an entry to the <a href="#list-of-active-intervals">list of active intervals</a>,
-   identified by a user-agent-defined integer that is greater than
-   zero.</li>
-
-   <li><p>Return the number identifying the newly added entry in the
-   <a href="#list-of-active-intervals">list of active intervals</a>, and then continue running
+   <li><p>Return <var title="">handle</var>, and then continue running
    this algorithm asynchronously.</li>
 
    <!-- Note: IE doesn't actually run intervals with duration zero, it
@@ -45784,10 +45786,6 @@
 
    </li>
 
-   <li><p>If the entry in the <a href="#list-of-active-intervals">list of active intervals</a>
-   that was added in the earlier step has been cleared, then abort
-   this algorithm.</li>
-
    <li><p><a href="#queue-a-task" title="queue a task">Queue</a> the <var title="">task</var> <a href="#concept-task" title="concept-task">task</a>.</li>
 
    <li><p>Return to the step labeled <i>wait</i>.</li>
@@ -45804,14 +45802,16 @@
   algorithm is running is implemented (a <code><a href="#window">Window</a></code> or
   <code>WorkerUtils</code> object).</p>
 
-  <p>When the above methods are to <dfn id="get-the-timed-task">get the timed task</dfn>, they
-  must run the following steps:</p>
+  <p>When the above methods are invoked and try to <dfn id="get-the-timed-task">get the timed
+  task</dfn> <var title="">handle</var> in list <var title="">list</var>,
+  they must run the following steps:</p>
 
   <ol><li>
 
-    <p>If the first argument to the method is an object that has an
-    internal [[Call]] method, then return a <a href="#concept-task" title="concept-task">task</a> that calls that [[Call]] method
-    with as its arguments the third and subsequent arguments to the
+    <p>If the first argument to the invoked method is an object that
+    has an internal [[Call]] method, then return a <a href="#concept-task" title="concept-task">task</a> that checks if the entry for <var title="">handle</var> in <var title="">list</var> has been cleared,
+    and if it has not, calls the aforementioned [[Call]] method with
+    as its arguments the third and subsequent arguments to the invoked
     method (if any), and abort these steps.</p>
 
     <p>Otherwise, continue with the remaining steps.</p>
@@ -45856,8 +45856,15 @@
 
    </li>
 
-   <li><p>Return a <a href="#concept-task" title="concept-task">task</a> that <a href="#create-a-script" title="create a script">creates a script</a> using <var title="">script source</var> as the script source, <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="">character encoding</var> as the URL character encoding,
-   and <var title="">base URL</var> as the base URL.</li>
+   <li><p>Return a <a href="#concept-task" title="concept-task">task</a> that checks
+   if the entry for <var title="">handle</var> in <var title="">list</var>
+   has been cleared, and if it has not, <a href="#create-a-script" title="create a
+   script">creates a script</a> using <var title="">script
+   source</var> as the script source, <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="">character
+   encoding</var> as the URL character encoding, and <var title="">base URL</var> as the base URL.</li>
 
   </ol><p>When the above methods are to <dfn id="get-the-timeout">get the timeout</dfn>, they
   must run the following steps:</p>

Received on Thursday, 18 February 2010 01:58:04 UTC