tor-browser

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

commit 8fc953f86aa027f42788918f1af69a1640f2b750
parent 2b872d834fea14474f8a17c4b5ff4b04f7eaa6fe
Author: Jens Stutte <jstutte@mozilla.com>
Date:   Thu, 16 Oct 2025 14:59:04 +0000

Bug 1992670 - RecommendationProvider.enable should register the "idle-daily" observer only once. r=home-newtab-reviewers,thecount

Differential Revision: https://phabricator.services.mozilla.com/D267559

Diffstat:
Mbrowser/extensions/newtab/lib/RecommendationProvider.sys.mjs | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/browser/extensions/newtab/lib/RecommendationProvider.sys.mjs b/browser/extensions/newtab/lib/RecommendationProvider.sys.mjs @@ -61,8 +61,10 @@ export class RecommendationProvider { async enable(isStartup) { await this.loadPersonalizationScoresCache(isStartup); - Services.obs.addObserver(this, "idle-daily"); - this.loaded = true; + if (!this.loaded) { + this.loaded = true; + Services.obs.addObserver(this, "idle-daily"); + } this.store.dispatch( ac.BroadcastToContent({ type: at.DISCOVERY_STREAM_PERSONALIZATION_UPDATED, @@ -225,9 +227,9 @@ export class RecommendationProvider { this.provider.teardown(); } if (this.loaded) { + this.loaded = false; Services.obs.removeObserver(this, "idle-daily"); } - this.loaded = false; } async resetState() {