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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>59195</bug_id>
          
          <creation_ts>2011-04-22 06:06:18 -0700</creation_ts>
          <short_desc>location.replace doesn&apos;t update hash in browser history</short_desc>
          <delta_ts>2011-06-30 18:27:50 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>History</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>63777</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Jaro">jarol1</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>fishd</cc>
    
    <cc>jarol1</cc>
    
    <cc>mihaip</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>390738</commentid>
    <comment_count>0</comment_count>
      <attachid>90697</attachid>
    <who name="Jaro">jarol1</who>
    <bug_when>2011-04-22 06:06:18 -0700</bug_when>
    <thetext>Created attachment 90697
sample to demonstrate history behaviour

In RIA applications built on GWT (but also elsewhere) it is common to keep state by saving some value after # in URL. This is done by window.location.hash = &quot;appPlace;param1=value1&quot;; - and results in creation of new browser history item. But sometimes location in the application doesn&apos;t change (user remains on the page but does something), only some parameters in hash need to be updated to enable user bookmark the correct location or be able to send a correct link to friend. For update, we don&apos;t want to create new history item by assigning new value to window.location.hash. A common solution is to use window.location.replace(newUrl);, where we ensure that the &quot;newUrl&quot; value has the same base Url, only # value is different.

Current behaviour in the latest Chrome and Safari (tested on WebKit-r84564) is that window.location.replace changes current URL, but doesn&apos;t update current history item in browser history. This then leads to a problem if we perform window.location.replace followed by creation of new history item via window.location.hash. When user hits back browser button, he won&apos;t return to the updated URL, but to the original one.

In Internet Explorer 8, 9, Firefox 3.0, Firefox 3.6, Firefox 4 invocation of window.location.replace also updates current browser history item. For IE 7 there is a solution with writing to iframe with &apos;replace&apos; flag. It would be nice if WebKit also behaved in this way to better support stateful RIA applications.

I attached slightly stripped closure_library which includes a nice demo for history testing - closure\goog\demos\history1.html. I modified the library history.js file to set location.hash instead of location.href for creating new history item.

The following use cases should be tested:

1.) Update of history item followed by creation of new history item
1.1) Type token &quot;aaa&quot;, click on SetToken
1.2) Type token &quot;bbb&quot;, click on SetToken
1.3) Type token &quot;bbb2&quot;, click on Replace Current Token
1.4) Type token &quot;ccc&quot;, click on SetToken
1.5) Hit back browser button

After step 1.5, we will see &quot;#bbb&quot;, but we would like to see &quot;#bbb2&quot;. This is like above mentioned versions of IE and Firefox behave.

2.) Update of old history item (reload page for this test)
2.1) Type token &quot;aaa&quot;, click on SetToken
2.2) Type token &quot;bbb&quot;, click on SetToken
2.3) Type token &quot;ccc&quot;, click on SetToken
2.4) Hit back browser button, you should see &quot;#bbb&quot;
2.5) Type token &quot;bbb2&quot;, click on Replace Current Token
2.6) Hit forward browser button and then back browser button

After step 2.6, we will see &quot;#bbb&quot;, but we would like to see &quot;#bbb2&quot;. This is like above mentioned versions of IE and Firefox behave.

There are other reported bugs related to location.replace, but in the latest releases it seems that location.replace doesn&apos;t break history.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>390849</commentid>
    <comment_count>1</comment_count>
    <who name="Mihai Parparita">mihaip</who>
    <bug_when>2011-04-22 10:03:33 -0700</bug_when>
    <thetext>I&apos;m on a plane, so I can&apos;t look at the attached test case (something smaller than 3.2 MB would be appreciated), but bug 57979 is most likely related to this (it&apos;s also about location replacement not updating the current history entry).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>430920</commentid>
    <comment_count>2</comment_count>
    <who name="Mihai Parparita">mihaip</who>
    <bug_when>2011-06-30 18:27:50 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 63777 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>90697</attachid>
            <date>2011-04-22 06:06:18 -0700</date>
            <delta_ts>2011-04-22 06:06:18 -0700</delta_ts>
            <desc>sample to demonstrate history behaviour</desc>
            <filename>closure_library.zip</filename>
            <type>application/zip</type>
            <size>0</size>
            <attacher name="Jaro">jarol1</attacher>
            
              <data encoding="base64"></data>

          </attachment>
      

    </bug>

</bugzilla>