hixie: Make onbeforeunload and onunload fire on descendant browsing contexts. (whatwg r4493)

hixie: Make onbeforeunload and onunload fire on descendant browsing
contexts. (whatwg r4493)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3592&r2=1.3593&f=h
http://html5.org/tools/web-apps-tracker?from=4492&to=4493

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3592
retrieving revision 1.3593
diff -u -d -r1.3592 -r1.3593
--- Overview.html 6 Jan 2010 00:38:27 -0000 1.3592
+++ Overview.html 6 Jan 2010 02:58:06 -0000 1.3593
@@ -41132,7 +41132,22 @@
   contexts).<p>The transitive closure of <a href="#parent-browsing-context" title="parent browsing
   context">parent browsing contexts</a> for a <a href="#nested-browsing-context">nested browsing
   context</a> gives the list of <dfn id="ancestor-browsing-context" title="ancestor browsing
-  context">ancestor browsing contexts</dfn>.<p>A <code>Document</code> is said to be <dfn id="fully-active">fully active</dfn>
+  context">ancestor browsing contexts</dfn>.<p>The <dfn id="list-of-the-descendant-browsing-contexts">list of the descendant browsing contexts</dfn> of a
+  <code>Document</code> <var title="">d</var> is the list returned by
+  the following algorithm:<ol><li><p>Let <var title="">list</var> be an empty list.</li>
+
+   <li><p>For each <a href="#child-browsing-context">child browsing context</a> of <var title="">d</var> that is <a href="#browsing-context-nested-through" title="browsing context nested
+   through">nested through</a> an element that is <a href="#in-a-document" title="in a
+   document">in the <code>Document</code></a> <var title="">d</var>, in the <a href="#tree-order">tree order</a> of the elements of
+   the elements nesting those <a href="#browsing-context" title="browsing context">browsing
+   contexts</a>, append to the list <var title="">list</var> the
+   <a href="#list-of-the-descendant-browsing-contexts">list of the descendant browsing contexts</a> of the
+   <a href="#active-document">active document</a> of that <a href="#child-browsing-context">child browsing
+   context</a>.</li>
+
+   <li><p>Return the constructed <var title="">list</var>.</li>
+
+  </ol><hr><p>A <code>Document</code> is said to be <dfn id="fully-active">fully active</dfn>
   when it is the <a href="#active-document">active document</a> of its <a href="#browsing-context">browsing
   context</a>, and either its browsing context is a <a href="#top-level-browsing-context">top-level
   browsing context</a>, or the <code>Document</code> <a href="#browsing-context-nested-through" title="browsing context nested through">through which</a> that
@@ -41779,12 +41794,14 @@
   <p>The <dfn id="dom-length" title="dom-length"><code>length</code></dfn> IDL
   attribute on the <code><a href="#window">Window</a></code> interface must return the
   number of <a href="#child-browsing-context" title="child browsing context">child browsing
-  contexts</a> of the <a href="#active-document">active document</a> of that
-  <code><a href="#window">Window</a></code> object, if that <code><a href="#window">Window</a></code>'s
-  <a href="#browsing-context">browsing context</a> shares the same <a href="#event-loop">event
-  loop</a> as the <a href="#script-s-browsing-context">script's browsing context</a> of the
-  <a href="#first-script">first script</a> accessing the IDL attribute; otherwise, it
-  must return zero.</p>
+  contexts</a> that are <a href="#browsing-context-nested-through" title="browsing context nested
+  through">nested through</a> elements that are <a href="#in-a-document" title="in a
+  document">in the <code>Document</code></a> that is the
+  <a href="#active-document">active document</a> of that <code><a href="#window">Window</a></code> object, if
+  that <code><a href="#window">Window</a></code>'s <a href="#browsing-context">browsing context</a> shares the
+  same <a href="#event-loop">event loop</a> as the <a href="#script-s-browsing-context">script's browsing
+  context</a> of the <a href="#first-script">first script</a> accessing the IDL
+  attribute; otherwise, it must return zero.</p>
 
   <!-- in other words, frames are only accessible to same-thread processes -->
 
@@ -41796,9 +41813,10 @@
   <p>When a <code><a href="#window">Window</a></code> object is <dfn id="dom-window-item" title="dom-window-item">indexed to retrieve an indexed
   property</dfn> <var title="">index</var>, the value returned must be
   the <var title="">index</var>th <a href="#child-browsing-context">child browsing context</a>
-  of the <code>Document</code>, sorted in the <a href="#tree-order">tree order</a>
-  of the elements nesting those <a href="#browsing-context" title="browsing
-  context">browsing contexts</a>.</p>
+  of the <code>Document</code> that is nested through an element that
+  is <a href="#in-a-document" title="in a document">in the <code>Document</code></a>,
+  sorted in the <a href="#tree-order">tree order</a> of the elements nesting those
+  <a href="#browsing-context" title="browsing context">browsing contexts</a>.</p>
 
   <p>These properties are the <dfn id="dynamic-nested-browsing-context-properties">dynamic nested browsing context
   properties</dfn>.</p>
@@ -41896,9 +41914,12 @@
   <p>When a <a href="#browsing-context">browsing context</a> is to <dfn id="discard-a-document">discard a
   <code>Document</code></dfn>, that means that it is to lose the
   strong reference from the <code>Document</code>'s <a href="#browsing-context">browsing
-  context</a> to the <code>Document</code>, and that any <a href="#concept-task" title="concept-task">tasks</a> associated with the
+  context</a> to the <code>Document</code>, that any <a href="#concept-task" title="concept-task">tasks</a> associated with the
   <code>Document</code> in any <a href="#task-source">task source</a> must be
-  removed without being run.</p>
+  removed without being run, and that all the <a href="#child-browsing-context" title="child
+  browsing context">child browsing contexts</a> of the
+  <code>Document</code> must also be <a href="#a-browsing-context-is-discarded" title="a browsing context
+  is discarded">discarded</a>.</p>
 
   <p class="note">The <a href="#browsing-context">browsing context</a>'s <a href="#default-view">default
   view</a>'s <code><a href="#window">Window</a></code> object <a href="#implied-strong-reference" title="implied strong
@@ -48128,6 +48149,36 @@
 
    </li>
 
+   <li><p>If this algorithm was invoked by another instance of the
+   "prompt to unload a document" algorithm (i.e. through the steps
+   below that invoke this algorithm for all descendant browsing
+   contexts), then abort these steps here.</li>
+
+   <li><p>Let <var title="">descendants</var> be the <a href="#list-of-the-descendant-browsing-contexts">list of the
+   descendant browsing contexts</a> of the
+   <code>Document</code>.</li>
+
+   <li>
+
+    <p>If <var title="">descendants</var> is not an empty list, then
+    for each <a href="#browsing-context">browsing context</a> <var title="">b</var> in
+    <var title="">descendants</var> run the following substeps:</p>
+
+    <ol><li><p><a href="#prompt-to-unload-a-document" title="prompt to unload a document">Prompt to
+     unload</a> the <a href="#active-document">active document</a> of the
+     <a href="#browsing-context">browsing context</a> <var title="">b</var>. If the user
+     <a href="#refused-to-allow-the-document-to-be-unloaded">refused to allow the document to be unloaded</a>, then
+     the user implicitly also <a href="#refused-to-allow-the-document-to-be-unloaded" title="refused to allow the
+     document to be unloaded">refused to allow <em>this</em> document
+     to be unloaded</a>; abort these steps.</p>
+
+     <li><p>If <var title="">salvageable</var> state of the
+     <a href="#active-document">active document</a> of the <a href="#browsing-context">browsing context</a>
+     <var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
+     false also.</li>
+
+    </ol></li>
+
   </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
@@ -48156,8 +48207,36 @@
    <a href="#list-of-active-timeouts">list of active timeouts</a> and its <a href="#list-of-active-intervals">list of active
    intervals</a>.</li>
 
-   <li><p>If <var title="">salvageable</var> and <var title="">recycle</var> are both false, <a href="#discard-a-document" title="discard a
-   document">discard the <code>Document</code></a>.</li>
+   <li><p>If this algorithm was invoked by another instance of the
+   "unload a document" algorithm (i.e. through the steps below that
+   invoke this algorithm for all descendant browsing contexts), then
+   abort these steps here.</li>
+
+   <li><p>Let <var title="">descendants</var> be the <a href="#list-of-the-descendant-browsing-contexts">list of the
+   descendant browsing contexts</a> of the
+   <code>Document</code>.</li>
+
+   <li>
+
+    <p>If <var title="">descendants</var> is not an empty list, then
+    for each <a href="#browsing-context">browsing context</a> <var title="">b</var> in
+    <var title="">descendants</var> run the following substeps:</p>
+
+    <ol><li><p><a href="#unload-a-document" title="unload a document">Unload</a> the
+     <a href="#active-document">active document</a> of the <a href="#browsing-context">browsing context</a>
+     <var title="">b</var> with the <var title="">recycle</var>
+     parameter set to false.</li>
+
+     <li><p>If <var title="">salvageable</var> state of the
+     <a href="#active-document">active document</a> of the <a href="#browsing-context">browsing context</a>
+     <var title="">b</var> is false, then set the <var title="">salvageable</var> state of <em>this</em> document to
+     false also.</li>
+
+    </ol></li>
+
+   <li><p>If <var title="">salvageable</var> and <var title="">recycle</var> are both false, then the
+   <code>Document</code>'s <a href="#browsing-context">browsing context</a> must <a href="#discard-a-document" title="discard a document">discard the
+   <code>Document</code></a>.</li>
 
   </ol><h5 id="event-definition"><span class="secno">6.11.10.1 </span>Event definition</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>

Received on Wednesday, 6 January 2010 02:58:48 UTC