Skip to content

Commit

Permalink
[] (0) Call beforeunload earlier in the process.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@4108 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 12, 2009
1 parent 41c49ea commit bb4cd28
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 61 deletions.
52 changes: 32 additions & 20 deletions complete.html
Expand Up @@ -9743,11 +9743,14 @@ <h4 id=opening-the-input-stream><span class=secno>3.5.1 </span>Opening the input

</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
unload</a> the <code>Document</code> object. If the user
<a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
these steps must be aborted.</li>

<li><p><a href=#unload-a-document title="unload a document">Unload</a> the
<code>Document</code> object, with the <var title="">recycle</var>
parameter set to true. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the
document to be unloaded</a>, then these steps must be
aborted.</li>
parameter set to true.</li>

<li><p>If the document has an <a href=#active-parser>active parser</a>, then
abort that parser, and throw away any pending content in the
Expand Down Expand Up @@ -55123,6 +55126,17 @@ <h4 id=navigating-across-documents><span class=secno>6.11.1 </span>Navigating ac
<li><p>Cancel <em>any</em> preexisting attempt to navigate the
<a href=#browsing-context>browsing context</a>.</li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
unload</a> the <code>Document</code> object. If the user
<a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
these steps must be aborted.</li>

<li>

<p>If the new resource is to be handled by displaying some sort of
Expand All @@ -55138,12 +55152,6 @@ <h4 id=navigating-across-documents><span class=secno>6.11.1 </span>Navigating ac

</li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</li>

<li>

<p>If the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, then
Expand Down Expand Up @@ -55882,22 +55890,21 @@ <h4 id=unloading-documents><span class=secno>6.11.10 </span>Unloading documents<

<div class=impl>

<p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>
<p>A <code>Document</code> has a <var title="">salvageable</var>
state, which is initially true.</p>

<ol><li><p>Set <var title="">salvageable</var> to true.</li>
<hr><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>

<li><p>Let <var title="">event</var> be a new
<ol><li><p>Let <var title="">event</var> be a new
<code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> event object with the name <code title=event-beforeunload>beforeunload</code>, with no namespace,
which does not bubble but is cancelable.</li>

<li><p>Dispatch <var title="">event</var> at the
<code>Document</code>'s <code><a href=#window>Window</a></code> object.</li>

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

<li>

Expand All @@ -55915,16 +55922,21 @@ <h4 id=unloading-documents><span class=secno>6.11.10 </span>Unloading documents<
<p>The user agent must <a href=#pause>pause</a> while waiting for the
user's response.</p>

<p>If the user <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
unloaded</dfn> then these steps must be aborted.</p>
<p>If the user did not confirm the page navigation, then the user
agent <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</dfn>.</p>

</li>

<li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-unload>unload</code> at the <code>Document</code>'s
</ol><hr><p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>

<ol><li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-unload>unload</code> at the <code>Document</code>'s
<code><a href=#window>Window</a></code> object.</li>

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

<li><p>If there are any outstanding transactions that have
callbacks that involve <a href=#concept-script title=concept-script>scripts</a>
Expand Down
52 changes: 32 additions & 20 deletions index
Expand Up @@ -9579,11 +9579,14 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0

</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
unload</a> the <code>Document</code> object. If the user
<a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
these steps must be aborted.</li>

<li><p><a href=#unload-a-document title="unload a document">Unload</a> the
<code>Document</code> object, with the <var title="">recycle</var>
parameter set to true. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the
document to be unloaded</a>, then these steps must be
aborted.</li>
parameter set to true.</li>

<li><p>If the document has an <a href=#active-parser>active parser</a>, then
abort that parser, and throw away any pending content in the
Expand Down Expand Up @@ -52289,6 +52292,17 @@ NETWORK:
<li><p>Cancel <em>any</em> preexisting attempt to navigate the
<a href=#browsing-context>browsing context</a>.</li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to
unload</a> the <code>Document</code> object. If the user
<a href=#refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then
these steps must be aborted.</li>

<li>

<p>If the new resource is to be handled by displaying some sort of
Expand All @@ -52304,12 +52318,6 @@ NETWORK:

</li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</li>

<li>

<p>If the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, then
Expand Down Expand Up @@ -53048,22 +53056,21 @@ NETWORK:

<div class=impl>

<p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>
<p>A <code>Document</code> has a <var title="">salvageable</var>
state, which is initially true.</p>

<ol><li><p>Set <var title="">salvageable</var> to true.</li>
<hr><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>

<li><p>Let <var title="">event</var> be a new
<ol><li><p>Let <var title="">event</var> be a new
<code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> event object with the name <code title=event-beforeunload>beforeunload</code>, with no namespace,
which does not bubble but is cancelable.</li>

<li><p>Dispatch <var title="">event</var> at the
<code>Document</code>'s <code><a href=#window>Window</a></code> object.</li>

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

<li>

Expand All @@ -53081,16 +53088,21 @@ NETWORK:
<p>The user agent must <a href=#pause>pause</a> while waiting for the
user's response.</p>

<p>If the user <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
unloaded</dfn> then these steps must be aborted.</p>
<p>If the user did not confirm the page navigation, then the user
agent <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</dfn>.</p>

</li>

<li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-unload>unload</code> at the <code>Document</code>'s
</ol><hr><p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code title=dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>

<ol><li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-unload>unload</code> at the <code>Document</code>'s
<code><a href=#window>Window</a></code> object.</li>

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

<li><p>If there are any outstanding transactions that have
callbacks that involve <a href=#concept-script title=concept-script>scripts</a>
Expand Down
64 changes: 43 additions & 21 deletions source
Expand Up @@ -9942,11 +9942,14 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0

</li>

<li><p><span title="prompt to unload a document">Prompt to
unload</span> the <code>Document</code> object. If the user
<span>refused to allow the document to be unloaded</span>, then
these steps must be aborted.</p></li>

<li><p><span title="unload a document">Unload</span> the
<code>Document</code> object, with the <var title="">recycle</var>
parameter set to true. If the user <span>refused to allow the
document to be unloaded</span>, then these steps must be
aborted.</p></li>
parameter set to true.</p></li>

<li><p>If the document has an <span>active parser</span>, then
abort that parser, and throw away any pending content in the
Expand Down Expand Up @@ -62249,6 +62252,17 @@ NETWORK:
<li><p>Cancel <em>any</em> preexisting attempt to navigate the
<span>browsing context</span>.</p></li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</p></li>

<li><p><span title="prompt to unload a document">Prompt to
unload</span> the <code>Document</code> object. If the user
<span>refused to allow the document to be unloaded</span>, then
these steps must be aborted.</p></li>

<li>

<p>If the new resource is to be handled by displaying some sort of
Expand All @@ -62266,12 +62280,6 @@ NETWORK:

</li>

<li><p>If the new resource is to be handled using a mechanism that
does not affect the browsing context, e.g. ignoring the navigation
request altogether because the specified scheme is not one of the
supported protocols, then abort these steps and proceed with that
mechanism instead.</p></li>

<li>

<p>If the new resource is to be fetched using HTTP GET <span
Expand Down Expand Up @@ -63120,16 +63128,15 @@ NETWORK:

<div class="impl">

<p>When a user agent is to <dfn>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var
title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code
title="dom-document-open">document.open()</code> method.)</p>
<p>A <code>Document</code> has a <var title="">salvageable</var>
state, which is initially true.</p>

<ol>
<hr>

<li><p>Set <var title="">salvageable</var> to true.</p></li>
<p>When a user agent is to <dfn>prompt to unload a document</dfn>,
it must run the following steps.</p>

<ol>

<li><p>Let <var title="">event</var> be a new
<code>BeforeUnloadEvent</code> event object with the name <code
Expand All @@ -63140,7 +63147,8 @@ NETWORK:
<code>Document</code>'s <code>Window</code> object.</p></li>

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

<li>

Expand All @@ -63160,17 +63168,31 @@ NETWORK:
<p>The user agent must <span>pause</span> while waiting for the
user's response.</p>

<p>If the user <dfn>refused to allow the document to be
unloaded</dfn> then these steps must be aborted.</p>
<p>If the user did not confirm the page navigation, then the user
agent <dfn>refused to allow the document to be unloaded</dfn>.</p>

</li>

</ol>

<hr>

<p>When a user agent is to <dfn>unload a document</dfn>, it must run
the following steps. These steps are passed an argument, <var
title="">recycle</var>, which is either true or false, indicating
whether the <code>Document</code> object is going to be
re-used. (This is set by the <code
title="dom-document-open">document.open()</code> method.)</p>

<ol>

<li><p><span>Fire a simple event</span> named <code
title="event-unload">unload</code> at the <code>Document</code>'s
<code>Window</code> object.</p></li>

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

<li><p>If there are any outstanding transactions that have
callbacks that involve <span title="concept-script">scripts</span>
Expand Down

0 comments on commit bb4cd28

Please sign in to comment.