Bug 392496: New AUS update URL v3, send distribution information. r=sspitzer

This commit is contained in:
thunder@mozilla.com 2007-10-01 17:52:49 -07:00
parent 041ca1a291
commit 1779e27d03
2 changed files with 23 additions and 1 deletions

View File

@ -102,7 +102,7 @@ pref("app.update.mode", 1);
pref("app.update.silent", false);
// Update service URL:
pref("app.update.url", "https://aus2.mozilla.org/update/2/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/update.xml");
pref("app.update.url", "https://aus2.mozilla.org/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml");
// app.update.url.manual is in branding section
// app.update.url.details is in branding section

View File

@ -58,6 +58,8 @@ const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
const PREF_APP_UPDATE_INCOMPATIBLE_MODE = "app.update.incompatible.mode";
const PREF_UPDATE_NEVER_BRANCH = "app.update.never.";
const PREF_PARTNER_BRANCH = "app.partner.";
const PREF_APP_DISTRIBUTION = "distribution.id";
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
const URI_UPDATE_HISTORY_DIALOG = "chrome://mozapps/content/update/history.xul";
@ -539,6 +541,22 @@ function getUpdateChannel() {
return channel;
}
/* Get the distribution pref values, from defaults only */
function getDistributionPrefValue(aPrefName) {
var prefValue = "default";
var defaults =
gPref.QueryInterface(Components.interfaces.nsIPrefService).
getDefaultBranch(null);
try {
prefValue = defaults.getCharPref(aPrefName);
} catch (e) {
// use default when pref not found
}
return prefValue;
}
/**
* An enumeration of items in a JS array.
* @constructor
@ -1940,6 +1958,10 @@ Checker.prototype = {
url = url.replace(/%LOCALE%/g, getLocale());
url = url.replace(/%CHANNEL%/g, getUpdateChannel());
url = url.replace(/%PLATFORM_VERSION%/g, gApp.platformVersion);
url = url.replace(/%DISTRIBUTION%/g,
getDistributionPrefValue(PREF_APP_DISTRIBUTION));
url = url.replace(/%DISTRIBUTION_VERSION%/g,
getDistributionPrefValue(PREF_APP_DISTRIBUTION_VERSION));
url = url.replace(/\+/g, "%2B");
if (force)