-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
User activation: what should happen if there is no browsing context? #8378
Comments
User activation is tied to a Window, not a browsing context, so I think the current spec has fully defined behavior here. I.e. user activation is retained even after removing the iframe or bfcaching a top-level document. For the bfcache case, I think this was resolved in #6588 that the current behavior is what we want. So for example, having sticky activation persists across being bfcached, and if you happen to go into and out of bfcache during the transient activation duration somehow, you can still use the guarded API. For the iframe case, I guess I'm unsure if we should change anything. Unlike bfcached top-level /cc @mustaqahmed @rakina |
I think a detached I don't know if some navigation-related algorithm already handles this state reset. |
That's not possible; different origins have different |
I was mostly just unsure what should happen (i.e., if it would reset). I guess the "protection" is for a hypothetical situation whereby an API does not check if it's fully active, but checks if has transient activation. Not checking for the fully active state would like be a bug, but it could definitely happen. I'd be ok to stay silent in HTML around this for the reasons @domenic gave (added complexity, etc.). I was just really looking for clarification. Should I add a WPTest for this, just for completeness? |
A WPT is definitely good to have! |
Ok, got around to creating the test... web-platform-tests/wpt#36684 Um... Chrome resets the values which seems to imply that transient activation in Chrome might be tied to the browsing context and not the window? |
Looks like so...we have the state stored in |
I just approved the PR because it matches the spec text. But I think the spec should require deactivating the user activation state when a Thanks for spotting this! For records, this comment from @annevk seems related: WICG/capability-delegation#22 |
It's not possible to re-attach a window after it's detached. Re-inserting the iframe creates a new |
While implementing the UserActivation interface in WebKit we ran into a case where there may be a spec issue (or maybe undefined behavior): it's unclear what should be returned if transient activation is acquired by a document, but then the browsing context is destroyed. Similarly, I guess, with sticky activation (i.e., would it reset?... probably not, but unsure).
Consider the simple case (assume top-level is "about:blank"):
If an API has not been specified to check if a document is fully active (or has a browsing context), then it might be possible to invoke that API from a non-fully active document.
As a protection, I wonder if HTML should consume the transient activation when a document becomes non-fully active?
The text was updated successfully, but these errors were encountered: