commit f3ed477ea7b778fec5c3a5a2ef504c45d92d709d
parent 7f5a20140882207e2795e0f1c314c04b749ae7e2
Author: Jens Stutte <jstutte@mozilla.com>
Date: Wed, 1 Oct 2025 07:28:06 +0000
Bug 1991122 - Clear the observer in the test-only SearchService.reset function. r=search-reviewers,scunnane
Differential Revision: https://phabricator.services.mozilla.com/D266377
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/toolkit/components/search/SearchService.sys.mjs b/toolkit/components/search/SearchService.sys.mjs
@@ -512,6 +512,10 @@ export class SearchService {
* Test only - reset SearchService data. Ideally this should be replaced
*/
reset() {
+ lazy.logConsole.debug("Resetting search service.");
+ if (this.#initializationStatus != "not initialized") {
+ Services.obs.removeObserver(this, lazy.Region.REGION_TOPIC);
+ }
this.#initializationStatus = "not initialized";
this.#initDeferredPromise = Promise.withResolvers();
this.#startupExtensions = new Set();
@@ -3668,10 +3672,10 @@ export class SearchService {
this._settings.removeObservers();
+ Services.obs.removeObserver(this, lazy.Region.REGION_TOPIC);
Services.obs.removeObserver(this, lazy.SearchUtils.TOPIC_ENGINE_MODIFIED);
Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
Services.obs.removeObserver(this, TOPIC_LOCALES_CHANGE);
- Services.obs.removeObserver(this, lazy.Region.REGION_TOPIC);
}
QueryInterface = ChromeUtils.generateQI([