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
Родитель 612be40b8d
Коммит b2a4844264
1 изменённых файлов: 7 добавлений и 7 удалений

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

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