WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
263635
window.history.replaceState('', '', '') has no effect in Safari on macOS
https://bugs.webkit.org/show_bug.cgi?id=263635
Summary
window.history.replaceState('', '', '') has no effect in Safari on macOS
harnoor1994
Reported
2023-10-24 23:50:03 PDT
window.history.replaceState('', '', '') 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.
Attachments
index.html to illustrate the bug repro
(891 bytes, text/html)
2024-09-03 08:07 PDT
,
harnoor1994
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2023-10-25 16:13:19 PDT
Can you share test case to reproduce the issue? Plus whether it is reproducible on latest Safari Technology Preview 181?
Radar WebKit Bug Importer
Comment 2
2023-10-31 23:50:15 PDT
<
rdar://problem/117782346
>
harnoor1994
Comment 3
2023-11-01 10:33:37 PDT
Yes it is reproducible on Safari Technology Preview 181. I am working on test cases. Thanks!
sideshowbarker
Comment 4
2023-11-01 22:12:25 PDT
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('', '', '')` 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
harnoor1994
Comment 5
2024-09-03 08:07:26 PDT
Created
attachment 472419
[details]
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 "Go to Deep Link" should update the URL with the fragment (#/deeplink?test-id=6f5d61af). 2. Clicking "Back to Default Route" 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.
Byungseon(Sun) Shin
Comment 6
2024-09-04 15:15:41 PDT
Add the attached TC on W3C:
https://github.com/web-platform-tests/wpt/pull/47973
Byungseon(Sun) Shin
Comment 7
2024-09-04 15:18:27 PDT
Tested on STP #202, confirmed that it has been fixed.
Domenic Denicola
Comment 8
2024-09-04 23:30:09 PDT
This fix appears to contradict the spec, per
https://html.spec.whatwg.org/#shared-history-push/replace-state-steps
step 6.
Byungseon(Sun) Shin
Comment 9
2024-09-06 08:51:04 PDT
@Domenic, the changes made on <
https://bugs.webkit.org/show_bug.cgi?id=276375
> patched by
Byungseon(Sun) Shin
Comment 10
2024-09-06 08:52:09 PDT
@Domenic, the changes made on <
https://bugs.webkit.org/show_bug.cgi?id=276375
> patched by Patrick Griffis. I think we have to go back the the patch and see what is the right path for the issue.
Patrick Griffis
Comment 11
2024-09-10 07:28:50 PDT
I can look into this but is there no test case? web-platform-tests/html/browsers/history/the-history-interface/history_replacestate.html PASSes.
> Expected Behavior: > 1. Clicking "Go to Deep Link" should update the URL with the fragment (#/deeplink?test-id=6f5d61af). > 2. Clicking "Back to Default Route" 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.
Patrick Griffis
Comment 12
2024-09-10 08:36:23 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/33402
Patrick Griffis
Comment 13
2024-09-10 08:37:53 PDT
If I understand correctly, not updating the URL is correct per the spec. Firefox matched this, Chrome 127.0.6533.99 did not. I've submitted a draft PR above. Does this sound right Domenic?
Patrick Griffis
Comment 14
2024-09-10 08:46:53 PDT
> is there no test case?
WebKit didn't have html/browsers/history/the-history-interface/pushstate-replacestate-empty-string/ imported so that makes sense. With my PR all tests pass.
EWS
Comment 15
2024-09-12 10:03:43 PDT
Committed
283565@main
(ba51e8eae852): <
https://commits.webkit.org/283565@main
> Reviewed commits have been landed. Closing PR #33402 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug