Skip to content
Permalink
Browse files

[giow] (1) Allow browsers to bail early for showModalDialog, alert, c…

…onfirm, and prompt during pagehide, beforeunload, and unload events.

Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@6966 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Feb 6, 2012
1 parent b60a516 commit 1d1c3c264d64bbb55188198bb2793f8a9281d141
Showing with 247 additions and 80 deletions.
  1. +79 −27 complete.html
  2. +79 −27 index
  3. +89 −26 source
<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
"OPTIONAL" in the normative parts of this document are to be
interpreted as described in RFC2119. For readability, these words do
not appear in all uppercase letters in this specification. <a href=#refsRFC2119>[RFC2119]</a></p>
interpreted as described in RFC2119. The key word "OPTIONALLY" in
the normative parts of this document is to be interpreted with the
same normative meaning as "MAY" and "OPTIONAL". For readability,
these words do not appear in all uppercase letters in this
specification. <a href=#refsRFC2119>[RFC2119]</a></p>

<div class=impl>

<div class=impl>

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

<p><a href=#event-loop title="event loop">Event loops</a> have a
<dfn id=termination-nesting-level>termination nesting level</dfn> counter, which must initially
be zero.</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>

<ol><li><p>Let <var title="">event</var> be a new
<ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<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>, which does not
bubble but is cancelable.</li>

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

<li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier
whether the <code><a href=#document>Document</a></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>Fire a <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event at
<ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Fire a <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event at
the <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, but
with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
<code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
<code title=event-unload>unload</code> at the
<code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>

<li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier

</dl><div class=impl>

<p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when invoked, must
release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user. The user agent may make the
method wait for the user to acknowledge the message before
returning; if so, the user agent must <a href=#pause>pause</a> while the
method is waiting.</p>
<p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when invoked, must run
the following steps:</p>

<p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method, when invoked, must
release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user, and ask the user to respond with
a positive or negative response. The user agent must then
<a href=#pause>pause</a> as the method waits for the user's response. If
the user responds positively, the method must return true, and if
the user responds negatively, the method must return false.</p>
<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps.</li>

<p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn>
method, when invoked, must release the <a href=#storage-mutex>storage mutex</a>,
show the given <var title="">message</var> to the user, and ask the
user to either respond with a string value or abort. The user agent
must then <a href=#pause>pause</a> as the method waits for the user's
response. The second argument is optional. If the second argument
(<var title="">default</var>) is present, then the response must be
defaulted to the value given by <var title="">default</var>. If the
user aborts, then the method must return null; otherwise, the method
must return the string that the user responded with.</p>
<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

</div>
<li><p>Show the given <var title="">message</var> to the
user.</li>

<li><p>Optionally, <a href=#pause>pause</a> while waiting for for the
user to acknowledge the message.</li>

</ol><p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method, when invoked, must run
the following steps:</p>

<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
false.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>Show the given <var title="">message</var> to the user, and
ask the user to respond with a positive or negative
response.</li>

<li><p><a href=#pause>Pause</a> until the user responds either positively
or negatively.</li>

<li><p>If the user responded positively, return true; otherwise,
the user responded negatively: return false.</li>

</ol><p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn>
method, when invoked, must run the following steps:</p>

<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
null.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>Show the given <var title="">message</var> to the user, and
ask the user to either respond with a string value or abort. The
second argument is optional. If the second argument (<var title="">default</var>) is present, then the response must be
defaulted to the value given by <var title="">default</var>.</li>

<li><p><a href=#pause>Pause</a> while waiting for the user's
response.</li>

<li><p>If the user aborts, then return null; otherwise, return the
string that the user responded with.</li>

</ol></div>


<h4 id=printing><span class=secno>7.4.2 </span>Printing</h4>

</li>

<li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
the empty string.</li>

<li>

<p>Release the <a href=#storage-mutex>storage mutex</a>.</p>
106 index
<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
"OPTIONAL" in the normative parts of this document are to be
interpreted as described in RFC2119. For readability, these words do
not appear in all uppercase letters in this specification. <a href=#refsRFC2119>[RFC2119]</a></p>
interpreted as described in RFC2119. The key word "OPTIONALLY" in
the normative parts of this document is to be interpreted with the
same normative meaning as "MAY" and "OPTIONAL". For readability,
these words do not appear in all uppercase letters in this
specification. <a href=#refsRFC2119>[RFC2119]</a></p>

<div class=impl>

<div class=impl>

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

<p><a href=#event-loop title="event loop">Event loops</a> have a
<dfn id=termination-nesting-level>termination nesting level</dfn> counter, which must initially
be zero.</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>

<ol><li><p>Let <var title="">event</var> be a new
<ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<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>, which does not
bubble but is cancelable.</li>

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

<li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier
whether the <code><a href=#document>Document</a></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>Fire a <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event at
<ol><li><p>Increase the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Fire a <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> event at
the <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, but
with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
<code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
<code title=event-unload>unload</code> at the
<code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object.</li>

<li><p>Decrease the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination
nesting level</a> by one.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>If any event listeners were triggered by the earlier

</dl><div class=impl>

<p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when invoked, must
release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user. The user agent may make the
method wait for the user to acknowledge the message before
returning; if so, the user agent must <a href=#pause>pause</a> while the
method is waiting.</p>
<p>The <dfn id=dom-alert title=dom-alert><code>alert(<var title="">message</var>)</code></dfn> method, when invoked, must run
the following steps:</p>

<p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method, when invoked, must
release the <a href=#storage-mutex>storage mutex</a> and show the given <var title="">message</var> to the user, and ask the user to respond with
a positive or negative response. The user agent must then
<a href=#pause>pause</a> as the method waits for the user's response. If
the user responds positively, the method must return true, and if
the user responds negatively, the method must return false.</p>
<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps.</li>

<p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn>
method, when invoked, must release the <a href=#storage-mutex>storage mutex</a>,
show the given <var title="">message</var> to the user, and ask the
user to either respond with a string value or abort. The user agent
must then <a href=#pause>pause</a> as the method waits for the user's
response. The second argument is optional. If the second argument
(<var title="">default</var>) is present, then the response must be
defaulted to the value given by <var title="">default</var>. If the
user aborts, then the method must return null; otherwise, the method
must return the string that the user responded with.</p>
<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

</div>
<li><p>Show the given <var title="">message</var> to the
user.</li>

<li><p>Optionally, <a href=#pause>pause</a> while waiting for for the
user to acknowledge the message.</li>

</ol><p>The <dfn id=dom-confirm title=dom-confirm><code>confirm(<var title="">message</var>)</code></dfn> method, when invoked, must run
the following steps:</p>

<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
false.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>Show the given <var title="">message</var> to the user, and
ask the user to respond with a positive or negative
response.</li>

<li><p><a href=#pause>Pause</a> until the user responds either positively
or negatively.</li>

<li><p>If the user responded positively, return true; otherwise,
the user responded negatively: return false.</li>

</ol><p>The <dfn id=dom-prompt title=dom-prompt><code>prompt(<var title="">message</var>, <var title="">default</var>)</code></dfn>
method, when invoked, must run the following steps:</p>

<ol><li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
null.</li>

<li><p>Release the <a href=#storage-mutex>storage mutex</a>.</li>

<li><p>Show the given <var title="">message</var> to the user, and
ask the user to either respond with a string value or abort. The
second argument is optional. If the second argument (<var title="">default</var>) is present, then the response must be
defaulted to the value given by <var title="">default</var>.</li>

<li><p><a href=#pause>Pause</a> while waiting for the user's
response.</li>

<li><p>If the user aborts, then return null; otherwise, return the
string that the user responded with.</li>

</ol></div>


<h4 id=printing><span class=secno>7.4.2 </span>Printing</h4>

</li>

<li><p>If the <a href=#event-loop>event loop</a>'s <a href=#termination-nesting-level>termination nesting
level</a> is non-zero, optionally abort these steps, returning
the empty string.</li>

<li>

<p>Release the <a href=#storage-mutex>storage mutex</a>.</p>

0 comments on commit 1d1c3c2

Please sign in to comment.
You can’t perform that action at this time.