[html5] r4769 - [giow] (2) Fix setTimeout() and setInterval() to check whether the imteout has b [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Feb 17 17:56:41 PST 2010


Author: ianh
Date: 2010-02-17 17:56:39 -0800 (Wed, 17 Feb 2010)
New Revision: 4769

Modified:
   complete.html
   index
   source
Log:
[giow] (2) 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.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=8969

Modified: complete.html
===================================================================
--- complete.html	2010-02-18 00:40:38 UTC (rev 4768)
+++ complete.html	2010-02-18 01:56:39 UTC (rev 4769)
@@ -58834,8 +58834,16 @@
   <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>
 
    <li><p>If the currently running <a href=#concept-task title=concept-task>task</a> is a task that was created by the
@@ -58843,12 +58851,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>
@@ -58873,10 +58876,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>
@@ -58889,20 +58888,23 @@
   <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>
 
    <li><p>If <var title="">timeout</var> is less than 10, then
    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
@@ -58926,10 +58928,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>
@@ -58946,14 +58944,16 @@
   algorithm is running is implemented (a <code><a href=#window>Window</a></code> or
   <code><a href=#workerutils>WorkerUtils</a></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>
@@ -58998,8 +58998,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>

Modified: index
===================================================================
--- index	2010-02-18 00:40:38 UTC (rev 4768)
+++ index	2010-02-18 01:56:39 UTC (rev 4769)
@@ -58756,8 +58756,16 @@
   <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>
 
    <li><p>If the currently running <a href=#concept-task title=concept-task>task</a> is a task that was created by the
@@ -58765,12 +58773,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>
@@ -58795,10 +58798,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>
@@ -58811,20 +58810,23 @@
   <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>
 
    <li><p>If <var title="">timeout</var> is less than 10, then
    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
@@ -58848,10 +58850,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>
@@ -58868,14 +58866,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>
@@ -58920,8 +58920,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>

Modified: source
===================================================================
--- source	2010-02-18 00:40:38 UTC (rev 4768)
+++ source	2010-02-18 01:56:39 UTC (rev 4769)
@@ -66469,7 +66469,15 @@
 
   <ol>
 
-   <li><p><span>Get the timed task</span>, and let <var
+   <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.</p></li>
+
+   <li><p>Add an entry to the <span>list of active timeouts</span> for
+   <var title="">handle</var>.</p></li>
+
+   <li><p><span>Get the timed task</span> <var title="">handle</var> in
+   the <span>list of active timeouts</span>, and let <var
    title="">task</var> be the result.</p></li>
 
    <li><p><span>Get the timeout</span>, and let <var
@@ -66481,12 +66489,7 @@
    method, and <var title="">timeout</var> is less than 4, then
    increase <var title="">timeout</var> to 4.</p></li>
 
-   <li><p>Add an entry to the <span>list of active timeouts</span>,
-   identified by a user-agent-defined integer that is greater than
-   zero.</p></li>
-
-   <li><p>Return the number identifying the newly added entry in the
-   <span>list of active timeouts</span>, and then continue running
+   <li><p>Return <var title="">handle</var>, and then continue running
    this algorithm asynchronously.</p></li>
 
    <li>
@@ -66512,10 +66515,6 @@
    this one whose <var title="">timeout</var> is equal to or less than
    this one's have completed.</p></li>
 
-   <li><p>If the entry in the <span>list of active timeouts</span>
-   that was added in the earlier step has been cleared, then abort
-   this algorithm.</p></li>
-
    <li><p><span title="queue a task">Queue</span> the <var
    title="">task</var> <span
    title="concept-task">task</span>.</p></li>
@@ -66538,7 +66537,15 @@
 
   <ol>
 
-   <li><p><span>Get the timed task</span>, and let <var
+   <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.</p></li>
+
+   <li><p>Add an entry to the <span>list of active intervals</span> for
+   <var title="">handle</var>.</p></li>
+
+   <li><p><span>Get the timed task</span> <var title="">handle</var> in
+   the <span>list of active intervals</span>, and let <var
    title="">task</var> be the result.</p></li>
 
    <li><p><span>Get the timeout</span>, and let <var
@@ -66548,12 +66555,7 @@
    increase <var title="">timeout</var> to 10.</p></li> <!-- (but see
    note below about IE) -->
 
-   <li><p>Add an entry to the <span>list of active intervals</span>,
-   identified by a user-agent-defined integer that is greater than
-   zero.</p></li>
-
-   <li><p>Return the number identifying the newly added entry in the
-   <span>list of active intervals</span>, and then continue running
+   <li><p>Return <var title="">handle</var>, and then continue running
    this algorithm asynchronously.</p></li>
 
    <!-- Note: IE doesn't actually run intervals with duration zero, it
@@ -66578,10 +66580,6 @@
 
    </li>
 
-   <li><p>If the entry in the <span>list of active intervals</span>
-   that was added in the earlier step has been cleared, then abort
-   this algorithm.</p></li>
-
    <li><p><span title="queue a task">Queue</span> the <var
    title="">task</var> <span
    title="concept-task">task</span>.</p></li>
@@ -66605,17 +66603,20 @@
   algorithm is running is implemented (a <code>Window</code> or
   <code>WorkerUtils</code> object).</p>
 
-  <p>When the above methods are to <dfn>get the timed task</dfn>, they
-  must run the following steps:</p>
+  <p>When the above methods are invoked and try to <dfn>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 <span
-    title="concept-task">task</span> 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 <span
+    title="concept-task">task</span> 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>
@@ -66662,14 +66663,16 @@
 
    </li>
 
-   <li><p>Return a <span title="concept-task">task</span> that <span
-   title="create a script">creates a script</span> 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.</p></li>
+   <li><p>Return a <span title="concept-task">task</span> that checks
+   if the entry for <var title="">handle</var> in <var title="">list</var>
+   has been cleared, and if it has not, <span title="create a
+   script">creates a script</span> 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.</p></li>
 
   </ol>
 




More information about the Commit-Watchers mailing list