-
Notifications
You must be signed in to change notification settings - Fork 3k
Carry over sticky activation for same-origin navs and traversals #11454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
546d519
to
ad0e6b8
Compare
|
||
<p>This is <var>W</var>'s historical activation state, indicating whether the user has ever | ||
interacted in <var>W</var>. It starts false, then changes to true (and never changes back to | ||
false) when <var>W</var> gets the very first <span>activation notification</span>.</p> | ||
false) when <var>W</var> gets the very first <span>activation notification</span>. It is also | ||
carried over between windows for same-origin navigations and traversals.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is this quite right? If there is a bfcached page without sticky activation, I don't think the algorithms will set the flag on those window objects if another same origin window gets sticky activation. And I'm not sure what behavior we want there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that's a great catch! I think we should carry it over to same-origin bfcached documents too, to minimize differences between cases where the bfcache is hit vs. missed.
I'll add a line to the "reactivate" algorithm similar to the one I added to the "create and initialize a new Document" algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ended up being more annoying than I'd prefer, as threading things from the predecessor document to the new document seems to be surprisingly unusual. (In particular, if the browser plans to unload and destroy the previous document, we need to grab the state before it does that.)
I have a half-finished local branch with an alternate option, which, at the time we set sticky activation for one window, immediately tries to propagate it to all contiguous same-origin bfcached windows in the same navigable. But I realized that keeping track of "contiguous" would add a good amount of complexity (albeit only locally), and this probably would not be how implementations do it, so I stashed that.
Of course, there's a separate issue here where the whole user activation framework ignores the complexities of propagating the bit across processes, instead just letting people access the Window object from anywhere. That is fairly pervasive in the spec ecosystem though. (That is, although specs these days are relatively good about separating out processes, the rarer cases like this one where we need to propagate state so that it lives in multiple processes are all hand-waved. See w3c/ServiceWorker#1755 (comment) for more rambling.)
See discussion in WICG/view-transitions#239 and #11328 (comment).
This also includes an editorial update to define history-action user activation as a simple boolean, instead of using the timestamp infrastructure.
Points from our discussion and how this PR addresses them:
/cc @mustaqahmed @nickcoury
(See WHATWG Working Mode: Changes for more details.)
/document-lifecycle.html ( diff )
/interaction.html ( diff )