tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 90c6b354ebd29d3668e457aa9387b10c3a8f97d6
parent 294d79d1999aa3b3f6002d859a2f831cc40258de
Author: Sandor Molnar <smolnar@mozilla.com>
Date:   Tue, 23 Dec 2025 11:17:19 +0200

Revert "Bug 1997846 - Check MOZ_NORMANDY also for Normandy.uninit. r=nimbus-reviewers,beth" for causing bc failures @ browser_Normandy.js

This reverts commit 357d6c65512c28b214878ee03fe27e7d009c8c60.

Revert "Bug 1997846 - Normandy.uninit should wait for init and not remove the UI_AVAILABLE_NOTIFICATION observer.  r=nimbus-reviewers,beth"

This reverts commit 22992649904587fd690db28ff42631b03c36feba.

Diffstat:
Mbrowser/components/BrowserComponents.manifest | 2--
Mtoolkit/components/normandy/Normandy.sys.mjs | 32+++++++++++---------------------
2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest @@ -95,9 +95,7 @@ category browser-quit-application-granted moz-src:///browser/components/places/I category browser-quit-application-granted moz-src:///browser/components/pagedata/PageDataService.sys.mjs PageDataService.uninit category browser-quit-application-granted resource://gre/modules/PageThumbs.sys.mjs PageThumbs.uninit category browser-quit-application-granted resource://gre/modules/NewTabUtils.sys.mjs NewTabUtils.uninit -#ifdef MOZ_NORMANDY category browser-quit-application-granted resource://normandy/Normandy.sys.mjs Normandy.uninit -#endif category browser-quit-application-granted resource://gre/modules/RFPHelper.sys.mjs RFPHelper.uninit category browser-quit-application-granted resource:///modules/asrouter/ASRouterNewTabHook.sys.mjs ASRouterNewTabHook.destroy category browser-quit-application-granted moz-src:///browser/components/search/SERPCategorization.sys.mjs SERPCategorization.uninit diff --git a/toolkit/components/normandy/Normandy.sys.mjs b/toolkit/components/normandy/Normandy.sys.mjs @@ -42,20 +42,12 @@ export var Normandy = { /** Initialization that needs to happen before the first paint on startup. */ async init({ runAsync = true } = {}) { - if (this.initFinished === undefined) { - this.initFinished = Promise.withResolvers(); - } else { - // We race with ourselves, this can happen only in tests. - if (!runAsync) { - // We are called sync only from tests, where we want to unblock the - // init immediately if it already started asynchronously. - this.observe(null, UI_AVAILABLE_NOTIFICATION); - } - await this.initFinished.promise; - return; - } - - // We need the UI_AVAILABLE_NOTIFICATION observer only if runAsync == true. + // NOTE: It looks like we can see us being called twice between init(true) + // coming from "browser-before-ui-startup" (see BrowserComponents.manifest) + // and init(false) coming from FirstStartup.sys.mjs. + // We need the UI_AVAILABLE_NOTIFICATION observer only if runAsync == true + // and we assume that the rest of the initialization can just happen twice. + // TODO: Check which pieces really need to run twice, if any. if (runAsync) { // It is important to register the listener for the UI before the first // await, to avoid missing it. @@ -86,7 +78,6 @@ export var Normandy = { } await this.finishInit(); - this.initFinished.resolve(); }, async observe(subject, topic) { @@ -152,11 +143,6 @@ export var Normandy = { }, async uninit() { - if (!this.initFinished) { - return; - } - await this.initFinished.promise; - await lazy.CleanupManager.cleanup(); // Note that Service.pref.removeObserver and Service.obs.removeObserver have // oppositely ordered parameters. @@ -165,7 +151,11 @@ export var Normandy = { lazy.LogManager.configure ); - delete this.initFinished; + try { + Services.obs.removeObserver(this, UI_AVAILABLE_NOTIFICATION); + } catch (e) { + // topic must have already been removed or never added + } }, /**