-
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
is the browser required to start the ServiceWorker for postMessage() if there is no message event handler? #1200
Comments
I think we should do it for all events. https://w3c.github.io/ServiceWorker/#handle-functional-event-algorithm covers it for "functional events", but "message" isn't one of those. We should be consistent here. |
Hmm, I didn't realize this mechanism had been expanded beyond FetchEvent. Does chrome do this for other events yet? |
Not sure about implementation. I'm looking at changing that functional event algorithm btw, but not that particular behaviour #1199 |
I just thought making event handlers observable at all was contentious so we limited it to fetch. |
I don't have strong feelings here. Happy to make it just fetch. |
Chrome just does the optimization for fetch currently. |
Action: We should make this behaviour optional in the spec, but allow it for any top level event, including |
Action: As before. Make it a may. |
Addressed in #1417 |
At whatwg/dom#653 @annevk argues it should be limited to fetch or should be a must rather than a may. |
Consider this code:
Is the browser required to start the service worker if its not running and a postMessage() is fired at while there is no message event handler? Worker startup is observable thanks to things like BroadcastChannel or Clients API.
Or can the browser do similar optimizations like we do for FetchEvent where we don't start the worker if there is no message handler?
The text was updated successfully, but these errors were encountered: