Construct update URL using RegExps per suggestion from Ben.

Include "0" in baseURL per Chase.
This commit is contained in:
darin%meer.net 2005-06-14 01:54:18 +00:00
Родитель d38195560e
Коммит a6550f8a40
3 изменённых файлов: 23 добавлений и 16 удалений

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

@ -80,7 +80,7 @@ pref("app.update.autoInstallMode", 0);
// XXX these prefs and others like them are distribution specific and should move
// into chrome://browser
pref("app.update.url.base", "https://aus.mozilla.org/update/");
pref("app.update.url", "chrome://mozapps/locale/update/updates.properties");
pref("app.update.url.manual", "chrome://mozapps/locale/update/updates.properties");
pref("app.update.url.override", "chrome://mozapps/locale/update/updates.properties");
pref("app.update.updatesAvailable", false);

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

@ -4,11 +4,15 @@ updateType_minor=Security Update
introType_minor=An important Security Update for %S is available:
introType_major=A new version of %S is available:
verificationError=%S could not confirm the integrity of the update package.
app.update.url.manual=http://www.mozilla.org/update
# This should be empty unless you wish to override the URL used to discover
# available updates.
app.update.url.override=
errorsPageHeader=Update Failed
IAgreeLabel=I Agree
license404Error=The license file could not be found. Please contact the distributor.
downloadingLicense=Downloading license text...
# The prefix /update2/0/ uniquely identifies the format of this URL. If you
# change the format of this URL, then you MUST change the prefix (i.e.,
# increment 0 to 1).
app.update.url=https://aus.mozilla.org/update2/0/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/update.xml
# When updating fails, we present the user with this web page:
app.update.url.manual=http://www.mozilla.org/update
# This value should be empty unless you wish to override app.update.url
app.update.url.override=

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

@ -49,7 +49,7 @@ const PREF_APP_UPDATE_INTERVAL = "app.update.interval";
const PREF_APP_UPDATE_TIMER = "app.update.timer";
const PREF_APP_UPDATE_LOG_ENABLED = "app.update.logEnabled";
const PREF_APP_UPDATE_URL_BASE = "app.update.url.base";
const PREF_APP_UPDATE_URL = "app.update.url";
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
const PREF_UPDATE_LASTUPDATETIME_FMT = "app.update.lastUpdateTime.%ID%";
@ -974,19 +974,22 @@ Checker.prototype = {
} catch (e) {}
// Otherwise, construct the update URL from component parts.
var baseURL = getPref("getCharPref", PREF_APP_UPDATE_URL_BASE, null);
if (!baseURL) {
LOG(PREF_APP_UPDATE_URL_BASE + " not defined");
try {
url = gPref.getComplexValue(PREF_APP_UPDATE_URL,
nsIPrefLocalizedString).data;
} catch (e) {
LOG(PREF_APP_UPDATE_URL + " not defined");
return null;
}
// <product-name>/<version>/<build-id>/<build-target>/<locale>/update.xml
url = baseURL +
gApp.name + "/" +
gApp.version + "/" +
gApp.appBuildID + "/" +
gApp.OS + "_" + gApp.XPCOMABI + "/" +
gPref.getCharPref("general.useragent.locale") + "/update.xml";
var locale = gPref.getCharPref("general.useragent.locale");
url = url.replace(/%PRODUCT%/g, gApp.name);
url = url.replace(/%VERSION%/g, gApp.version);
url = url.replace(/%BUILD_ID%/g, gApp.appBuildID);
url = url.replace(/%BUILD_TARGET%/g, gApp.OS + "_" + gApp.XPCOMABI);
url = url.replace(/%LOCALE%/g, locale);
LOG("update url: " + url);
return url;
},