Re: [ServiceWorker] Soft Update and Register can race when setting registration scriptURL (#789)

Actually, the whole `registering script URL` setup is racy and should probably be changed.

Algorithms like Register, Soft Update, and Update all do:

> Set registration's registering script url to X

Where X is either the register() script URL or the newestWorker's script URL.  After running this step these algorithms all then invoke Update.

This is a problem because Update uses a queue to perform operations.  So the actual work is often (usually) done asynchronously from where the script URL is set up.  This means the work performed by the Update can easily operate on the wrong registering script URL.

I think the registering script URL should really be an argument to Update.  The source of current truth for the registration's script URL should be the newestWorker.scriptURL.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/789#issuecomment-158824120

Received on Monday, 23 November 2015 01:00:16 UTC