-
Notifications
You must be signed in to change notification settings - Fork 2.8k
What kind of new 'session' is created on manual navigation? #6356
Description
Some APIs and behaviours span across multiple session entries. But, if the page is navigated to a new entry by a means out of the current page's control (user enters something into the URL bar, selects a bookmark etc etc), which of these behaviours should continue across into the new page?
I'm going to refer to that type of navigation as "manual".
WindowProxy
window references
- PageA uses
window.open
to open PageB in a new session. - PageB's session is manually navigated to PageC.
Does PageA hold a reference to PageC?
Chrome: No if PageC is on a different origin to PageB, otherwise yes (unless PageC is cross origin isolated via COOP/COEP).
Firefox: Yes, unless PageC is cross origin isolated via COOP/COEP
Safari: Yes
Ideal behaviour: This was discussed in #5767 (comment), and consensus was that PageA should not hold a reference to PageC in the cross-origin case, and this should be achieved by creating a new BCG for PageC. Although, it isn't yet clear what should happen to the reference PageA has, or what should happen if PageC's session is navigated back to PageB. We didn't discuss the same-origin case.
history.back
and history.length
- PageA's session is manually navigated to PageB.
Can PageB navigate its session back to PageA using history.back
? Is history.length
greater than 1?
All browsers: Yes.
Ideal behaviour: ???
It feels like a minor security and privacy benefit to treat PageB as part of a new sub-session, that cannot observe or control history entries that came before it. Whether this differs if PageA and PageB are same-origin probably depends on what we do for the previous example.
Chrome already blocks history.back()
in some cases, eg when it's called from a sandboxed iframe and the navigation would happen outside the iframe. I guess even a navigation within the sandboxed iframe impacts history.state
in the parent, but we already know the history API is bad.
sessionStorage
- PageA has some session state.
- PageA's session is manually navigated to PageB.
- (if necessary) Use
location.href
to navigate back to PageA's origin.
Can the resulting page access the session state set in PageA?
All browsers: Yes.
Ideal behaviour: ???
It feels like the answer here should be the same as it is for history.back
.
Related: Session storage and changing browsing contexts.
cc @domenic since we've already been talking about this stuff
cc topic: navigation