[ServiceWorker] "Wait for all the tasks queued by Update State" language is problematic (#848)

The end of the "Install" algorithm contains this step:

> 21) Wait for all the tasks queued by Update State invoked in this algorithm have executed. 

Note that "Update State" says this about the tasks:

> The task must use serviceWorker’s service worker client’s responsible event loop and the DOM manipulation task source.

So these tasks may be running on different threads from the "Install" algorithm itself.

Implementing the "Wait for all the tasks" language in step 21 is essentially saying to block the main thread until, for example, a task queued against a worker thread has fired.  I don't think we want to do this.

The reason this was added was to ensure that state change events fire before we start activating the worker.

I propose that instead of the "wait for all tasks" language we instead just make Activate run asynchronously.  If we "queue a task to run the Activate algorithm" then it should begin activating after any same-thread state change events have fired.

We may need to make Activate a job type, though, to avoid having the async Activate race with other jobs.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/848

Received on Tuesday, 15 March 2016 21:05:47 UTC