hixie: Allow browsers to bail early for showModalDialog, alert, confirm, and prompt during pagehide, beforeunload, and unload events. (whatwg r6966)

hixie: Allow browsers to bail early for showModalDialog, alert, confirm,
and prompt during pagehide, beforeunload, and unload events. (whatwg
r6966)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.5560&r2=1.5561&f=h
http://html5.org/tools/web-apps-tracker?from=6965&to=6966

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.5560
retrieving revision 1.5561
diff -u -d -r1.5560 -r1.5561
--- Overview.html 6 Feb 2012 22:09:31 -0000 1.5560
+++ Overview.html 6 Feb 2012 22:54:41 -0000 1.5561
@@ -2780,8 +2780,11 @@
   non-normative, as are all sections explicitly marked non-normative.
   Everything else in this specification is normative.<p>The key words "MUST", "MUST NOT", "REQUIRED",  "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><div class="impl">
+  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><div class="impl">
 
   <p>Requirements phrased in the imperative as part of algorithms
   (such as "strip any leading space characters" or "return false and
@@ -49130,18 +49133,28 @@
   </div><h4 id="unloading-documents"><span class="secno">5.5.11 </span>Unloading documents</h4><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
@@ -49204,7 +49217,10 @@
   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
@@ -49217,6 +49233,9 @@
    <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
@@ -53232,31 +53251,60 @@
 
   </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><h4 id="printing"><span class="secno">6.4.2 </span>Printing</h4><dl class="domintro"><dt><var title="">window</var> . <code title="dom-print"><a href="#dom-print">print</a></code>()</dt>
+   <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">6.4.2 </span>Printing</h4><dl class="domintro"><dt><var title="">window</var> . <code title="dom-print"><a href="#dom-print">print</a></code>()</dt>
 
    <dd>
 
@@ -53377,6 +53425,10 @@
 
    </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>

Received on Monday, 6 February 2012 22:58:42 UTC