Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (2) Make timeouts and intervals survive a history traversal th…
…at unloads the document, but only if the document isn't actually disacarded.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=8970

git-svn-id: http://svn.whatwg.org/webapps@4770 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 18, 2010
1 parent cf9f963 commit 39c5826
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 74 deletions.
55 changes: 31 additions & 24 deletions complete.html
Expand Up @@ -52849,7 +52849,10 @@ <h4 id=garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>G
<code>Document</code></dfn>, the user agent must run the following
steps:</p>

<ol><li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
<ol><li><p>Set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
the <code><a href=#document>Document</a></code> that are defined by this specification or
any other relevant specifications.</li>

Expand Down Expand Up @@ -55343,8 +55346,8 @@ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</

<div class=impl>

<p>A <code><a href=#document>Document</a></code> has a <var title="">salvageable</var>
state, which is initially true.</p>
<p>A <code><a href=#document>Document</a></code> has a <var title=concept-document-salvageable>salvageable</var> state, which
is initially true.</p>

<p>When a user agent is to <dfn id=prompt-to-unload-a-document>prompt to unload a document</dfn>,
it must run the following steps.</p>
Expand All @@ -55359,7 +55362,8 @@ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</
<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier
<i>dispatch</i> step, then set the <code><a href=#document>Document</a></code>'s <var title="">salvageable</var> state to false.</li>
<i>dispatch</i> step, then set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li>

Expand Down Expand Up @@ -55405,10 +55409,10 @@ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</
document to be unloaded">refused to allow <em>this</em> document
to be unloaded</a>; abort these steps.</p>

<li><p>If <var title="">salvageable</var> state of the
<a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
<var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
false also.</li>
<li><p>If <var title=concept-document-salvageable>salvageable</var> state of
the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
<em>this</em> document to false also.</li>

</ol></li>

Expand All @@ -55428,7 +55432,8 @@ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</

<li><p>If any event listeners were triggered by the earlier
<i>unload event</i> step, then set the <code><a href=#document>Document</a></code>
object's <var title="">salvageable</var> state to false.</li>
object's <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
<code><a href=#document>Document</a></code> that are defined by this specification or any
Expand All @@ -55454,39 +55459,41 @@ <h4 id=unloading-documents><span class=secno>6.5.10 </span>Unloading documents</
<var title="">b</var> with the <var title="">recycle</var>
parameter set to false.</li>

<li><p>If <var title="">salvageable</var> state of the
<a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
<var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
false also.</li>
<li><p>If <var title=concept-document-salvageable>salvageable</var> state of
the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
<em>this</em> document to false also.</li>

</ol></li>

<li><p>If <var title="">salvageable</var> and <var title="">recycle</var> are both false, then the
<li><p>If <var title=concept-document-salvageable>salvageable</var> and <var title="">recycle</var> are both false, then the
<code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> must <a href=#discard-a-document title="discard a document">discard the
<code>Document</code></a>.</li>

</ol><p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document
cleanup steps</dfn>. Other specifications can define more.</p>

<ol><li><p>Empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s
<a href=#list-of-active-timeouts>list of active timeouts</a> and its <a href=#list-of-active-intervals>list of active
intervals</a>.</li> <!-- XXX Should this affect <var
title="">salvageable</var>? Should it happen at all? -->

<li><p>If there are any outstanding transactions that have
<ol><li><p>If there are any outstanding transactions that have
callbacks that involve <a href=#concept-script title=concept-script>scripts</a>
whose <a href="#script's-global-object" title="script's global object">global object</a> is
the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object, roll them
back (without invoking any of the callbacks) and set <var title="">salvageable</var> to false.
<a href=#refsWEBSQL>[WEBSQL]</a>
</li>
back (without invoking any of the callbacks) and set the
<code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false. <a href=#refsWEBSQL>[WEBSQL]</a> </li>

<li><p><a href=#close-the-web-socket-connection>Close the Web Socket connection</a> of any
<code><a href=#websocket>WebSocket</a></code> objects that were created by the <code title=dom-WebSocket><a href=#dom-websocket>WebSocket()</a></code> constructor visible on the
<code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object. If this
affected any <code><a href=#websocket>WebSocket</a></code> objects, set <var title="">salvageable</var> to false.
affected any <code><a href=#websocket>WebSocket</a></code> objects, the set
<code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.
</li>

<li><p>If the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state is
false, empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s
<a href=#list-of-active-timeouts>list of active timeouts</a> and its <a href=#list-of-active-intervals>list of active
intervals</a>.</li>

</ol><h5 id=event-definition><span class=secno>6.5.10.1 </span>Event definition</h5>

</div>
Expand Down
55 changes: 31 additions & 24 deletions index
Expand Up @@ -52751,7 +52751,10 @@ interface <dfn id=window>Window</dfn> {
<code>Document</code></dfn>, the user agent must run the following
steps:</p>

<ol><li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
<ol><li><p>Set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
the <code><a href=#document>Document</a></code> that are defined by this specification or
any other relevant specifications.</li>

Expand Down Expand Up @@ -55245,8 +55248,8 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

<div class=impl>

<p>A <code><a href=#document>Document</a></code> has a <var title="">salvageable</var>
state, which is initially true.</p>
<p>A <code><a href=#document>Document</a></code> has a <var title=concept-document-salvageable>salvageable</var> state, which
is initially true.</p>

<p>When a user agent is to <dfn id=prompt-to-unload-a-document>prompt to unload a document</dfn>,
it must run the following steps.</p>
Expand All @@ -55261,7 +55264,8 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier
<i>dispatch</i> step, then set the <code><a href=#document>Document</a></code>'s <var title="">salvageable</var> state to false.</li>
<i>dispatch</i> step, then set the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li>

Expand Down Expand Up @@ -55307,10 +55311,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
document to be unloaded">refused to allow <em>this</em> document
to be unloaded</a>; abort these steps.</p>

<li><p>If <var title="">salvageable</var> state of the
<a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
<var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
false also.</li>
<li><p>If <var title=concept-document-salvageable>salvageable</var> state of
the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
<em>this</em> document to false also.</li>

</ol></li>

Expand All @@ -55330,7 +55334,8 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

<li><p>If any event listeners were triggered by the earlier
<i>unload event</i> step, then set the <code><a href=#document>Document</a></code>
object's <var title="">salvageable</var> state to false.</li>
object's <var title=concept-document-salvageable>salvageable</var> state to
false.</li>

<li><p>Run any <a href=#unloading-document-cleanup-steps>unloading document cleanup steps</a> for
<code><a href=#document>Document</a></code> that are defined by this specification or any
Expand All @@ -55356,42 +55361,44 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<var title="">b</var> with the <var title="">recycle</var>
parameter set to false.</li>

<li><p>If <var title="">salvageable</var> state of the
<a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
<var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
false also.</li>
<li><p>If <var title=concept-document-salvageable>salvageable</var> state of
the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
context</a> <var title="">b</var> is false, then set the <var title=concept-document-salvageable>salvageable</var> state of
<em>this</em> document to false also.</li>

</ol></li>

<li><p>If <var title="">salvageable</var> and <var title="">recycle</var> are both false, then the
<li><p>If <var title=concept-document-salvageable>salvageable</var> and <var title="">recycle</var> are both false, then the
<code><a href=#document>Document</a></code>'s <a href=#browsing-context>browsing context</a> must <a href=#discard-a-document title="discard a document">discard the
<code>Document</code></a>.</li>

</ol><p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document
cleanup steps</dfn>. Other specifications can define more.</p>

<ol><li><p>Empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s
<a href=#list-of-active-timeouts>list of active timeouts</a> and its <a href=#list-of-active-intervals>list of active
intervals</a>.</li> <!-- XXX Should this affect <var
title="">salvageable</var>? Should it happen at all? -->

<li><p>If there are any outstanding transactions that have
<ol><li><p>If there are any outstanding transactions that have
callbacks that involve <a href=#concept-script title=concept-script>scripts</a>
whose <a href="#script's-global-object" title="script's global object">global object</a> is
the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object, roll them
back (without invoking any of the callbacks) and set <var title="">salvageable</var> to false.
<a href=#refsWEBSQL>[WEBSQL]</a>
</li>
back (without invoking any of the callbacks) and set the
<code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false. <a href=#refsWEBSQL>[WEBSQL]</a> </li>

<li><p><span>Close the Web Socket connection</span> of any
<code>WebSocket</code> objects that were created by the <code title=dom-WebSocket>WebSocket()</code> constructor visible on the
<code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object. If this
affected any <code>WebSocket</code> objects, set <var title="">salvageable</var> to false.
affected any <code>WebSocket</code> objects, the set
<code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state to
false.

<a href=#refsWEBSOCKET>[WEBSOCKET]</a>

</li>

<li><p>If the <code><a href=#document>Document</a></code>'s <var title=concept-document-salvageable>salvageable</var> state is
false, empty the <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code>'s
<a href=#list-of-active-timeouts>list of active timeouts</a> and its <a href=#list-of-active-intervals>list of active
intervals</a>.</li>

</ol><h5 id=event-definition><span class=secno>6.5.10.1 </span>Event definition</h5>

</div>
Expand Down
66 changes: 40 additions & 26 deletions source
Expand Up @@ -59487,6 +59487,10 @@ interface <dfn>Window</dfn> {

<ol>

<li><p>Set the <code>Document</code>'s <var
title="concept-document-salvageable">salvageable</var> state to
false.</p></li>

<li><p>Run any <span>unloading document cleanup steps</span> for
the <code>Document</code> that are defined by this specification or
any other relevant specifications.</p></li>
Expand Down Expand Up @@ -62349,8 +62353,9 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<div class="impl">

<p>A <code>Document</code> has a <var title="">salvageable</var>
state, which is initially true.</p>
<p>A <code>Document</code> has a <var
title="concept-document-salvageable">salvageable</var> state, which
is initially true.</p>

<p>When a user agent is to <dfn>prompt to unload a document</dfn>,
it must run the following steps.</p>
Expand All @@ -62369,7 +62374,8 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<li><p>If any event listeners were triggered by the earlier
<i>dispatch</i> step, then set the <code>Document</code>'s <var
title="">salvageable</var> state to false.</p></li>
title="concept-document-salvageable">salvageable</var> state to
false.</p></li>

<li>

Expand Down Expand Up @@ -62419,11 +62425,12 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
document to be unloaded">refused to allow <em>this</em> document
to be unloaded</span>; abort these steps.</p>

<li><p>If <var title="">salvageable</var> state of the
<span>active document</span> of the <span>browsing context</span>
<var title="">b</var> is false, then set the <var
title="">salvageable</var> state of <em>this</em> document to
false also.</p></li>
<li><p>If <var
title="concept-document-salvageable">salvageable</var> state of
the <span>active document</span> of the <span>browsing
context</span> <var title="">b</var> is false, then set the <var
title="concept-document-salvageable">salvageable</var> state of
<em>this</em> document to false also.</p></li>

</ol>

Expand Down Expand Up @@ -62452,7 +62459,9 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<li><p>If any event listeners were triggered by the earlier
<i>unload event</i> step, then set the <code>Document</code>
object's <var title="">salvageable</var> state to false.</p></li>
object's <var
title="concept-document-salvageable">salvageable</var> state to
false.</p></li>

<li><p>Run any <span>unloading document cleanup steps</span> for
<code>Document</code> that are defined by this specification or any
Expand Down Expand Up @@ -62480,17 +62489,19 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<var title="">b</var> with the <var title="">recycle</var>
parameter set to false.</p></li>

<li><p>If <var title="">salvageable</var> state of the
<span>active document</span> of the <span>browsing context</span>
<var title="">b</var> is false, then set the <var
title="">salvageable</var> state of <em>this</em> document to
false also.</p></li>
<li><p>If <var
title="concept-document-salvageable">salvageable</var> state of
the <span>active document</span> of the <span>browsing
context</span> <var title="">b</var> is false, then set the <var
title="concept-document-salvageable">salvageable</var> state of
<em>this</em> document to false also.</p></li>

</ol>

</li>

<li><p>If <var title="">salvageable</var> and <var
<li><p>If <var
title="concept-document-salvageable">salvageable</var> and <var
title="">recycle</var> are both false, then the
<code>Document</code>'s <span>browsing context</span> must <span
title="discard a document">discard the
Expand All @@ -62503,31 +62514,34 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<ol>

<li><p>Empty the <code>Document</code>'s <code>Window</code>'s
<span>list of active timeouts</span> and its <span>list of active
intervals</span>.</p></li> <!-- XXX Should this affect <var
title="">salvageable</var>? Should it happen at all? -->

<li><p>If there are any outstanding transactions that have
callbacks that involve <span title="concept-script">scripts</span>
whose <span title="script's global object">global object</span> is
the <code>Document</code>'s <code>Window</code> object, roll them
back (without invoking any of the callbacks) and set <var
title="">salvageable</var> to false.
<a href="#refsWEBSQL">[WEBSQL]</a>
</p></li>
back (without invoking any of the callbacks) and set the
<code>Document</code>'s <var
title="concept-document-salvageable">salvageable</var> state to
false. <a href="#refsWEBSQL">[WEBSQL]</a> </p></li>

<li><p><span>Close the Web Socket connection</span> of any
<code>WebSocket</code> objects that were created by the <code
title="dom-WebSocket">WebSocket()</code> constructor visible on the
<code>Document</code>'s <code>Window</code> object. If this
affected any <code>WebSocket</code> objects, set <var
title="">salvageable</var> to false.
affected any <code>WebSocket</code> objects, the set
<code>Document</code>'s <var
title="concept-document-salvageable">salvageable</var> state to
false.
<!--END complete-->
<a href="#refsWEBSOCKET">[WEBSOCKET]</a>
<!--START complete-->
</p></li>

<li><p>If the <code>Document</code>'s <var
title="concept-document-salvageable">salvageable</var> state is
false, empty the <code>Document</code>'s <code>Window</code>'s
<span>list of active timeouts</span> and its <span>list of active
intervals</span>.</p></li>

</ol>


Expand Down

0 comments on commit 39c5826

Please sign in to comment.