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

Consider the following sequence of events.

1) .register('script1.js') succeeds and resolves
2) iframe within scope is created and becomes controlled by script1.js
3) navigation triggered soft update is queued to run after document loads
4) .register('script2.js') is called which sets registration's script URL to script2.js and queues an update to run

There is now a race between:

* The navigation soft update running and setting registration scriptURL to the newest worker's script URL (step 6 of soft update)
* The register's update running

If the navigation soft update triggers prior to the register's update job getting popped from the queue then the registrations scriptURL is reset to script1.js.

Why does soft update reset the registration's script URL?  It seems using the current registration script URL is probably what we want.  This is the solution I am going to implement in gecko for now.

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

Received on Sunday, 22 November 2015 19:45:11 UTC