[html5] r6966 - [giow] (1) Allow browsers to bail early for showModalDialog, alert, confirm, and [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Feb 6 14:54:36 PST 2012


Author: ianh
Date: 2012-02-06 14:54:35 -0800 (Mon, 06 Feb 2012)
New Revision: 6966

Modified:
   complete.html
   index
   source
Log:
[giow] (1) Allow browsers to bail early for showModalDialog, alert, confirm, and prompt during pagehide, beforeunload, and unload events.
Affected topics: DOM APIs, HTML

Modified: complete.html
===================================================================
--- complete.html	2012-02-06 22:09:20 UTC (rev 6965)
+++ complete.html	2012-02-06 22:54:35 UTC (rev 6966)
@@ -3417,8 +3417,11 @@
   <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>
 
@@ -64827,18 +64830,28 @@
   <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
@@ -64901,7 +64914,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
@@ -64914,6 +64930,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
@@ -69328,33 +69347,62 @@
 
   </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>
 
 <!--TOPIC:DOM APIs-->
@@ -69486,6 +69534,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>

Modified: index
===================================================================
--- index	2012-02-06 22:09:20 UTC (rev 6965)
+++ index	2012-02-06 22:54:35 UTC (rev 6966)
@@ -3417,8 +3417,11 @@
   <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>
 
@@ -64827,18 +64830,28 @@
   <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
@@ -64901,7 +64914,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
@@ -64914,6 +64930,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
@@ -69328,33 +69347,62 @@
 
   </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>
 
 <!--TOPIC:DOM APIs-->
@@ -69486,6 +69534,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>

Modified: source
===================================================================
--- source	2012-02-06 22:09:20 UTC (rev 6965)
+++ source	2012-02-06 22:54:35 UTC (rev 6966)
@@ -2330,9 +2330,11 @@
   <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">
 
@@ -75785,13 +75787,20 @@
 
   <p>A <code>Document</code> has a <dfn
   title="concept-document-salvageable"><var>salvageable</var></dfn>
-  state, which is initially true.</p>
+  state, which must initially be true.</p>
 
+  <p><span title="event loop">Event loops</span> have a
+  <dfn>termination nesting level</dfn> counter, which must initially
+  be zero.</p>
+
   <p>When a user agent is to <dfn>prompt to unload a document</dfn>,
   it must run the following steps.</p>
 
   <ol>
 
+   <li><p>Increase the <span>event loop</span>'s <span>termination
+   nesting level</span> by one.</p></li>
+
    <li><p>Let <var title="">event</var> be a new
    <code>BeforeUnloadEvent</code> event object with the name <code
    title="event-beforeunload">beforeunload</code>, which does not
@@ -75800,6 +75809,9 @@
    <li><p><i>Dispatch</i>: Dispatch <var title="">event</var> at the
    <code>Document</code>'s <code>Window</code> object.</p></li>
 
+   <li><p>Decrease the <span>event loop</span>'s <span>termination
+   nesting level</span> by one.</p></li>
+
    <li><p>Release the <span>storage mutex</span>.</p></li>
 
    <li><p>If any event listeners were triggered by the earlier
@@ -75877,6 +75889,9 @@
 
   <ol>
 
+   <li><p>Increase the <span>event loop</span>'s <span>termination
+   nesting level</span> by one.</p></li>
+
    <li><p>Fire a <code title="event-pagehide">pagehide</code> event at
    the <code>Window</code> object of the <code>Document</code>, but
    with its <code title="dom-event-target">target</code> set to the
@@ -75892,6 +75907,9 @@
    <code title="event-unload">unload</code> at the
    <code>Document</code>'s <code>Window</code> object.</p></li>
 
+   <li><p>Decrease the <span>event loop</span>'s <span>termination
+   nesting level</span> by one.</p></li>
+
    <li><p>Release the <span>storage mutex</span>.</p></li>
 
    <li><p>If any event listeners were triggered by the earlier
@@ -81064,34 +81082,75 @@
   <div class="impl">
 
   <p>The <dfn title="dom-alert"><code>alert(<var
-  title="">message</var>)</code></dfn> method, when invoked, must
-  release the <span>storage mutex</span> 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 <span>pause</span> while the
-  method is waiting.</p>
+  title="">message</var>)</code></dfn> method, when invoked, must run
+  the following steps:</p>
 
+  <ol>
+
+   <li><p>If the <span>event loop</span>'s <span>termination nesting
+   level</span> is non-zero, optionally abort these steps.</p></li>
+
+   <li><p>Release the <span>storage mutex</span>.</p></li>
+
+   <li><p>Show the given <var title="">message</var> to the
+   user.</p></li>
+
+   <li><p>Optionally, <span>pause</span> while waiting for for the
+   user to acknowledge the message.</p></li>
+
+  </ol>
+
   <p>The <dfn title="dom-confirm"><code>confirm(<var
-  title="">message</var>)</code></dfn> method, when invoked, must
-  release the <span>storage mutex</span> 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
-  <span>pause</span> 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>
+  title="">message</var>)</code></dfn> method, when invoked, must run
+  the following steps:</p>
 
+  <ol>
+
+   <li><p>If the <span>event loop</span>'s <span>termination nesting
+   level</span> is non-zero, optionally abort these steps, returning
+   false.</p></li>
+
+   <li><p>Release the <span>storage mutex</span>.</p></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.</p></li>
+
+   <li><p><span>Pause</span> until the user responds either positively
+   or negatively.</p></li>
+
+   <li><p>If the user responded positively, return true; otherwise,
+   the user responded negatively: return false.</p></li>
+
+  </ol>
+
   <p>The <dfn title="dom-prompt"><code>prompt(<var
   title="">message</var>, <var title="">default</var>)</code></dfn>
-  method, when invoked, must release the <span>storage mutex</span>,
-  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 <span>pause</span> 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>
+  method, when invoked, must run the following steps:</p>
 
+  <ol>
+
+   <li><p>If the <span>event loop</span>'s <span>termination nesting
+   level</span> is non-zero, optionally abort these steps, returning
+   null.</p></li>
+
+   <li><p>Release the <span>storage mutex</span>.</p></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>.</p></li>
+
+   <li><p><span>Pause</span> while waiting for the user's
+   response.</p></li>
+
+   <li><p>If the user aborts, then return null; otherwise, return the
+   string that the user responded with.</p></li>
+
+  </ol>
+
   </div>
 
 
@@ -81247,6 +81306,10 @@
 
    </li>
 
+   <li><p>If the <span>event loop</span>'s <span>termination nesting
+   level</span> is non-zero, optionally abort these steps, returning
+   the empty string.</p></li>
+
    <li>
 
     <p>Release the <span>storage mutex</span>.</p>




More information about the Commit-Watchers mailing list