Bug 1239949 - Add a pref for showing bookmarks toolbar and menubar; r=mixedpuppy

MozReview-Commit-ID: KqCSjlhWAOo

--HG--
extra : rebase_source : 5a25d574ea29b5f4949301ea8fcb20da8fc8cb59
This commit is contained in:
Michael Kaply 2016-02-24 09:47:52 -06:00
parent 0b6c6a178d
commit 459b5b8e45

View File

@ -240,9 +240,14 @@ DistributionCustomizer.prototype = {
}
}),
_newProfile: false,
_customizationsApplied: false,
applyCustomizations: function DIST_applyCustomizations() {
this._customizationsApplied = true;
if (!Services.prefs.prefHasUserValue("browser.migration.version"))
this._newProfile = true;
if (!this._ini)
return this._checkCustomizationComplete();
@ -408,6 +413,25 @@ DistributionCustomizer.prototype = {
},
_checkCustomizationComplete: function DIST__checkCustomizationComplete() {
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
if (this._newProfile) {
let xulStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
try {
var showPersonalToolbar = Services.prefs.getBoolPref("browser.showPersonalToolbar");
if (showPersonalToolbar) {
xulStore.setValue(BROWSER_DOCURL, "PersonalToolbar", "collapsed", "false");
}
} catch(e) {}
try {
var showMenubar = Services.prefs.getBoolPref("browser.showMenubar");
if (showMenubar) {
xulStore.setValue(BROWSER_DOCURL, "toolbar-menubar", "collapsed", "false");
}
} catch(e) {}
}
let prefDefaultsApplied = this._prefDefaultsApplied || !this._ini;
if (this._customizationsApplied && this._bookmarksApplied &&
prefDefaultsApplied) {