Skip to content

Commit

Permalink
[giow] (2) Fix setTimeout() and setInterval() to check whether the im…
Browse files Browse the repository at this point in the history
…teout 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

git-svn-id: http://svn.whatwg.org/webapps@4769 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 18, 2010
1 parent 6c68651 commit cf9f963
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 94 deletions.
65 changes: 36 additions & 29 deletions complete.html
Expand Up @@ -58834,7 +58834,15 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
<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>

Expand All @@ -58843,12 +58851,7 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
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>
Expand All @@ -58873,10 +58876,6 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
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>
Expand All @@ -58889,20 +58888,23 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
<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
Expand All @@ -58926,10 +58928,6 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>

</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>
Expand All @@ -58946,14 +58944,16 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>
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>
Expand Down Expand Up @@ -58998,8 +58998,15 @@ <h3 id=timers><span class=secno>7.2 </span>Timers</h3>

</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>
Expand Down
65 changes: 36 additions & 29 deletions index
Expand Up @@ -58756,7 +58756,15 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {
<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>

Expand All @@ -58765,12 +58773,7 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {
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>
Expand All @@ -58795,10 +58798,6 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {
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>
Expand All @@ -58811,20 +58810,23 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {
<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
Expand All @@ -58848,10 +58850,6 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {

</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>
Expand All @@ -58868,14 +58866,16 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {
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>
Expand Down Expand Up @@ -58920,8 +58920,15 @@ interface <dfn id=windowtimers>WindowTimers</dfn> {

</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>
Expand Down

0 comments on commit cf9f963

Please sign in to comment.