Bug 1304566 - Unregister from the obsever service in order to prevent re-entrancy; r=janv

This commit is contained in:
Ehsan Akhgari 2017-04-15 23:26:09 -04:00
Родитель 5e75957ba6
Коммит 3c7ded9416
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -2813,6 +2813,18 @@ ShutdownObserver::Observe(nsISupports* aSubject,
MOZ_ASSERT(!strcmp(aTopic, PROFILE_BEFORE_CHANGE_QM_OBSERVER_ID));
MOZ_ASSERT(gInstance);
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return NS_ERROR_FAILURE;
}
// Unregister ourselves from the observer service first to make sure the
// nested event loop below will not cause re-entrancy issues.
Unused <<
observerService->RemoveObserver(this,
PROFILE_BEFORE_CHANGE_QM_OBSERVER_ID);
QuotaManagerService* qms = QuotaManagerService::Get();
MOZ_ASSERT(qms);