Re: [whatwg/storage] Session storage and changing browsing contexts (#119)

Ignore the specifics of step 4 for now, I'm getting ahead of myself.

> Are the modifications performed by the pre-rendering page to sessionStorage discarded by the bottle transplant?

Yes, discarded, although some event may provide insight into which keys changed as a result of the transplant, and provide their old value.

So:

1. Main page has session storage `{ foo: 'bar', hello: 'world' }`.
1. Prerender created, which has a clone of session storage, so `{ foo: 'bar', hello: 'world' }`.
1. Main page sets 'username' to 'sarah' in session storage, so `{ foo: 'bar', hello: 'world', username: 'sarah' }`.
1. Prerender sets 'foo' to 'yo', and '123' to '456', so { foo: 'yo', hello: 'world', '123': '456' }`.

If prerender becomes the main page, it's session storage will be replaced with the main page's storage, and it gets an event that tells it:

- 'foo' changed, was 'yo'
- 'username' changed, was undefined
- '123' changed, was '456'

I don't know if this is a good idea yet, but I'm trying to get a sense for how complex it is vs making session storage 'work' across processes.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/storage/issues/119#issuecomment-784897334

Received on Wednesday, 24 February 2021 08:22:06 UTC