Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle UA shutdown algorithm always invokes clear reg if we have installing worker #1063

Closed
aliams opened this issue Jan 24, 2017 · 2 comments

Comments

@aliams
Copy link
Contributor

aliams commented Jan 24, 2017

2.6 User Agent Shutdown states that:

  • An installing worker does not persist but discarded. If the installing worker was the only service worker for the service worker registration, the service worker registration is discarded.

In contrast, the User Agent Shutdown Algorithm states that:

  1. If registration's installing worker installingWorker is not null, then:
    1. If the result of running Get Newest Worker with registration is installingWorker, invoke Clear Registration with registration and continue to the next iteration of the loop.

According to the algorithm, when we call Get Newest Worker, we're always going to get the installingWorker. Step 1 checks if the registration's installing worker installingWorker is not null and the Get Newest Worker returns newestWorker which is going to be the registration's installing worker since the installing worker is not null.

This can be a problem since that means we are always invoking Clear Registration regardless if we have an installing worker (even if there's an active worker).

cc editors: @jungkees @jakearchibald

@jakearchibald
Copy link
Contributor

Ohhh haha yeah. I'm pretty sure that "Get Newest Worker" should be intending to get the oldest worker, as in the active worker. Is that right @jungkees?

Good catch!

@jungkees
Copy link
Collaborator

jungkees commented Apr 2, 2017

Yes, I think I intended "Get Oldest Worker" and if it's the installing worker. ;)

Thanks @aliams!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants