Re: [w3c/ServiceWorker] Central algorithm for updating service worker state and registrations (#1416)

I've started going through the tests and looking at the event ordering and other assumptions.

* `activate-event-after-install-state-change.https`
    * Asserts `registration.active` is null once sw state becomes `installed` on new registration.
* `activation-after-registration.https`
    * Asserts `registration.installing.state` is `installing` on a new registration.
* `activation.https`
    * After worker becomes `installed`, it waits on `wait_for_activation_on_dummy_scope` then asserts `registration.waiting` is set. 
    * Asserts `registration.active` is a given worker once that worker's state is `activating`.
    * Asserts `active`, `waiting`, `installing` on a registration are null once the waiting worker's state becomes `redundant` on an unregistered registration.
    * `wait_for_activation_on_dummy_scope` shouldn't be needed with this PR, but maybe leave tests as they are?
* `active.https`
    * Asserts `registration.active.state` is `activating` once `registration.installing`'s state becomes `activating`.
* `claim-affect-other-registration.https`
    * Once `registration.installing` becomes state `activated`, asserts `.installing` and `.waiting` are null, and `.active` is the worker that was previously `registration.installing`.
    * `registration.installing` is set when calling `register` with an existing scope but new url & the promise resolves.
    * Once `registration.installing` becomes state `installed`, asserts `.waiting` is the worker that was previously `registration.installing`.
    * Once `registration.waiting` becomes state `activated`, asserts `.active` is the worker that was previously `registration.waiting`, and old `.active` worker is now state `redundant`.

I'm now as far as `indexeddb.https` and haven't encountered anything new/different. I imagine most of the stuff will be in the registration tests.

The main thing to note is that `registration` is expected to be updated by the time the state change event fires on one of the workers.

I'll press on tomorrow.

-- 
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/pull/1416#issuecomment-499102558

Received on Wednesday, 5 June 2019 14:18:18 UTC