HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6966

SVNBugCommentTime (UTC)
6966[Gecko] [Internet Explorer] [Opera] [Webkit] Allow browsers to bail early for showModalDialog, alert, confirm, and prompt during pagehide, beforeunload, and unload events.2012-02-06 22:54
Index: source
===================================================================
--- source	(revision 6965)
+++ source	(revision 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>

|