bug 855147. When the browser is being suspended, flush prefs to disk. r=bsmedberg

This commit is contained in:
Tim Abraldes 2013-05-16 11:57:26 -07:00
Родитель 1625238548
Коммит e1e00e26ed
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -390,6 +390,7 @@ Preferences::Init()
rv = observerService->AddObserver(this, "profile-before-change", true);
observerService->AddObserver(this, "load-extension-defaults", true);
observerService->AddObserver(this, "suspend_process_notification", true);
return(rv);
}
@ -425,6 +426,11 @@ Preferences::Observe(nsISupports *aSubject, const char *aTopic,
} else if (!nsCRT::strcmp(aTopic, "reload-default-prefs")) {
// Reload the default prefs from file.
pref_InitInitialObjects();
} else if (!nsCRT::strcmp(aTopic, "suspend_process_notification")) {
// Our process is being suspended. The OS may wake our process later,
// or it may kill the process. In case our process is going to be killed
// from the suspended state, we save preferences before suspending.
rv = SavePrefFile(nullptr);
}
return rv;
}