<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>12707</bug_id>
          
          <creation_ts>2011-05-19 19:56:33 +0000</creation_ts>
          <short_desc>pushState() / popstate API still not fully updated to match Firefox implementation</short_desc>
          <delta_ts>2011-09-22 23:23:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonas Sicking (Not reading bugmail)">jonas</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>justin.lebar</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>48648</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-05-19 19:56:33 +0000</bug_when>
    <thetext>The spec seems to still call for &apos;popstate&apos; to fire on *all* history navigations. That wasn&apos;t really what bug 12277 called for, or what we do in firefox.

What I propose (and what we do in firefox) was to make popstate *only* fire during in-Document navigations. I.e. only when making history navigations within the same Document. When loading a new document, or when going back to a previous Document, only &apos;load&apos;/&apos;pageshow&apos; is fired.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49939</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-06-20 19:52:07 +0000</bug_when>
    <thetext>Ah, that wasn&apos;t clear. Will fix this too. (I guess the way to do it is to track the current state and if the history is being navigated to that state, don&apos;t fire popstate, or something. Would that handle #frag navs correctly?)

How should going back multiple steps in history, crossing a document boundary, be handled?

e.g.:

  ...state3 | state4 | state5 ] [ state0 | state1 | state2...

where the first [..] is doc A and the second [..] is doc B, and the user navigates from state1 in docB to state4 in docA in one traversal operation. What popstates should fire, if any?

How about state5-&gt;state3 or state3-&gt;state5?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49946</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-06-21 00:06:08 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Ah, that wasn&apos;t clear. Will fix this too. (I guess the way to do it is to track
&gt; the current state and if the history is being navigated to that state, don&apos;t
&gt; fire popstate, or something. Would that handle #frag navs correctly?)

For each Document you need to keep track of it&apos;s current session-history entry. If you end up navigating to a sesssion-history entry which isn&apos;t the current session-history entry for its Document, then fire popstate and make the new session-history entry the current session-history entry for that Document.

&gt; How should going back multiple steps in history, crossing a document boundary,
&gt; be handled?
&gt; 
&gt; e.g.:
&gt; 
&gt;   ...state3 | state4 | state5 ] [ state0 | state1 | state2...
&gt; 
&gt; where the first [..] is doc A and the second [..] is doc B, and the user
&gt; navigates from state1 in docB to state4 in docA in one traversal operation.
&gt; What popstates should fire, if any?

Depends on the state of things before that navigation happens. Usually it will fire a popstate on doc A with history.state set to state4.

However, if the user had just navigated directly from state4 of docA to state1 of docB, then no popstates fire.

&gt; How about state5-&gt;state3 or state3-&gt;state5?

These always fire popstate with history.state set to state3 for the former and state5 for the latter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49947</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-06-21 00:11:13 +0000</bug_when>
    <thetext>Note that Firefox currently has some bugs with regards to multi-session-history jumps and documents being stored in the bfcache (basically we miss the fact that a Document exists in the bfcache and we reload from network). 

There is a patch in bug 646641 if you really want to try it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52573</commentid>
    <comment_count>4</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:02:45 +0000</bug_when>
    <thetext>mass-moved component to LC1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54622</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-08-10 19:45:42 +0000</bug_when>
    <thetext>This should be pretty straight-forward. I just need to define a per-Document state whose value is a session history entry, initially set to be the first entry. Whenever transitioning in session history, compare old value to new value in the current popstate step, and if it&apos;s different, fire the event and update the value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57198</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-09-22 23:23:21 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57199</commentid>
    <comment_count>7</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-09-22 23:23:34 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6564.
Check-in comment: Make popstate not fire onload and not fire when you go back and forth across documents without changing which was the last active state for that document. This is intended to match Firefox. It&apos;s also much more sensible than what we had before.
http://html5.org/tools/web-apps-tracker?from=6563&amp;to=6564</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>