[html5] r7373 - [giow] (2) Add some guards to make pageshow/pagehide events always fire consiste [...]
whatwg at whatwg.org
whatwg at whatwg.org
Tue Sep 18 15:18:36 PDT 2012
Author: ianh
Date: 2012-09-18 15:18:34 -0700 (Tue, 18 Sep 2012)
New Revision: 7373
Modified:
complete.html
index
source
Log:
[giow] (2) Add some guards to make pageshow/pagehide events always fire consistently. This makes it easier to be sane around quick-fire navigation during unload, etc, also.
Affected topics: HTML, HTML Syntax and Parsing
Modified: complete.html
===================================================================
--- complete.html 2012-09-18 22:09:55 UTC (rev 7372)
+++ complete.html 2012-09-18 22:18:34 UTC (rev 7373)
@@ -71556,7 +71556,14 @@
<p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> is "<code title="">complete</code>", <a href=#queue-a-task>queue a task</a> to run the
following sub-sub-steps:</p>
- <ol><li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>
+ <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</li>
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page
+ showing</a> flag to true.</li>
+
+ <li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>
event at the <code><a href=#window>Window</a></code> object of that
<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
@@ -71568,7 +71575,8 @@
</ol><!-- an interesting thing to test would be to traverse back
during onload, before the first pageshow has fired, and then to
traverse forward again, and see if we get _two_ pageshows. If
- so, it indicates that the history traversal task source has a
+ so, it indicates that browsers don't have a "page showing" flag
+ like this and that the history traversal task source has a
higher priority than the DOM manipulation task source. --></li>
</ol></li>
@@ -71736,12 +71744,13 @@
<hr><p>The <dfn id=event-pageshow title=event-pageshow><code>pageshow</code></dfn> event
is fired when traversing <em>to</em> a <a href=#session-history-entry>session history
- entry</a>.</p>
+ entry</a>. The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn> event is fired
+ when traversing <em>from</em> a <a href=#session-history-entry>session history entry</a>.
+ The specification uses the <a href=#page-showing>page showing</a> flag to ensure
+ that scripts receive these events in a consistent manner (e.g. that
+ they never receive two <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code>
+ events in a row without an intervening <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>, or vice versa).</p>
- <p>The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn>
- event is fired when traversing <em>from</em> a <a href=#session-history-entry>session history
- entry</a>.</p>
-
<pre class=idl>[Constructor(DOMString type, optional <a href=#pagetransitioneventinit>PageTransitionEventInit</a> eventInitDict)]
interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event>Event</a> {
readonly attribute boolean <a href=#dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted>persisted</a>;
@@ -71873,6 +71882,14 @@
<li><p>Increase the <code><a href=#document>Document</a></code>'s
<a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> by one.</li>
+ <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is false, then jump to the step labled <i>unload event</i>
+ below (i.e. skip firing the <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> even and don't rerun the
+ <a href=#unloading-document-visibility-change-steps>unloading document visibility change steps</a>).</li>
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag to false.</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
@@ -95764,16 +95781,31 @@
<code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
<code><a href=#window>Window</a></code> object).</li>
- <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
- context</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</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><a href=#window>Window</a></code> object), using the
- <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
- attribute initialized to false. This event must not bubble, must
- not be cancelable, and has no default action.</li>
+ <li>
+ <p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+ context</a>, then <a href=#queue-a-task>queue a task</a> to run the
+ following substeps:</p>
+
+ <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</li> <!-- i don't see how this could be, but just to
+ be sure... -->
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag to true.</li>
+
+ <li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</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><a href=#window>Window</a></code> object), using the
+ <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
+ attribute initialized to false. This event must not bubble, must
+ not be cancelable, and has no default action.</li>
+
+ </ol></li>
+
<li><p>If the <code><a href=#document>Document</a></code> has any <a href=#pending-application-cache-download-process-tasks>pending
application cache download process tasks</a>, then <a href=#queue-a-task title="queue a task">queue</a> each such <a href=#concept-task title=concept-task>task</a> in the order they were added to
the list of <a href=#pending-application-cache-download-process-tasks>pending application cache download process
Modified: index
===================================================================
--- index 2012-09-18 22:09:55 UTC (rev 7372)
+++ index 2012-09-18 22:18:34 UTC (rev 7373)
@@ -71556,7 +71556,14 @@
<p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> is "<code title="">complete</code>", <a href=#queue-a-task>queue a task</a> to run the
following sub-sub-steps:</p>
- <ol><li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>
+ <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</li>
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page
+ showing</a> flag to true.</li>
+
+ <li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>
event at the <code><a href=#window>Window</a></code> object of that
<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
@@ -71568,7 +71575,8 @@
</ol><!-- an interesting thing to test would be to traverse back
during onload, before the first pageshow has fired, and then to
traverse forward again, and see if we get _two_ pageshows. If
- so, it indicates that the history traversal task source has a
+ so, it indicates that browsers don't have a "page showing" flag
+ like this and that the history traversal task source has a
higher priority than the DOM manipulation task source. --></li>
</ol></li>
@@ -71736,12 +71744,13 @@
<hr><p>The <dfn id=event-pageshow title=event-pageshow><code>pageshow</code></dfn> event
is fired when traversing <em>to</em> a <a href=#session-history-entry>session history
- entry</a>.</p>
+ entry</a>. The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn> event is fired
+ when traversing <em>from</em> a <a href=#session-history-entry>session history entry</a>.
+ The specification uses the <a href=#page-showing>page showing</a> flag to ensure
+ that scripts receive these events in a consistent manner (e.g. that
+ they never receive two <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code>
+ events in a row without an intervening <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code>, or vice versa).</p>
- <p>The <dfn id=event-pagehide title=event-pagehide><code>pagehide</code></dfn>
- event is fired when traversing <em>from</em> a <a href=#session-history-entry>session history
- entry</a>.</p>
-
<pre class=idl>[Constructor(DOMString type, optional <a href=#pagetransitioneventinit>PageTransitionEventInit</a> eventInitDict)]
interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event>Event</a> {
readonly attribute boolean <a href=#dom-pagetransitionevent-persisted title=dom-PageTransitionEvent-persisted>persisted</a>;
@@ -71873,6 +71882,14 @@
<li><p>Increase the <code><a href=#document>Document</a></code>'s
<a href=#ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> by one.</li>
+ <li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is false, then jump to the step labled <i>unload event</i>
+ below (i.e. skip firing the <code title=event-pagehide><a href=#event-pagehide>pagehide</a></code> even and don't rerun the
+ <a href=#unloading-document-visibility-change-steps>unloading document visibility change steps</a>).</li>
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag to false.</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
@@ -95764,16 +95781,31 @@
<code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
<code><a href=#window>Window</a></code> object).</li>
- <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
- context</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</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><a href=#window>Window</a></code> object), using the
- <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
- attribute initialized to false. This event must not bubble, must
- not be cancelable, and has no default action.</li>
+ <li>
+ <p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+ context</a>, then <a href=#queue-a-task>queue a task</a> to run the
+ following substeps:</p>
+
+ <ol><li><p>If the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</li> <!-- i don't see how this could be, but just to
+ be sure... -->
+
+ <li><p>Set the <code><a href=#document>Document</a></code>'s <a href=#page-showing>page showing</a>
+ flag to true.</li>
+
+ <li><p>Fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</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><a href=#window>Window</a></code> object), using the
+ <code><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code title=dom-PageTransitionEvent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code>
+ attribute initialized to false. This event must not bubble, must
+ not be cancelable, and has no default action.</li>
+
+ </ol></li>
+
<li><p>If the <code><a href=#document>Document</a></code> has any <a href=#pending-application-cache-download-process-tasks>pending
application cache download process tasks</a>, then <a href=#queue-a-task title="queue a task">queue</a> each such <a href=#concept-task title=concept-task>task</a> in the order they were added to
the list of <a href=#pending-application-cache-download-process-tasks>pending application cache download process
Modified: source
===================================================================
--- source 2012-09-18 22:09:55 UTC (rev 7372)
+++ source 2012-09-18 22:18:34 UTC (rev 7373)
@@ -83633,6 +83633,13 @@
<ol>
+ <li><p>If the <code>Document</code>'s <span>page showing</span>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</p></li>
+
+ <li><p>Set the <code>Document</code>'s <span>page
+ showing</span> flag to true.</p></li>
+
<li><p>Fire a <code title="event-pageshow">pageshow</code>
event at the <code>Window</code> object of that
<code>Document</code>, but with its <code
@@ -83650,7 +83657,8 @@
<!-- an interesting thing to test would be to traverse back
during onload, before the first pageshow has fired, and then to
traverse forward again, and see if we get _two_ pageshows. If
- so, it indicates that the history traversal task source has a
+ so, it indicates that browsers don't have a "page showing" flag
+ like this and that the history traversal task source has a
higher priority than the DOM manipulation task source. -->
</li>
@@ -83853,12 +83861,15 @@
<p>The <dfn title="event-pageshow"><code>pageshow</code></dfn> event
is fired when traversing <em>to</em> a <span>session history
- entry</span>.</p>
+ entry</span>. The <dfn
+ title="event-pagehide"><code>pagehide</code></dfn> event is fired
+ when traversing <em>from</em> a <span>session history entry</span>.
+ The specification uses the <span>page showing</span> flag to ensure
+ that scripts receive these events in a consistent manner (e.g. that
+ they never receive two <code title="event-pagehide">pagehide</code>
+ events in a row without an intervening <code
+ title="event-pageshow">pageshow</code>, or vice versa).</p>
- <p>The <dfn title="event-pagehide"><code>pagehide</code></dfn>
- event is fired when traversing <em>from</em> a <span>session history
- entry</span>.</p>
-
<pre class="idl">[Constructor(DOMString type, optional <span>PageTransitionEventInit</span> eventInitDict)]
interface <dfn>PageTransitionEvent</dfn> : <span>Event</span> {
readonly attribute boolean <span title="dom-PageTransitionEvent-persisted">persisted</span>;
@@ -84014,6 +84025,15 @@
<li><p>Increase the <code>Document</code>'s
<span>ignore-opens-during-unload counter</span> by one.</p></li>
+ <li><p>If the <code>Document</code>'s <span>page showing</span>
+ flag is false, then jump to the step labled <i>unload event</i>
+ below (i.e. skip firing the <code
+ title="event-pagehide">pagehide</code> even and don't rerun the
+ <span>unloading document visibility change steps</span>).</p></li>
+
+ <li><p>Set the <code>Document</code>'s <span>page showing</span>
+ flag to false.</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
@@ -110907,19 +110927,37 @@
title="dom-event-currentTarget">currentTarget</code> set to the
<code>Window</code> object).</p></li>
- <li><p>If the <code>Document</code> is in a <span>browsing
- context</span>, then <span>queue a task</span> to fire a <code
- title="event-pageshow">pageshow</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
- <code>Document</code> object (and the <code
- title="dom-event-currentTarget">currentTarget</code> set to the
- <code>Window</code> object), using the
- <code>PageTransitionEvent</code> interface, with the <code
- title="dom-PageTransitionEvent-persisted">persisted</code>
- attribute initialized to false. This event must not bubble, must
- not be cancelable, and has no default action.</p></li>
+ <li>
+ <p>If the <code>Document</code> is in a <span>browsing
+ context</span>, then <span>queue a task</span> to run the
+ following substeps:</p>
+
+ <ol>
+
+ <li><p>If the <code>Document</code>'s <span>page showing</span>
+ flag is true, then abort this task (i.e. don't fire the event
+ below).</p></li> <!-- i don't see how this could be, but just to
+ be sure... -->
+
+ <li><p>Set the <code>Document</code>'s <span>page showing</span>
+ flag to true.</p></li>
+
+ <li><p>Fire a <code title="event-pageshow">pageshow</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 <code>Document</code> object (and the <code
+ title="dom-event-currentTarget">currentTarget</code> set to the
+ <code>Window</code> object), using the
+ <code>PageTransitionEvent</code> interface, with the <code
+ title="dom-PageTransitionEvent-persisted">persisted</code>
+ attribute initialized to false. This event must not bubble, must
+ not be cancelable, and has no default action.</p></li>
+
+ </ol>
+
+ </li>
+
<li><p>If the <code>Document</code> has any <span>pending
application cache download process tasks</span>, then <span
title="queue a task">queue</span> each such <span
More information about the Commit-Watchers
mailing list