<?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>263635</bug_id>
          
          <creation_ts>2023-10-24 23:50:03 -0700</creation_ts>
          <short_desc>window.history.replaceState(&apos;&apos;, &apos;&apos;, &apos;&apos;) has no effect in Safari on macOS</short_desc>
          <delta_ts>2024-09-12 10:03:45 -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>Safari 16</version>
          <rep_platform>All</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>276375</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>harnoor1994</reporter>
          <assigned_to name="Patrick Griffis">pgriffis</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>d</cc>
    
    <cc>harnoor1994</cc>
    
    <cc>mike</cc>
    
    <cc>pgriffis</cc>
    
    <cc>sun.shin</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1987322</commentid>
    <comment_count>0</comment_count>
    <who name="">harnoor1994</who>
    <bug_when>2023-10-24 23:50:03 -0700</bug_when>
    <thetext>window.history.replaceState(&apos;&apos;, &apos;&apos;, &apos;&apos;) behave differently on Safari on MacOS.

It is supposed to update the address bar to the default URL (before the hash parameter). But it has no effect on Safari on MacOS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1987606</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-10-25 16:13:19 -0700</bug_when>
    <thetext>Can you share test case to reproduce the issue? Plus whether it is reproducible on latest Safari Technology Preview 181?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1989090</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-10-31 23:50:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/117782346&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1989188</commentid>
    <comment_count>3</comment_count>
    <who name="">harnoor1994</who>
    <bug_when>2023-11-01 10:33:37 -0700</bug_when>
    <thetext>Yes it is reproducible on Safari Technology Preview 181. I am working on test cases. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1989346</commentid>
    <comment_count>4</comment_count>
    <who name="sideshowbarker">mike</who>
    <bug_when>2023-11-01 22:12:25 -0700</bug_when>
    <thetext>Ideally what would be the most help is a WPT test that would be runnable under the WPT test harness.

You can find the existing such tests at https://github.com/web-platform-tests/wpt/tree/master/html/browsers/history/the-history-interface — for example, https://github.com/web-platform-tests/wpt/blob/master/html/browsers/history/the-history-interface/history_replacestate.html

And you can run those tests directly in any browser by going, for example, to http://wpt.live/html/browsers/history/the-history-interface/history_replacestate.html

So you might be able to just add a `window.history.replaceState(&apos;&apos;, &apos;&apos;, &apos;&apos;)` test (with an assert_equals or some other kind of assert_*) directly to a copy of the existing https://github.com/web-platform-tests/wpt/blob/master/html/browsers/history/the-history-interface/history_replacestate.html source</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057246</commentid>
    <comment_count>5</comment_count>
      <attachid>472419</attachid>
    <who name="">harnoor1994</who>
    <bug_when>2024-09-03 08:07:26 -0700</bug_when>
    <thetext>Created attachment 472419
index.html to illustrate the bug repro

I am attaching an index.html to illustrate a behavior related to how Safari on macOS handles URL changes when using the replaceState function. It is no repro on Chrome.
Repo Link of same index.html: https://github.com/HarnoorSinghKhurana/safari-test/tree/main

Live Test Link : https://exquisite-fudge-6ed920.netlify.app/

Expected Behavior:
1. Clicking &quot;Go to Deep Link&quot; should update the URL with the fragment (#/deeplink?test-id=6f5d61af).
2. Clicking &quot;Back to Default Route&quot; should clear the fragment and restore the URL to its base path.

In Safari on macOS, the clearDeepLink function donot clear the fragment from the URL, leaving it unchanged.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057714</commentid>
    <comment_count>6</comment_count>
    <who name="Byungseon(Sun) Shin">sun.shin</who>
    <bug_when>2024-09-04 15:15:41 -0700</bug_when>
    <thetext>Add the attached TC on W3C: https://github.com/web-platform-tests/wpt/pull/47973</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057715</commentid>
    <comment_count>7</comment_count>
    <who name="Byungseon(Sun) Shin">sun.shin</who>
    <bug_when>2024-09-04 15:18:27 -0700</bug_when>
    <thetext>Tested on STP #202, confirmed that it has been fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057822</commentid>
    <comment_count>8</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2024-09-04 23:30:09 -0700</bug_when>
    <thetext>This fix appears to contradict the spec, per https://html.spec.whatwg.org/#shared-history-push/replace-state-steps step 6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058216</commentid>
    <comment_count>9</comment_count>
    <who name="Byungseon(Sun) Shin">sun.shin</who>
    <bug_when>2024-09-06 08:51:04 -0700</bug_when>
    <thetext>@Domenic, the changes made on &lt;https://bugs.webkit.org/show_bug.cgi?id=276375&gt; patched by</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058217</commentid>
    <comment_count>10</comment_count>
    <who name="Byungseon(Sun) Shin">sun.shin</who>
    <bug_when>2024-09-06 08:52:09 -0700</bug_when>
    <thetext>@Domenic, the changes made on &lt;https://bugs.webkit.org/show_bug.cgi?id=276375&gt; patched by Patrick Griffis.

I think we have to go back the the patch and see what is the right path for the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058967</commentid>
    <comment_count>11</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2024-09-10 07:28:50 -0700</bug_when>
    <thetext>I can look into this but is there no test case?

web-platform-tests/html/browsers/history/the-history-interface/history_replacestate.html PASSes.

&gt; Expected Behavior:
&gt; 1. Clicking &quot;Go to Deep Link&quot; should update the URL with the fragment (#/deeplink?test-id=6f5d61af).
&gt; 2. Clicking &quot;Back to Default Route&quot; should clear the fragment and restore the URL to its base path.

This test works in WebKit main and Chrome, but not on Firefox 129.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058978</commentid>
    <comment_count>12</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2024-09-10 08:36:23 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/33402</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058979</commentid>
    <comment_count>13</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2024-09-10 08:37:53 -0700</bug_when>
    <thetext>If I understand correctly, not updating the URL is correct per the spec. Firefox matched this, Chrome 127.0.6533.99 did not.

I&apos;ve submitted a draft PR above.

Does this sound right Domenic?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058983</commentid>
    <comment_count>14</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2024-09-10 08:46:53 -0700</bug_when>
    <thetext>&gt; is there no test case?

WebKit didn&apos;t have  html/browsers/history/the-history-interface/pushstate-replacestate-empty-string/ imported so that makes sense.

With my PR all tests pass.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2059707</commentid>
    <comment_count>15</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-12 10:03:43 -0700</bug_when>
    <thetext>Committed 283565@main (ba51e8eae852): &lt;https://commits.webkit.org/283565@main&gt;

Reviewed commits have been landed. Closing PR #33402 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>472419</attachid>
            <date>2024-09-03 08:07:26 -0700</date>
            <delta_ts>2024-09-03 08:07:26 -0700</delta_ts>
            <desc>index.html to illustrate the bug repro</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>891</size>
            <attacher>harnoor1994</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPSJlbiI+DQo8aGVhZD4NCiAgICA8bWV0YSBjaGFy
c2V0PSJVVEYtOCI+DQogICAgPGJhc2UgaHJlZj0iIyIgdGFyZ2V0PSJfYmxhbmsiIC8+DQogICAg
PHNjcmlwdD4NCiAgICAgICAgLy8gRnVuY3Rpb24gdG8gdXBkYXRlIHRoZSBhZGRyZXNzIGJhciB0
byB0aGUgZGVlcCBsaW5rDQogICAgICAgIGZ1bmN0aW9uIHVwZGF0ZVRvRGVlcExpbmsoKSB7DQog
ICAgICAgICAgICBjb25zdCB1cmwgPSB3aW5kb3cubG9jYXRpb24ub3JpZ2luICsgd2luZG93Lmxv
Y2F0aW9uLnBhdGhuYW1lICsgIiMvZGVlcGxpbms/dGVzdC1pZD02ZjVkNjFhZiI7DQogICAgICAg
ICAgICB3aW5kb3cuaGlzdG9yeS5yZXBsYWNlU3RhdGUoJycsICcnLCB1cmwpOw0KICAgICAgICB9
DQoNCiAgICAgICAgLy8gRnVuY3Rpb24gdG8gY2xlYXIgdGhlIGRlZXAgbGluayBhbmQgbmF2aWdh
dGUgYmFjayB0byB0aGUgZGVmYXVsdCByb3V0ZQ0KICAgICAgICBmdW5jdGlvbiBjbGVhckRlZXBM
aW5rKCkgew0KICAgICAgICAgICAgd2luZG93Lmhpc3RvcnkucmVwbGFjZVN0YXRlKCcnLCAnJywg
JycpOw0KICAgICAgICB9DQogICAgPC9zY3JpcHQ+DQo8L2hlYWQ+DQo8Ym9keT4NCiAgICA8aDE+
UmVkaXJlY3QgRXhhbXBsZTwvaDE+DQogICAgPHA+UmVkaXJlY3RpbmcgdG8gdGhlIGRlZmF1bHQg
cm91dGUuLi48L3A+DQoNCiAgICA8IS0tIEJ1dHRvbnMgdG8gY2hhbmdlIFVSTCAtLT4NCiAgICA8
YnV0dG9uIG9uY2xpY2s9InVwZGF0ZVRvRGVlcExpbmsoKSI+R28gdG8gRGVlcCBMaW5rPC9idXR0
b24+DQogICAgPGJ1dHRvbiBvbmNsaWNrPSJjbGVhckRlZXBMaW5rKCkiPkJhY2sgdG8gRGVmYXVs
dCBSb3V0ZTwvYnV0dG9uPg0KPC9ib2R5Pg0KPC9odG1sPg0K
</data>

          </attachment>
      

    </bug>

</bugzilla>