commit 0145ca6352ac87db8ab26a8d181c71e6f8d2eda4
parent 1eb9782fe0cbb84c7d0ca685a428145f4946d3a6
Author: Jens Stutte <jstutte@mozilla.com>
Date: Mon, 20 Oct 2025 16:19:41 +0000
Bug 1991067 - browser_proton_toolbar_hide_toolbarbuttons.testNullSavedState should not re-add "browser-set-toolbar-visibility". r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D267037
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/browser/components/customizableui/test/browser_proton_toolbar_hide_toolbarbuttons.js b/browser/components/customizableui/test/browser_proton_toolbar_hide_toolbarbuttons.js
@@ -191,6 +191,12 @@ add_task(async function testNullSavedState() {
let CustomizableUIInternal = CustomizableUI.getTestOnlyInternalProp(
"CustomizableUIInternal"
);
+ // Calling initialize() wants to add this observer again.
+ // TODO: Having a test-only testReset() method could avoid this hack.
+ Services.obs.removeObserver(
+ CustomizableUIInternal,
+ "browser-set-toolbar-visibility"
+ );
CustomizableUIInternal.initialize();
Assert.greaterOrEqual(
@@ -224,7 +230,12 @@ add_task(async function testNullSavedState() {
// Cleanup
CustomizableUI.setTestOnlyInternalProp("gSavedState", oldState);
await SpecialPowers.popPrefEnv();
+
// Re-initialize to prevent future test failures
+ Services.obs.removeObserver(
+ CustomizableUIInternal,
+ "browser-set-toolbar-visibility"
+ );
CustomizableUIInternal.initialize();
});