-
Notifications
You must be signed in to change notification settings - Fork 10
Refactor updating enterprise policies #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: enterprise-main
Are you sure you want to change the base?
Conversation
1rneh
commented
Jan 8, 2026
- Refactor updating remote policies
- Fix merging policies of a combined provider when remote policies are updated
| @@ -381,6 +482,8 @@ EnterprisePoliciesManager.prototype = { | |||
|
|
|||
| this._status = Ci.nsIEnterprisePolicies.UNINITIALIZED; | |||
| this._parsedPolicies = undefined; | |||
| this._provider = null; | |||
| this._topicsObserved = null; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Set()
| case "policies-startup": | ||
| // Before the first set of policy callbacks runs, we must | ||
| // initialize the service. | ||
| this._initialize(); | ||
| await this._initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't the callers need to know about this? They would assume things are already initialized when this returns, but it's not? So you'd get new race conditions?
| ); | ||
|
|
||
| if (!isValid) { | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause the policy to be removed because it doesn't go in parsedPolicies, unclear if that is what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I didn't change that behavior. But let's re-think this :)
We have two options when encountering invalid parameters:
- Policy is currently active: We can remove the policy or keep it active with unchanged parameters. I think I prefer the latter. It's seems more intentional. In both ways we can warn in the logs about invalid parameters.
- Policy is currently inactive: Do nothing.
| @@ -381,6 +482,8 @@ EnterprisePoliciesManager.prototype = { | |||
|
|
|||
| this._status = Ci.nsIEnterprisePolicies.UNINITIALIZED; | |||
| this._parsedPolicies = undefined; | |||
| this._provider = null; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can't actually do this unless we stop the RemotePoliciesProvider polling first, because that sends the Update message, and processing that assumes that _provider is non-null.