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

Issue with "ServiceWorkerContainer.register()": may be advisable to check for an existing registration #7138

Open
robatwilliams opened this issue Jul 21, 2021 · 2 comments
Labels
area: Workers Content:WebAPI Web API docs effort: medium This task is a medium effort. help wanted If you know something about this topic, we would love your help!

Comments

@robatwilliams
Copy link

MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register

What information was incorrect, unhelpful, or incomplete?

I assumed (wrongly) from this that registering an already-registered worker would be a no-op. It turns out that it at least causes a network request for the worker, and that request doesn't go via the cache even if you have updateViaCache: 'all' (which makes sense). So regardless of your update mode, not checking for an existing registration will cause extra server load.

Specific section or headline?

You can call this method unconditionally from the controlled page. I.e., you don't need to first check whether there's an active registration.

What did you expect to see?

More detailed info about why I might want to check for an existing registration, even if I don't need to.

Did you test this? If so, how?

Yes, looking at request headers in Fiddler.

MDN Content page report details
@sideshowbarker sideshowbarker added 30 minute task Content:WebAPI Web API docs help wanted If you know something about this topic, we would love your help! labels Jul 21, 2021
@robatwilliams
Copy link
Author

@Rumyra Rumyra added needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. effort: medium This task is a medium effort. and removed 30 minute task labels Nov 25, 2021
@sideshowbarker sideshowbarker removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Workers Content:WebAPI Web API docs effort: medium This task is a medium effort. help wanted If you know something about this topic, we would love your help!
4 participants