commit 2bfe32c8f3e18414164c2631e61464ade983fb05
parent f218375f33921491641c604b1b28454df6434da1
Author: Jens Stutte <jstutte@mozilla.com>
Date: Thu, 2 Oct 2025 15:00:35 +0000
Bug 1991836 - Avoid double registration of AMTelemetry observers in test_blocklist_statechange_telemetry.update_softblocked_to_hardblocked. r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D266960
Diffstat:
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/toolkit/mozapps/extensions/AddonManager.sys.mjs b/toolkit/mozapps/extensions/AddonManager.sys.mjs
@@ -5043,6 +5043,7 @@ export class EnvironmentAddonBuilder {
AddonManager.removeAddonListener(this);
if (this._gmpProviderObserverAdded) {
Services.obs.removeObserver(this, GMP_PROVIDER_REGISTERED_TOPIC);
+ this._gmpProviderObserverAdded = false;
}
}
@@ -5342,6 +5343,7 @@ AMTelemetry = {
// NOTE: used by AddonTestUtils.promiseShutdownManager to ensure
// we can initialize it again in AddonTestUtils.promiseStartupManager.
+ // Also used by test_blocklist_statechange_telemetry.js.
async uninit() {
if (!this.telemetrySetupDone) {
return;
diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js
@@ -748,7 +748,7 @@ add_task(async function update_softblocked_to_unblocked() {
add_task(async function update_softblocked_to_hardblocked() {
// Re-initialize AMTelemetry to make sure it is listening to the AOM
// addon events onEnabled.
- AMTelemetry.telemetrySetupDone = false;
+ await AMTelemetry.uninit();
AMTelemetry.onStartup();
Services.fog.testResetFOG();