-
Notifications
You must be signed in to change notification settings - Fork 312
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
How are unloaded tabs represented? #626
Comments
My take: I don't think asleep tabs should have an effect on the lifecycle within a registration. These tabs are going to reload anyway, having them reload with an updated version seems fine. Given that tab-management is pretty much a lost art in Android L, you'd very easily end up with old forgotten tabs preventing updates becoming active. Having asleep tabs show up in (I realise this is a bit Android-specific, so interested in hearing from other vendors) |
I believe the goal on fxos is for tabs to get killed on memory pressure and relaunch with some kind of persisted state. I think treating waking asleep tabs as a reload would work for that case as well. |
Even with Chrome on Android L, users still don't expect to see duplicate entries in their Recents (they can also disable Chrome Settings > "Merge tabs and apps" to go back to a traditional tab switcher, or use other browsers). So it's still better if webapps can reuse existing tabs, including asleep ones.
How about adding an The expectation would be that if you includeAsleep, you shouldn't postMessage to all the clients (as that is likely to cause excessive RAM usage, as well as CPU churn from reloading them all); I'm not sure if/how that API should enforce that. See also some earlier discussion on #414 (comment) |
How about we add a note in the spec to allow the browser to resurrect an asleep tab with a matching url, if That avoids the |
Two issues with that:
|
Yeah, you're right. An option on
|
Sounds good. Can we make Client.postMessage return a Promise instead of void, so we can communicate failure? |
We should. Noted in #609 (comment) |
Naming bikeshed: asleep? unloaded? evicted? frozen? |
Unloaded & evicted correctly suggest it's not simply suspended On Tue, 24 Feb 2015 17:46 John Mellor notifications@github.com wrote:
|
'unloaded' would clash with the back/forward cache definition. Can't think of anything better than 'evicted'. |
If the 'evicted' tab had child clients (workers, iframes), would these still exist but in an evicted state? This is getting messy :( |
To avoid having to standardize browsers' varying heuristics for restoring evicted tabs (e.g. restoring scroll/zoom and form data), I was thinking it would be simplest if calling So no, only the top-level frame would have an evicted WindowClient. |
Tracked in http://crbug.com/461413 but needs spec. |
How about: clients.matchAll({
includeEvicted: true
})
Thoughts? |
One question is how much it will help to expose the evicted client concept to devs. FWIW, it seems it's the UA that actually uses the evicted state information. That is, it's the UA that uses that state information to restore the tabs, to exclude those evicted tabs in the decision on their service worker's Activate (waiting -> active) process, etc. In the case we don't come up with compelling use cases/requirements, an option would be to define and use an internal slot, I think the decision hinges on whether devs really need it. |
@jakearchibald 's proposal seems really complicated. Do we have a solid use-case for it? |
@nikhilm the use-case is avoiding creating duplicate tabs when responding to notification clicks.
Evicted tabs aren't real SW clients, as they don't have an environment settings object etc, they're essentially placeholders. But developers should be able to awaken one of these rather than creating a new window to the same url. I put them into their own type since they're not a real client, and |
We'd also like developers to be able to set the title of tabs (both evicted and non-evicted) from a push message, since this is a popular way of letting users know that a tab has updated (and remains visible after e.g. toast notifications may have expired). For non-evicted tabs you can use postMessage for that, but for evicted tabs we'd need an API on (it might also be helpful to set the URL of evicted tabs, e.g. by exposing |
F2F: Making evicted tabs is a huge thing to add to the platform, and may lock browsers into a particular behaviour. clients.openWindow(url, {
reuseIfExistingClientMatches: /\/my-messaging-app\//
}); Something like the above could let us deal with this. |
F2F: or we could treat these dead tabs as uncontrolled clients, feels hacky though |
F2F: or could be vaguer… clients.openWindow(url, {
reuseExisting: true
}); |
In the dev mindset, an open tab (i.e. a tab which is in the tab panel, in case of Firefox OS, an app present in the app switcher) is a client. It does not matter if it is evicted, sleep or whatever, if it is listed I don't mind (and I don't know) what special treatments the browser is giving to them so I would make clients.matchAll({
state: 'evicted' // platform-dependent
}) |
F2F: Current consensus is not to add clients for these (we could later), but allow |
For TPAC:
|
Mobile browsers put tabs into an "asleep" state to save memory & battery as needed. If you focus the tab later, the page is reloaded, but may regain some state within form elements.
This behaviour is completely unspecified, but I think we should put some guidance in the SW spec for these pages.
Specifically:
clients.getAll()
?The text was updated successfully, but these errors were encountered: