-
Notifications
You must be signed in to change notification settings - Fork 162
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
Clarify ServiceWorkerRegistrationObject’s purpose #800
Comments
Talked to @marcoscaceres and this appears to be a request in terms of syncing apps that never really materialized. No one appears to implement this and there are other ways to get around it and initialize a Service Worker, so we should seriously consider removing it from the spec as unnecessarily complex. Any objections? |
This was requested by Microsoft so that apps being installed from the Microsoft Store could install the service worker and populate cache while being installed but without needing the user to access the site. Basically today you would be able to install, then go offline and when opening the app it wont work. I don't know whether this was ever implemented but it does make sense for Web Packaging as well. |
@raymeskhoury @jakearchibald and I discussed this yesterday. I think it would be good for just establishing an invariant that if the manifest is installed, the service worker is guaranteed to be installed too, which is established declaratively by it being mentioned in the manifest. The current mechanism for registering a SW isn't really tying it to the app at all, it just happens to be two technologies that work together. So if the SW is removed due to storage pressure, the app breaks, and there isn't really any mechanism saying "no wait, this SW is more important to me because it's tied to an app". @jakearchibald also suggested that we could automatically apply persistent storage to origins that have apps installed. But I really like the idea of formally linking an app to its SW. I don't think this was ever implemented in any browser, but I'm in favour of a renewed push to implement, rather than removing this. Since it hasn't been implemented, we could change it if necessary. Also, based on what I wrote in w3c/badging#55:
Maybe if we believe that, this is a good place to start: remove |
That makes total sense.
I’m not averse to that as long as we document the purpose of the member (and how it should be considered by a UA) better within the spec.
+1 to that. On the shared SW issue, my opposition was more to having one app within another (e..g., one with a scope of |
This would mean that we can’t replicate all possible Service Worker configurations in the manifest, which might break the requirement:
Also, as there can be more than one service worker script under a manifest scope, shouldn’t |
Yeah... I don't like that story either but it's very hard to avoid. A store listing can simply prevent you from listing two apps that are nested inside one another. But a browser can't know about the other manifest. We've talked (on Chrome) about simply preventing the user from installing either an app scoped inside another already-installed app, or scoped outside an already-installed app. But we can't error either of those apps without seeing the other manifest. Basically, not something we explicitly want to support, but not a condition we can detect either.
What requirement?
I similarly don't really think we should be supporting multiple SWs per app. Ideally, we would have a 1:1 mapping from apps to SWs. The reason multiple SWs per app is bad, well there are two configurations:
If large sites require this, we could consider it later, but the initial version of |
The ability to download/sync a PWA from the store and have it offline-capable right off the bat (without ever opening it). |
Had a chat with @marcoscaceres . I think there's a general feeling of, yeah, it might have some nice properties like declaratively linking a SW to a manifest, being able to sync and pre-install apps without loading a document to register a SW, but there's a lot of implementation complexity in registering a service worker through this out-of-band channel. Maybe we get back around to this in the future, but for now, since nobody has implemented it (and it's way out of date), let's just take it out of the spec. |
@mgiuca @aarongustafson . With EdgeHTML packages we had this idea of "precaching", in which an app that was downloaded form the store would silently load the initial page to prime the cache at install time. This was to avoid the initial page load experience. I know a few Microsoft "productivity" apps that used it, but it wasn't often used. We suggested the change to registration object so we could put that same type of experience in place with the more logical service worker cache calls. |
I think this applies generally to service workers. |
It’s not entirely clear what the ServiceWorkerRegistrationObject does or what it intends to do. It would be good to extrapolate with the use case(s), etc. For instance, is this for store packaging? Any other reasons? It would be good to have some detail in the spec.
Related: What’s the implementation story on this?
The text was updated successfully, but these errors were encountered: