mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 18:26:15 +00:00
Bug 328523 r=beng (verbal) History system should remove observers.
Original committer: brettw%gmail.com Original revision: 1.73 Original date: 2006/02/24 22:27:58
This commit is contained in:
parent
995e379e3e
commit
61d74567ec
@ -179,6 +179,7 @@ const PRInt32 nsNavHistory::kAutoCompleteIndex_Typed = 3;
|
||||
|
||||
static nsDataHashtable<nsCStringHashKey, int>* gTldTypes;
|
||||
static const char* gQuitApplicationMessage = "quit-application";
|
||||
static const char* gXpcomShutdown = "xpcom-shutdown";
|
||||
|
||||
// annotation names
|
||||
const char nsNavHistory::kAnnotationPreviousEncoding[] = "history/encoding";
|
||||
@ -338,6 +339,7 @@ nsNavHistory::Init()
|
||||
}
|
||||
|
||||
observerService->AddObserver(this, gQuitApplicationMessage, PR_FALSE);
|
||||
observerService->AddObserver(this, gXpcomShutdown, PR_FALSE);
|
||||
|
||||
if (doImport) {
|
||||
nsCOMPtr<nsIMorkHistoryImporter> importer = new nsMorkHistoryImporter();
|
||||
@ -2590,6 +2592,13 @@ nsNavHistory::Observe(nsISupports *aSubject, const char *aTopic,
|
||||
// FIXME: should we compress sometimes? It's slow, so we shouldn't do it
|
||||
// every time.
|
||||
VacuumDB(expireUsecsAgo);
|
||||
} else if (nsCRT::strcmp(aTopic, gXpcomShutdown) == 0) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
observerService->RemoveObserver(this, gXpcomShutdown);
|
||||
observerService->RemoveObserver(this, gQuitApplicationMessage);
|
||||
} else if (nsCRT::strcmp(aTopic, "nsPref:changed") == 0) {
|
||||
LoadPrefs();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user