Bug 196990

Summary: Parent window's `history.state` is set to `null` when `history.pushState` is called by a child iframe
Product: WebKit Reporter: Atticus White <contact>
Component: HistoryAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, ahmad.saleem792, beidson, brazauskasjustas+webkit, cdumez, webkit-bug-importer, wilander, youennf
Priority: P2 Keywords: BrowserCompat, InRadar, WPTImpact
Version: Safari 12   
Hardware: Mac   
OS: macOS 10.14   
URL: http://wpt.live/html/browsers/history/joint-session-history/joint-session-history-iframe-state.html
Attachments:
Description Flags
Reproducible script that can be ran on bugs.webkit.org
none
Sample output of reproducible steps none

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>