registering serviceWorker fails when "Delete cookies and site data when Firefox is closed" is checked
Categories
(Core :: DOM: Service Workers, defect)
Tracking
()
People
(Reporter: diafygi, Unassigned)
Details
Attachments
(1 file)
520 bytes,
application/zip
|
Details |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0
Steps to reproduce:
-
Check the setting "Delete cookies and site data when Firefox is closed"
-
Try to register a serviceWorker
navigator.serviceWorker.register("sw.js", { scope: './' })
.then((sw) => console.log("file success!", sw))
.catch((err) => console.log("file error!", err));
Actual results:
The service worker registration fails with the error:
"DOMException: The operation is insecure."
Additionally, the console has the output:
"Failed to register/update a ServiceWorker for scope ‘http://localhost:8000/’: Storage access is restricted in this context due to user settings or private browsing mode."
Expected results:
The service worker should succeed in loading.
NOTE: as requested in a previous bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1429714#c19), I am filing a new bug
Reporter | ||
Comment 1•3 years ago
|
||
Attached is a proof of concept that can reproduce this issue. Extract and serve locally (e.g. "python -m http.server").
When "Delete cookies and site data when Firefox is closed" setting is checked, will throw an error when registering the service worker.
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Service Workers' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•3 years ago
|
||
Hi Daniel
Thsis looks like a duplicate of Bug 1552376 shared + service workers throw a SecurityError when cookie lifetime policy = 2
- note: shared workers no longer does that
- this is because the cookies are session only
This will be fixed with
- normal window mode - bug 1681493 Deprecate and remove network.cookie.lifetimePolicy
- this is well under way
PB mode - bug 1320796 - Support ServiceWorkers in Private Browsing Mode
- this is a bit different due to not touching disk and clearing memory: i.e I don't think cookies are set as session only - the sanitizing is handled differently, and SW (and SW cache and IDB implementation) in PB mode probably is more involved
Comment 5•3 years ago
|
||
Yes, it is a duplicate of bug 1552376 that its description mentioned the same situation.
Updated•3 years ago
|
Description
•