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

navigator.serviceWorker.ready remain resolved after unregister #1139

Closed
toxic-johann opened this issue May 13, 2017 · 5 comments
Closed

navigator.serviceWorker.ready remain resolved after unregister #1139

toxic-johann opened this issue May 13, 2017 · 5 comments

Comments

@toxic-johann
Copy link

navigator.serviceWorker.ready will be resolved when worker is active.
but if we unregister the worker, the ready attribute remain resolved.
In the document, it has not specified that the ready attribute will be reset.
Will it be strange ?

@jungkees
Copy link
Collaborator

Once a client gets a controller, it's being controlled until the client is unloaded/terminated. Calling unregister() sets the uninstalling flag, but it tries to clear the registration only when all the controlled clients are closed. That said, I don't think we should reset the ready promise on an unregister attempt.

@wanderview
Copy link
Member

Note, it is possible to use the .ready flag and not become controlled. Consider a window that is already open before .register() is called. So its possible for the service worker to go away with a ready promise settled.

@toxic-johann
Copy link
Author

@wanderview Yes. I agree with that. So maybe controllerchange event is much better in that situation?
@jungkees Thanks for your explanation. Now i understand what it means.

@wanderview
Copy link
Member

@toxic-johann Yea, I think writing a helper that uses .controller and controllerchange event will be much more reliable if this situation can realistically occur for you.

@toxic-johann
Copy link
Author

Thanks a lot~

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

No branches or pull requests

3 participants