Bug 227474 - history pushState and replaceState do not work if iframe src changed
Summary: history pushState and replaceState do not work if iframe src changed
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: Safari 14
Hardware: Mac (Apple Silicon) macOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-28 19:44 PDT by richy.liu.2002
Modified: 2021-07-05 19:45 PDT (History)
3 users (show)

See Also:


Attachments
minimal working example (867 bytes, application/zip)
2021-06-28 19:44 PDT, richy.liu.2002
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description richy.liu.2002 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.
Comment 1 Radar WebKit Bug Importer 2021-07-05 19:45:17 PDT
<rdar://problem/80190653>