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
Родитель d57df5bee8
Коммит 47d612c75f
4 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 });
},