Bug 227474

Summary: history pushState and replaceState do not work if iframe src changed
Product: WebKit Reporter: richy.liu.2002
Component: HistoryAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: achristensen, beidson, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac (Apple Silicon)   
OS: macOS 11   
Attachments:
Description Flags
minimal working example none

richy.liu.2002
Reported 2021-06-28 19:44:46 PDT
Created attachment 432448 [details] minimal working example Calling history.pushState or history.replaceState in an iframe whose src was changed has no effect. These functions do work correctly when the iframe's src was not changed, or if they are not in an iframe at all. Calling pushState after the iframe loads but before the pushState in the iframe is called seems to fix the issue. To reproduce the issue, unzip the attached zip which contains index.html and embed.html. Open index.html. It will load embed.html into an iframe. Open the console and click 'push history' under 'frame 2 (src change)'. See that history.length does not change. Then click 'push history' under 'frame 1 (no src change)'. See that history.length does change. Replicated on Safari 14.1.1, latest WebKit (r279353), and iOS Safari on iOS 14.6. Firefox and Chrome do not have this issue.
Attachments
minimal working example (867 bytes, application/zip)
2021-06-28 19:44 PDT, richy.liu.2002
no flags
Radar WebKit Bug Importer
Comment 1 2021-07-05 19:45:17 PDT
Note You need to log in before you can comment on or make changes to this bug.