Closed Bug 1638097 Opened 4 years ago Closed 3 years ago

Ensure that service workers registration related to temporarily installed addons are not persisted across restarts

Categories

(WebExtensions :: General, task, P2)

task

Tracking

(firefox92 fixed)

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [mv3-m2])

Attachments

(2 files)

As a follow up to Bug 1609920:
once an extension is going to be able to register a service worker (either by declaring a background service worker in the manifest, or by registering it on their own using navigator.serviceWorker.register), we should make sure that the service worker registrations related to a temporarily installed extensions are not persisted across restarts.

Assignee: nobody → lgreco
Severity: -- → N/A
Status: NEW → ASSIGNED
Depends on: 1609920
Priority: -- → P2
Whiteboard: mv3:m3
Whiteboard: mv3:m3 → mv3:m3 [mv3-m3]

This patch adds a new temporarilyInstalled property to the WebExtensionPolicy object, set to
the value of the same property from a Extension.jsm perspective.

The new property is being introduced mainly to be used in a patch that follows to allow the
ServiceWorkerManager internals to access that from the C++ layer (but it may be also
become a useful knowledge for other C++ components in the future).

This patch include a small change to ServiceWorkerManager::StoreRegistration which does early exist
and not store the registration on disk if:

  • the principal is from a WebExtension
  • the addon is not enabled (or was already uninstalled) by the time we got to store the registration
  • the addon is temporarily installed

At the moment it should not happen, but if ServiceWorkerManager::StoreRegistration was reached too late
for some reason and the registration was meant to be stored, the service worker would still be registered
again when the addon is started again on the next browser startup and stored on disk if it was meant to.

Depends on D119529

Moving this issue from milestone 3 to milestone 2.

Whiteboard: mv3:m3 [mv3-m3] → [mv3-m2]
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/c5a37c27cf88
Add a temporarilyInstalled boolean property to WebExtensionPolicy. r=mixedpuppy
https://hg.mozilla.org/integration/autoland/rev/d25f05325516
ServiceWorkerManager should not store registration related to temporary addons. r=asuth
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: