hixie: Change pushState() and replaceState() so that they update the pending state object as well (otherwise, pushState vs pushState;back;forward would result in different state objects in the initial popostate which is just silly). (whatwg r5686)

hixie: Change pushState() and replaceState() so that they update the
pending state object as well (otherwise, pushState vs
pushState;back;forward would result in different state objects in the
initial popostate which is just silly). (whatwg r5686)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4553&r2=1.4554&f=h
http://html5.org/tools/web-apps-tracker?from=5685&to=5686

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4553
retrieving revision 1.4554
diff -u -d -r1.4553 -r1.4554
--- Overview.html 30 Nov 2010 01:22:50 -0000 1.4553
+++ Overview.html 30 Nov 2010 02:07:49 -0000 1.4554
@@ -43454,6 +43454,21 @@
 
    </li>
 
+   <li>
+
+     <p>If the <a href="#current-document-readiness">current document readiness</a> is not yet set
+     to the string "complete", let the <code><a href="#document">Document</a></code>'s
+     <a href="#pending-state-object">pending state object</a> be another <a href="#structured-clone">structured
+     clone</a> of the specified <var title="">data</var>. (If there
+     was already a <a href="#pending-state-object">pending state object</a>, the previous one
+     is discarded.)</p>
+
+     <p class="note">This ensures that the <code title="event-popstate"><a href="#event-popstate">popstate</a></code> event that will be fired
+     when the document finally loads will accurately reflect the
+     pushed or replaced state object.</p>
+
+   </li>
+
   </ol><p class="note">The <var title="">title</var> is purely
   advisory. User agents might use the title in the user interface.</p>
 
@@ -44747,6 +44762,12 @@
      attribute set to true. This event must not bubble, must not be
      cancelable, and has no default action.</li>
 
+     <!-- 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 higher
+     priority than the DOM manipulation task source. -->
+
     </ol></li>
 
    <li><p>Set <a href="#the-document-s-current-address">the document's current address</a> to the URL
@@ -44792,8 +44813,8 @@
 
      <dt>Otherwise</dt>
 
-     <dd><p>Let the <code><a href="#document">Document</a></code>'s <dfn id="pending-state-object">pending state
-     object</dfn> be <var title="">state</var>. (If there was already
+     <dd><p>Let the <code><a href="#document">Document</a></code>'s <a href="#pending-state-object">pending state
+     object</a> be <var title="">state</var>. (If there was already
      a <a href="#pending-state-object">pending state object</a>, the previous one is
      discarded.)</p>
 
@@ -44812,7 +44833,10 @@
    <li><p>The <a href="#current-entry">current entry</a> is now the <i>specified
    entry</i>.</li>
 
-  </ol><p>The <a href="#pending-state-object">pending state object</a> must be initially null.</p>
+  </ol><p>The <dfn id="pending-state-object">pending state object</dfn> is used to keep track of what
+  state object to use in the inital <code title="event-popstate"><a href="#event-popstate">popstate</a></code> event fired by the parser
+  once it <a href="#stop-parsing" title="stop parsing">stops parsing</a>. The
+  <a href="#pending-state-object">pending state object</a> must be initially null.</p>
 
   <p>The <a href="#task-source">task source</a> for the tasks mentioned above is the
   <a href="#dom-manipulation-task-source">DOM manipulation task source</a>.</p>
@@ -61432,8 +61456,8 @@
    attribute set 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> has a <a href="#pending-state-object">pending state
-   object</a>, then <a href="#queue-a-task">queue a task</a> to fire a <code title="event-popstate"><a href="#event-popstate">popstate</a></code> event at the
+   <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-popstate"><a href="#event-popstate">popstate</a></code> event at the
    <code><a href="#document">Document</a></code>'s <code><a href="#window">Window</a></code> object using the
    <code><a href="#popstateevent">PopStateEvent</a></code> interface, with the <code title="dom-PopStateEvent-state"><a href="#dom-popstateevent-state">state</a></code> attribute set to the
    current value of the <a href="#pending-state-object">pending state object</a>. This event

Received on Tuesday, 30 November 2010 02:10:13 UTC