The shared web worker agent implementation still needs to do dead window detection (which in turn is needed to be able to unsubscribe to old subscriptions that no window is subscribing to anymore).
Not sure if there will be able to be a fast dead window detection path for windows that close cleanly, at least for the last window closing. Windows when closing can in response to the "unload" event record their demise in local storage but not in a transactional browser database (windows get no more ticks of the event loop when closing). But shared web workers don't have access to local storage, so we may need to rely exclusively on timeouts, which would be unfortunate if we make unnecessary subscriptions which are then quickly rescinded when the ping of the dead windows timesout.
On the other hand maybe the window instantiating the shared web worker could pass along the record of cleanly closed dead windows from local storage, or perhaps the shared web worker could avoid making subscriptions for windows until it had gotten a live ping from them.
The shared web worker agent implementation still needs to do dead window detection (which in turn is needed to be able to unsubscribe to old subscriptions that no window is subscribing to anymore).
Not sure if there will be able to be a fast dead window detection path for windows that close cleanly, at least for the last window closing. Windows when closing can in response to the "unload" event record their demise in local storage but not in a transactional browser database (windows get no more ticks of the event loop when closing). But shared web workers don't have access to local storage, so we may need to rely exclusively on timeouts, which would be unfortunate if we make unnecessary subscriptions which are then quickly rescinded when the ping of the dead windows timesout.
On the other hand maybe the window instantiating the shared web worker could pass along the record of cleanly closed dead windows from local storage, or perhaps the shared web worker could avoid making subscriptions for windows until it had gotten a live ping from them.