Bug 675252 - Store buildid when locales are installed and make sure it is current on startup. r=mfinkle

This commit is contained in:
Wes Johnston 2011-09-02 09:37:54 -07:00
parent e8ba8d2a39
commit 0ff902b315
4 changed files with 13 additions and 1 deletions

View File

@ -217,6 +217,7 @@ pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCAL
/* preference for the locale picker */
pref("extensions.getLocales.get.url", "");
pref("extensions.compatability.locales.buildid", "0");
/* blocklist preferences */
pref("extensions.blocklist.enabled", true);

View File

@ -214,6 +214,8 @@ let LocaleUI = {
},
closeWindow : function() {
var buildID = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).platformBuildID;
Services.prefs.setCharPref("extensions.compatability.locales.buildid", buildID);
// Trying to close this window and open a new one results in a corrupt UI.
if (LocaleUI._currentInstall) {
// a new locale was installed, restart the browser

View File

@ -126,6 +126,12 @@ function haveSystemLocale() {
function checkCurrentLocale() {
if (Services.prefs.prefHasUserValue("general.useragent.locale")) {
// if the user has a compatable locale from a different buildid, we need to update
var buildID = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).appBuildID;
let localeBuildID = Services.prefs.getCharPref("extensions.compatability.locales.buildid");
if (buildID != localeBuildID)
return false;
let currentLocale = Services.prefs.getCharPref("general.useragent.locale");
return isLocaleAvailable(currentLocale);
}
@ -239,7 +245,7 @@ BrowserCLH.prototype = {
uris = uris.slice(1);
}
// Show the locale selector if we have a new profile
// Show the locale selector if we have a new profile, or if the selected locale is no longer compatible
let showLocalePicker = Services.prefs.getBoolPref("browser.firstrun.show.localepicker")
if ((needHomepageOverride() == "new profile" && showLocalePicker && !haveSystemLocale()) || !checkCurrentLocale()) {
browserWin = openWindow(null, "chrome://browser/content/localePicker.xul", "_blank", "chrome,dialog=no,all", defaultURL);

View File

@ -238,6 +238,9 @@ UpdatePrompt.prototype = {
aLocale.addon.install.install();
}
}, this);
// store the buildid of these locales so that we can disable locales when the
// user updates through a non-updater channel
Services.prefs.setCharPref("extensions.compatability.locales.buildid", aUpdate.buildID);
}).bind(this), { buildID: aUpdate.buildID });
},