Re: [w3c/manifest] Clarify ServiceWorkerRegistrationObject’s purpose (#800)

@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](https://storage.spec.whatwg.org/#persistence) 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 WICG/badging#55:

> Apparently, y'all discussed [multiple apps governed by a single SW] and decided that was a use case we want to discourage. I'm hesitant about this, since I don't think the Badge API is the right place to make a stand on this: if we really think that sites should not have multiple apps per SW (i.e., each app should have a SW at the same scope as the app scope), then we should officially (in the Manifest spec) state that this is expected, and not having a SW at the same scope as the manifest is deprecated, and future APIs may not support multiple apps per SW.

Maybe if we believe that, this is a good place to start: remove `scope` from [ServiceWorkerRegistrationObject](https://www.w3.org/TR/appmanifest/#the-serviceworkerregistrationobject-dictionary-and-its-members), and always use the manifest scope, so that we enforce the rule that a service worker formally linked to an app manifest has the same scope as that app.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/800#issuecomment-533394442

Received on Friday, 20 September 2019 03:54:52 UTC