Commit 1d10c90b authored by Ricky Rosario's avatar Ricky Rosario
Browse files

Bug 1491332 - Reset legacy homepages to about:home - again r=dao

MozReview-Commit-ID: 997S4oJLHiB

Differential Revision: https://phabricator.services.mozilla.com/D23982

--HG--
extra : moz-landing-system : lando
parent ebab8a4f
......@@ -2272,7 +2272,7 @@ BrowserGlue.prototype = {
_migrateUI: function BG__migrateUI() {
// Use an increasing number to keep track of the current migration state.
// Completely unrelated to the current Firefox release number.
const UI_VERSION = 80;
const UI_VERSION = 81;
const BROWSER_DOCURL = AppConstants.BROWSER_CHROME_URL;
let currentUIVersion;
......@@ -2585,6 +2585,26 @@ BrowserGlue.prototype = {
Services.prefs.setCharPref("network.proxy.no_proxies_on", hosts);
}
if (currentUIVersion < 81) {
// Reset homepage pref for users who have it set to a default from before Firefox 4:
// <locale>.(start|start2|start3).mozilla.(com|org)
const HOMEPAGE_PREF = "browser.startup.homepage";
if (Services.prefs.prefHasUserValue(HOMEPAGE_PREF)) {
const DEFAULT = Services.prefs.getDefaultBranch(HOMEPAGE_PREF).getCharPref("");
let value = Services.prefs.getCharPref(HOMEPAGE_PREF);
let updated = value.replace(
/https?:\/\/([\w\-]+[.])?start[\d]*\.mozilla\.(org|com)[^|]*/ig, DEFAULT);
if (updated != value) {
if (updated == DEFAULT) {
Services.prefs.clearUserPref(HOMEPAGE_PREF);
} else {
value = updated;
Services.prefs.setCharPref(HOMEPAGE_PREF, value);
}
}
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment