[w3c/ServiceWorker] Issues with "Handle Functional Event" (#1196)

Sorry for the vague title, I couldn't explain it briefly.

https://w3c.github.io/ServiceWorker/#handle-functional-event.

"Handle Functional Event" wants an `ExtendableEvent`, a registration, and some callback steps. These callback steps are run on the active service worker's event loop. However, I need to be on the service worker's event loop in order to create the `ExtendableEvent`.

Maybe the algorithm should take the event name instead of an `ExtendableEvent`, and we just expect other specs to call "Update Service Worker Extended Events Set" themselves.

Also, it feels like "Update Service Worker Extended Events Set" only needs to take an `ExtendableEvent`, since the active worker could be determined from the global the `ExtendableEvent` was created in.

So other specs would do:

1. [Handle a functional event](https://w3c.github.io/ServiceWorker/#handle-functional-event) for *registration* and `"eventName"` by running the following steps:
  1. Let *event* be a trusted event (…new event object).
  1. Dispatch *event* on the [current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object).
  1. [Update Service Worker Extended Events Set](https://w3c.github.io/ServiceWorker/#update-service-worker-extended-events-set) with *event*.

-- 
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/issues/1196

Received on Thursday, 21 September 2017 13:26:02 UTC