Bug 825852 - Add UI migration to put the Downloads button into the navigation bar. r=mak, f=gavin.

This commit is contained in:
Mike Conley 2013-01-15 10:47:58 -05:00
parent 1e4e9b2f25
commit eb8edfdd52

View File

@ -1128,7 +1128,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 8;
const UI_VERSION = 9;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0;
try {
@ -1226,15 +1226,20 @@ BrowserGlue.prototype = {
Services.prefs.setBoolPref("browser.tabs.onTop", tabsOnTopAttribute == "true");
}
// This migration step is executed only if the Downloads Panel feature is
// enabled. By default, the feature is enabled only in the Nightly channel.
// This means that, unless the preference that enables the feature is
// changed manually, the Downloads button is added to the toolbar only if
// migration happens while running a build from the Nightly channel. This
// migration code will be updated when the feature will be enabled on all
// channels, see bug 748381 for details.
if (currentUIVersion < 7 &&
!Services.prefs.getBoolPref("browser.download.useToolkitUI")) {
// Migration at version 7 only occurred for users who wanted to try the new
// Downloads Panel feature before its release. Since migration at version
// 9 adds the button by default, this step has been removed.
if (currentUIVersion < 8) {
// Reset homepage pref for users who have it set to google.com/firefox
let uri = Services.prefs.getComplexValue("browser.startup.homepage",
Ci.nsIPrefLocalizedString).data;
if (uri && /^https?:\/\/(www\.)?google(\.\w{2,3}){1,2}\/firefox\/?$/.test(uri)) {
Services.prefs.clearUserPref("browser.startup.homepage");
}
}
if (currentUIVersion < 9) {
// This code adds the customizable downloads buttons.
let currentsetResource = this._rdf.GetResource("currentset");
let toolbarResource = this._rdf.GetResource(BROWSER_DOCURL + "nav-bar");
@ -1261,15 +1266,9 @@ BrowserGlue.prototype = {
}
this._setPersist(toolbarResource, currentsetResource, currentset);
}
}
if (currentUIVersion < 8) {
// Reset homepage pref for users who have it set to google.com/firefox
let uri = Services.prefs.getComplexValue("browser.startup.homepage",
Ci.nsIPrefLocalizedString).data;
if (uri && /^https?:\/\/(www\.)?google(\.\w{2,3}){1,2}\/firefox\/?$/.test(uri)) {
Services.prefs.clearUserPref("browser.startup.homepage");
}
Services.prefs.clearUserPref("browser.download.useToolkitUI");
Services.prefs.clearUserPref("browser.library.useNewDownloadsView");
}
if (this._dirty)