Closed Bug 1755167 Opened 2 years ago Closed 2 years ago

registering serviceWorker fails when "Delete cookies and site data when Firefox is closed" is checked

Categories

(Core :: DOM: Service Workers, defect)

Firefox 96
defect

Tracking

()

RESOLVED DUPLICATE of bug 1552376

People

(Reporter: diafygi, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0

Steps to reproduce:

  1. Check the setting "Delete cookies and site data when Firefox is closed"

  2. 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

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.

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.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

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

Eden, would you agree this is a duplicate?

Flags: needinfo?(echuang)

Yes, it is a duplicate of bug 1552376 that its description mentioned the same situation.

Flags: needinfo?(echuang)
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: