Open Bug 2063350 Opened 20 days ago Updated 20 days ago

Add an onUpdate callback to the live policy engine

Categories

(Enterprise Products :: Firefox, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: janika, Unassigned)

References

(Blocks 1 open bug)

Details

The live policy engine applies a changed policy by running onRemovewith the old params and then re-applying with the new ones (see _schedulePolicyUpdates). Callbacks are batched by timing across all policies — all onRemove first, then all "re-apply callbacks" — and each is invoked fire-and-forget (_runPoliciesCallbacks does not await them).

This "tear down, then rebuild" model keeps updates from leaving stale state, but the non-awaited invocation has two ordering consequences:

  • Anything both the old and new params impose is released by onRemove and re-imposed on re-apply. Usually that gap is sub-tick and unobservable, but when a policy re-imposes state asynchronously the gap yields to the event loop and becomes observable. E.g. ExtensionSettings.onRemove releases the per-extension uninstall-/disable-extension:<id> locks, and onBeforeUIStartup only re-imposes them after await AddonManager.getAllAddons().
  • Since onRemove isn't awaited, an async onRemove would have its post-await teardown run after the re-apply and clobber the new state. Not reachable today because all onRemove callbacks are synchronous. But it rests on an implicit, unenforced contract that onRemove must be synchronous (currently, nothing checks it).

Proposal: add an optional onUpdate(manager, oldParams, newParams) callback, called instead of onRemove on a policy update, letting the policy transition in place and never release shared state. Policies without it keep today's remove-then-reapply behavior.

Summary: Add an onUpdate callback to the live enterprise-policy engine for "atomic" policy updates → Add an onUpdate callback to the live enterprise-policy engine
Summary: Add an onUpdate callback to the live enterprise-policy engine → Add an onUpdate callback to the live policy engine
You need to log in before you can comment on or make changes to this bug.