Re: [w3c/ServiceWorker] Add an option to include frozen documents. (#1442)

Restating my understanding of this issue:
- Per spec, currently frozen clients will be returned by matchAll.
  - As explicitly stated in the initiating comment, this is not desirable from a postMessage perspective because the tasks for the client are disabled and the message payloads will stack up, effectively leaking memory.  Depending on browser behavior, this may cause the client to be discarded more aggressively.  This is a similar issue to BroadcastChannel or use of MessageChannel, but those APIs don't have visibility into the state of the client.
  - Being able to see frozen clients is desirable for ServiceWorkers that handle push notifications and preferentially invoke Client.focus() instead of using Clients.openWindow() to avoid tab proliferation.
- This issue doesn't do anything to expose page-lifecyle "discarded" clients which could correspond to unloaded tabs (a mechanism that Firefox exposes to WebExtensions) or not-yet-loaded tabs (as Firefox's lazy session restore does).
  - The previously mentioned Client.focus()/Clients.openWindow() would like this.
- At the same time, this is explicitly exposing the concept of frozen pages to the spec.

It seems reasonable to me to filter out the frozen clients by default.  Given that this is also exposing a new concept, I think it would be desirable to either directly provide some non-normative guidance on the implications of frozen clients or link to some in the page-lifecycle not-yet-spec.

In particular, I think ServiceWorker authors would be interested in the not-immediately obvious fact that frozen clients won't process the message until unfrozen.  And it would be good to make clear what the expected outcome of spamming postMessage() at a frozen client is.  Is it a nefarious trick they can use to get their client unfrozen?  Or is it expected that such postMessage() calls will hasten the discarding of the client?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1442#issuecomment-511536136

Received on Monday, 15 July 2019 19:25:32 UTC