-
Notifications
You must be signed in to change notification settings - Fork 16
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
Reconcile with document lifecycle #4
Comments
An |
Alternatively, if a flag is requested that's owned by a CPU-suspended tab, we could just discard the suspended tab. |
SGTM. I'd even go for the harsher stance of: if you're holding a resource you don't even get suspended, you just get discarded. If you are holding resources and don't want to get discarded, well then you'd better release the resources during the event. |
From offline discussion: Some use cases (e.g. document editors), the intent would be that the lock is held for (almost) the lifetime of the tab, and re-acquiring (and initializing state) is comparable to reloading. So a vote for allowing suspended tabs to hold locks. |
Note that for SharedArrayBuffer we don't do anything special for these kind of documents: whatwg/html#2581. |
cc: @spanicker Consensus seems to be emerging in discussions that suspended tabs retain hold of the locks, presuming that the tab is given notification that it is about to be suspended. Locks should never be stolen/broken by the user agent when a tab is suspended. Any logic like "if tab is holding exclusive access to a resource, do not suspend that tab but discard it instead" would be up to the user agent (since suspend vs. discard is a UA-specific heuristic anyway). Seem reasonable? |
Also, re: the "...presuming that the tab is given notification..." bit - do we need to transitively guarantee that for workers/iframes? Presumably yes... |
Yes the tab is notified of suspension via the "onfreeze" callback. However if they can retain holding the lock then why does it matter that there is a callback? |
It's not necessary for the API to be consistent, but for a web app it allows a tab to relinquish the lock, e.g. so some other tab could be elected. For example, one tab is holding the "I get to sync app state to the network" lock, other tabs just delegate to it. If that tab gets "onfreeze" it can drop the lock so another tab can pick it up and network syncing continues. If we didn't have such an event then syncing would freeze. (And just "breaking" the lock would be bad because another tab would be elected, but when unfrozen both tabs would believe they can sync.) In other use cases, just holding the lock even while frozen is the right thing. |
Thanks for the context, that makes sense! |
Some browser implementations may want to put browsing contexts "to sleep" without terminating them. Do these retain the flag, or lose it? Is there a signal for "you thought you were holding the flag but nope" ?
See https://github.com/spanicker/web-lifecycle
The text was updated successfully, but these errors were encountered: