Closed Bug 2045811 Opened 3 months ago Closed 1 month ago

Expand SitePolicies to cover service worker registration

Categories

(Enterprise Products :: Firefox, enhancement, P1)

enhancement

Tracking

(firefox156 verified)

VERIFIED FIXED
Tracking Status
firefox156 --- verified

People

(Reporter: bsmth, Assigned: mossop)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert, Whiteboard: [size=2])

User Story

As an admin, I want the SitePolicies policy to support a ServiceWorkers field, so that I can control whether matched sites are allowed to register service workers.

Acceptance criteria

- ServiceWorkers (boolean): Blocks service worker registration and background sync for the matched site. `false` = service workers are disabled.

Implementation notes:
- https://firefox-admin-docs.mozilla.org/reference/policies/sitepolicies/
- `dom.serviceWorkers.enabled` pref
- Consider whether existing service worker registrations for matched sites should be unregistered immediately when policy is applied or left stored but prevented from running. (It's likely we want the former).

Out of scope:
- New site-matching syntax; constraints reuse the existing SitePolicies site-matching mechanism.

Attachments

(1 file)

No description provided.
No longer blocks: firefox-client-mvp
Severity: -- → S2
Whiteboard: [size=2]
Assignee: nobody → dtownsend
Pushed by dtownsend@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/828679599427 https://hg.mozilla.org/integration/autoland/rev/9e0972a9d3fd Add a site policy to disable service workers. r=mkaply,dom-worker-reviewers,necko-reviewers,jesup,edenchuang
Regressions: 2064102
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED

Did you want to nominate this for the Fx156 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination

Possible wording:

The SitePolicies policy now supports DisableServiceWorkers, letting administrators block service worker registration on specific sites.

Flags: needinfo?(dtownsend)

What do you think Mike?

Flags: needinfo?(dtownsend) → needinfo?(mozilla)

In theory, but our product doesn't support the relnote-firefox flag. I'll keep track of it.

Flags: needinfo?(mozilla)

Release Note Request (optional, but appreciated)
[Why is this notable]: New policy features
[Affects Firefox for Android]: No
[Suggested wording]: The SitePolicies policy now supports DisableServiceWorkers, letting administrators block service worker registration on specific sites.
[Links (documentation, blog post, etc)]:

relnote-firefox: --- → ?

Thanks, added to the Fx156 nightly release notes, please allow 30 minutes for the site to update.

Perfherder has detected a browsertime performance change from push 9e0972a9d3fd21c38b866e7d0d2df2770dc589cb.

No action is required from the author; this comment is provided for informational purposes only.

Improvements Test Platform Options Absolute values [old vs new] Performance Profiles
42% twitter FirstVisualChange (doc) linux2404-64-shippable cold fission webrender 188.82 ms -> 109.95 ms Before/After
34% twitter FirstVisualChange (doc) linux2404-64-shippable bytecode-cached cold fission webrender 172.87 ms -> 113.44 ms Before/After
15% twitch FirstVisualChange (doc) linux2404-64-shippable cold fission webrender 104.18 ms -> 88.71 ms
10% twitter PerceptualSpeedIndex (doc) linux2404-64-shippable cold fission webrender 511.96 ms -> 460.41 ms Before/After
9% google-slides FirstVisualChange (doc) linux2404-64-shippable cold fission webrender 260.42 ms -> 235.77 ms Before/After
... ... ... ... ... ...
5% twitter fcp (doc) linux2404-64-shippable cold fission webrender 53.31 ms -> 50.53 ms Before/After

Need Help or Information?

If you have any questions, please reach out to fbilt@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert
Flags: qe-verify+
QA Contact: pmagyari

Verified fixed using 156.0 (20260910132224) on Win/MacOS/Ubuntu, disabling SWs on a website does not let it register new SWs and websites that already have one registered do not "start" up again after setting the policy (but they are still stored). SWs typically run for around 30 seconds. They aren’t stopped live by the policy; instead, the policy prevents them from starting up again.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

Thanks Peter. Do you mind clarifying:

SWs typically run for around 30 seconds. They aren’t stopped live by the policy; instead, the policy prevents them from starting up again.

Are running SWs stopped eventually or not?

Flags: needinfo?(pmagyari)

If you are active on the page, it does not stop. However, if you go idle for ~30 seconds, it stops and does not restart when you return to the website and browse around. (The SW is still stored but inactive)

Flags: needinfo?(pmagyari)
You need to log in before you can comment on or make changes to this bug.