Bug 233420 - Window.location setter not adding new global history entry (session history works as expected)
Summary: Window.location setter not adding new global history entry (session history w...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: https://lapcatsoftware.com/articles/h...
Keywords: InRadar
: 233685 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-11-22 06:46 PST by Sam Sneddon [:gsnedders]
Modified: 2022-03-22 23:22 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2021-11-22 06:46:13 PST
<div>
<button id="mybutton1" type="button">
Change location
</button>
</div>

<script>
function MyClick1(event) {
  location = "https://underpassapp.com";
}
document.getElementById("mybutton1")
.addEventListener("click", MyClick1);
</script>

In Firefox and Chrome this creates a a new history item, in Safari this doesn't.

Perhaps https://wpt.fyi/results/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load?label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&q=location-setter, but likely we have some WPT coverage for this.
Comment 1 Radar WebKit Bug Importer 2021-11-29 06:47:26 PST
<rdar://problem/85814717>
Comment 2 Chris Dumez 2021-11-29 14:21:48 PST
I am unable to reproduce.

When I click the button, I see history.length increase by one and there is an option to go back in the Safari UI.
Comment 3 Chris Dumez 2021-11-29 14:24:45 PST
I see this was reported on macOS 10.13 High Sierra which is super old. I am on macOS 12.1 Monterey so this could be why I cannot reproduce.
Comment 4 Sam Sneddon [:gsnedders] 2021-11-30 04:23:14 PST
(In reply to Chris Dumez from comment #3)
> I see this was reported on macOS 10.13 High Sierra which is super old. I am
> on macOS 12.1 Monterey so this could be why I cannot reproduce.

The post says "This bug appears to be many years old: it occurs in the latest version 15.1, and it occurs in the oldest version that I could test, Safari 11 on macOS 10.13 High Sierra."

Certainly I can reproduce it on 12.0.1 (21A559), but I don't have 12.1 immediately to hand.
Comment 5 Chris Dumez 2021-12-01 07:48:40 PST
*** Bug 233685 has been marked as a duplicate of this bug. ***
Comment 6 Brady Eidson 2022-03-22 23:19:35 PDT
Chris I think you were testing the wrong thing.

This is about browser global history, not session history.
Comment 7 Brady Eidson 2022-03-22 23:20:22 PDT
This blog post that spawned the radar mentioned that, not sure why that wasn’t included in the report 

https://lapcatsoftware.com/articles/history.html
Comment 8 Brady Eidson 2022-03-22 23:22:08 PDT
And on that note, this may be WebKit not sending a sensible history delegate message to Safari, or it might be Safari mishandling it. Investigation will be needed.