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

Service worker ID - remove? #1076

Closed
jakearchibald opened this issue Feb 16, 2017 · 11 comments
Closed

Service worker ID - remove? #1076

jakearchibald opened this issue Feb 16, 2017 · 11 comments

Comments

@jakearchibald
Copy link
Contributor

https://w3c.github.io/ServiceWorker/#dfn-service-worker-id - we don't appear to use this. Does anyone? If not we should remove it.

@wanderview
Copy link
Member

We might use it internally, but its probably safe to remove from the spec.

@n8schloss
Copy link

This would actually be useful if we could expose it to developers. We need something like this to correctly track upgrades and it's useful to help installing worker not mess with activating workers. Right now we need to do some things to basically fake this, but it's slow so if the browser could just provide developers with the id that it already has that would make things a bit better for developers.

@wanderview
Copy link
Member

We used to have the id exposed but removed it in favor of ServiceWorker object equality, if I remember correctly.

@n8schloss
Copy link

Hmm, it'd be nice if we could bring it back. There are quite a few use cases that we have for it now. Similarly there's no clean way for a specific service worker to get it's own service worker object which would also make using the id much easier.

@wanderview
Copy link
Member

Kind of a tangent, but if we bring this back, it would be nice to align it with Client.id. It should be possible to reference a ServiceWorker global as a Client and ideally the id value would match ServiceWorker.id.

@jakearchibald
Copy link
Contributor Author

@wanderview that'd be a change from how client ID works now, as the ID wouldn't change between termination & running the next time.

@n8schloss I've generated version IDs using hashes before - https://jakearchibald.com/sw.js. Can you talk a little bit on how an ID is better than this?

@wanderview
Copy link
Member

@wanderview that'd be a change from how client ID works now, as the ID wouldn't change between termination & running the next time.

Right. Good point. Carry on.

@n8schloss
Copy link

@jakearchibald, that's our current hack here. It works fine, but like @wanderview said, there's an argument to be made that having it allows for a better level of consistency between SWs and Clients. Also, if the browser is already storing an ID like this it wouldn't be much more work to expose it?

Besides that, it really would be nice to have a way for a SW to get it's own ServiceWorker object so it can tell what state it's currently in. I'll file a separate issue for that though.

@jakearchibald
Copy link
Contributor Author

F2F: We can remove this - #1077 solves the use case.

@jakearchibald
Copy link
Contributor Author

TODO: remove from spec

@valioDOTch
Copy link

So there's no possibility to mention the service worker ID in log entries? :-(
My problem is, that I have lots of debug output for the SWs on the console and it's a rather difficult to identify which line was produced by which worker...

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

4 participants