Bug 1077740 - reset legacy homepages to about:home. r=gavin

This commit is contained in:
Dão Gottwald 2014-10-18 14:39:34 +02:00
parent 75158fb5b4
commit e1ca314601

View File

@ -1369,7 +1369,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 23;
const UI_VERSION = 24;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -1447,15 +1447,6 @@ BrowserGlue.prototype = {
}
}
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 currentset = xulStore.getValue(BROWSER_DOCURL, "nav-bar", "currentset");
@ -1520,10 +1511,6 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 13) {
/* Obsolete */
}
if (currentUIVersion < 14) {
// DOM Storage doesn't specially handle about: pages anymore.
let path = OS.Path.join(OS.Constants.Path.profileDir,
@ -1618,6 +1605,18 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 24) {
// Reset homepage pref for users who have it set to start.mozilla.org
// or google.com/firefox.
const HOMEPAGE_PREF = "browser.startup.homepage";
let uri = Services.prefs.getComplexValue(HOMEPAGE_PREF,
Ci.nsIPrefLocalizedString).data;
if (uri && (uri.startsWith("http://start.mozilla.org") ||
/^https?:\/\/(www\.)?google\.[a-z.]+\/firefox/i.test(uri))) {
Services.prefs.clearUserPref(HOMEPAGE_PREF);
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},