Open Bug 1304382 Opened 8 years ago Updated 2 years ago

unregister service workers if cookies are blocked for an origin

Categories

(Core :: DOM: Service Workers, defect, P3)

defect

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Currently we disable things like storage if cookies are blocked for an origin.  We should also disable and revoke service worker registrations in this case.

Consider this failure mode:

1) Visit a site with a service worker like https://blog.wanderview.com
2) Open Options->Privacy and set History to "Use custom settings for history".  Then click on "Exceptions" for cookies and add a block for the site used in step (1).
3) Wait at least 30 seconds from step 1 so the original service worker exits.
4) Reload the page in step 1.
5) Observe that you get a Corrupted Content page.  The web console shows "Failed to load ‘https://blog.wanderview.com/’. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘TypeError: cache is undefined’."

This is happening because we block storage like Cache API when cookies are disabled.  So the service worker script hits a bunch of errors it does not expect.  We should really disable the service worker completely in this case, though, so that the site continues to work.
Priority: -- → P3
Depends on: 1183245
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.