Bug 196990 - Parent window's `history.state` is set to `null` when `history.pushState` is called by a child iframe
Summary: Parent window's `history.state` is set to `null` when `history.pushState` is ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL: http://wpt.live/html/browsers/history...
Keywords: BrowserCompat, InRadar, WPTImpact
: 196989 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-16 15:09 PDT by Atticus White
Modified: 2024-01-24 20:48 PST (History)
8 users (show)

See Also:


Attachments
Reproducible script that can be ran on bugs.webkit.org (973 bytes, text/javascript)
2019-04-16 15:09 PDT, Atticus White
no flags Details
Sample output of reproducible steps (271.92 KB, image/png)
2019-04-16 15:10 PDT, Atticus White
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Atticus White 2019-04-16 15:09:59 PDT
Created attachment 367579 [details]
Reproducible script that can be ran on bugs.webkit.org

What happened:
When an `iframe` calls `window.history.pushState`, the parent window's `window.history.state` becomes replaced with a `null` value.


Expected behavior:
The top page's `history.state` should remain untouched.


Steps to reproduce:
1. Give the top page a `history.state` value (eg, call `window.history.pushState({something}, 'something')`)
2. In an iframe, perform `window.history.pushState(...)`
3. In the top page, observe that `history.state` has become set to `null`

Attached is a minimal working example of the problem that can be ran in the JS console on `bugs.webkit.org`
Comment 1 Atticus White 2019-04-16 15:10:51 PDT
Created attachment 367580 [details]
Sample output of reproducible steps

Attached example output of the reproducible script being ran on Safari (undesired result) and Chrome (desired result)
Comment 2 Atticus White 2019-04-16 15:11:37 PDT
*** Bug 196989 has been marked as a duplicate of this bug. ***
Comment 3 Justas Brazauskas 2019-04-16 23:01:52 PDT
Additionally, a test case was submitted to https://github.com/web-platform-tests/wpt/pull/16381, which can also be used to reproduce this case.

Additionally, it appears that this is also the behavior in Safari TP release 79.
Comment 4 Radar WebKit Bug Importer 2019-04-18 10:00:05 PDT
<rdar://problem/50019069>