A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Install-less Service Workers: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
(Created page with "This is a proposal for allowing usage of service workers without installing them. This will be useful for APIs such as Push, and Background Sync. FetchEvent will not be disp...")
(No difference)

Revision as of 18:01, 14 July 2015

This is a proposal for allowing usage of service workers without installing them. This will be useful for APIs such as Push, and Background Sync. FetchEvent will not be dispatched to such service workers.

Changes to Service Workers

The RegistrationOptions dictionary would need to be extended like this:

dictionary RegistrationOptions {
  USVString scope;
  boolean install;
};

The Register algorithm would need to be modified around step 4.2 to treat install: false specially by not doing nothing when an existing worker has been installed for that scope (and maybe reusing it, that requires more thought) and skip running the Update algorithm.

Furthermore, the current definition of registrations heavily depends on the workers being installed, and we would need to perhaps have a parallel list of workers that have been registered in this new mode. We need to figure out how to treat the intersection of these two sets.

We can probably expose a new readonly boolean attribute on ServiceWorkerRegistration like installed to be able to return a ServiceWorkerRegistration object from register() for the install: false case that will have slightly different semantics (such as never having an installing and waiting worker, its update() method not doing anything, else) but this will have the nice property that the Push API hooks and the similar can work with both types of workers.