fix for bug 399460: if browser crashes or is killed (like with the Ts test) before we write out prefs, you can get two Places folders on the toolbar. r=mano, a=mconnor for M9

This commit is contained in:
sspitzer@mozilla.org 2007-10-12 19:43:48 -07:00
parent e0f4feb1cf
commit 6ee3eb160f

View File

@ -320,9 +320,7 @@ function initBookmarksToolbar() {
function initPlacesDefaultQueries() {
var createdDefaultQueries = false;
try {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
createdDefaultQueries = prefBranch.getBoolPref("browser.places.createdDefaultQueries");
createdDefaultQueries = gPrefService.getBoolPref("browser.places.createdDefaultQueries");
} catch(ex) {}
if (createdDefaultQueries)
@ -418,10 +416,12 @@ function initPlacesDefaultQueries() {
}
try {
bmsvc.runInBatchMode(callback, null)
}
finally {
prefBranch.setBoolPref("browser.places.createdDefaultQueries", true);
bmsvc.runInBatchMode(callback, null);
} finally {
// We need to persist this preference change, since we want to
// check it at next app start even if the browser exits abruptly
gPrefService.setBoolPref("browser.places.createdDefaultQueries", true);
gPrefService.savePrefFile(null);
}
}