commit 09ad051d3e7365ec031645631444afbf51d888ea
parent 5e152e7f12f7ad8619a38ea138c00643bc0af8aa
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Mon, 17 Nov 2025 06:27:53 +0000
Bug 2000496. Cleanup SpecialPowersParent.flushPrefEnv and popPrefEnv. r=emilio
popPrefEnv doesn't do anything async, and we are not awaiting it either, so don't make it async.
This meant that |this.popPrefEnv().requiresRefresh| is a bug in that is tries to get requiresRefresh on the promise that popPrefEnv was returning (which didn't exist).
And then make sure to turn requiresRefresh back into a boolean instead of a number. I don't think this caused any problems but for consistency.
Differential Revision: https://phabricator.services.mozilla.com/D272829
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testing/specialpowers/content/SpecialPowersParent.sys.mjs b/testing/specialpowers/content/SpecialPowersParent.sys.mjs
@@ -541,7 +541,7 @@ export class SpecialPowersParent extends JSWindowActorParent {
});
}
- async popPrefEnv() {
+ popPrefEnv() {
return doPrefEnvOp(() => {
let env = prefUndoStack.pop();
if (env) {
@@ -555,8 +555,12 @@ export class SpecialPowersParent extends JSWindowActorParent {
flushPrefEnv() {
let requiresRefresh = false;
while (prefUndoStack.length) {
+ // bitwise |= (and not logical ||=) so that we always call popPrefEnv and
+ // don't lazily evaluate.
requiresRefresh |= this.popPrefEnv().requiresRefresh;
}
+ // Make requiresRefresh a boolean from number.
+ requiresRefresh = !!requiresRefresh;
return { requiresRefresh };
}