commit 2e8c6cf4391150ca70a4e7a095a0be80b116c9e3 parent b82ab024e668b6248e1e5628c89b29960cce53f1 Author: Jens Stutte <jstutte@mozilla.com> Date: Wed, 1 Oct 2025 16:55:57 +0000 Bug 1991839 - StorageActivityService::TestOnlyReset needs to remove the observer to match mActivities' state. r=dom-storage-reviewers,janv,hsingh Differential Revision: https://phabricator.services.mozilla.com/D267017 Diffstat:
| M | dom/storage/StorageActivityService.cpp | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/dom/storage/StorageActivityService.cpp b/dom/storage/StorageActivityService.cpp @@ -285,7 +285,14 @@ StorageActivityService::MoveOriginInTime(nsIPrincipal* aPrincipal, NS_IMETHODIMP StorageActivityService::TestOnlyReset() { + const bool shouldRemoveObserver = mActivities.Count() > 0; mActivities.Clear(); + if (shouldRemoveObserver) { + nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); + if (obs) { + obs->RemoveObserver(this, OBSERVER_TOPIC_IDLE_DAILY); + } + } return NS_OK; }