Implement update service channels. Bug 302721, attachment 192129. Patch

by Darin Fisher <darin@meer.net>.  r=benjamin@smedbergs.us
This commit is contained in:
cmp%mozilla.org 2005-08-25 02:16:35 +00:00
Родитель dd36e2ffcc
Коммит 9dd7889eb0
6 изменённых файлов: 44 добавлений и 44 удалений

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

@ -93,16 +93,13 @@ pref("app.update.mode", 1);
// If set to true, the Update Service will present no UI for any event.
pref("app.update.silent", false);
// XXX these prefs and others like them are distribution specific and should move
// into chrome://browser
// Default service URL for testing.
pref("app.update.url", "chrome://mozapps/locale/update/updates.properties");
// Update service URL:
pref("app.update.url", "https://aus2.mozilla.org/update2/1/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/update.xml");
// URL user can browse to manually if for some reason all update installation
// attempts fail.
pref("app.update.url.manual", "chrome://mozapps/locale/update/updates.properties");
// User-settable update preference that overrides app.update.url for testing
// purposes.
pref("app.update.url.override", "chrome://mozapps/locale/update/updates.properties");
// attempts fail. TODO: Change this URL
pref("app.update.url.manual", "http://www.mozilla.org/update");
// User-settable override to app.update.url for testing purposes.
//pref("app.update.url.override", "");
// Interval: Time between checks for a new version (in seconds)
// default=1 day

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

@ -72,14 +72,13 @@ pref("app.update.mode", 1);
// If set to true, the Update Service will present no UI for any event.
pref("app.update.silent", false);
// Default service URL for testing.
pref("app.update.url", "chrome://mozapps/locale/update/updates.properties");
// Update service URL:
pref("app.update.url", "https://aus2.mozilla.org/update2/1/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/update.xml");
// URL user can browse to manually if for some reason all update installation
// attempts fail.
pref("app.update.url.manual", "chrome://mozapps/locale/update/updates.properties");
// User-settable update preference that overrides app.update.url for testing
// purposes.
pref("app.update.url.override", "chrome://mozapps/locale/update/updates.properties");
// attempts fail. TODO: Change this URL
pref("app.update.url.manual", "http://www.mozilla.org/update");
// User-settable override to app.update.url for testing purposes.
//pref("app.update.url.override", "");
// Interval: Time between checks for a new version (in seconds)
// default=1 day

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

@ -14,14 +14,6 @@ statusSucceededFormat=Installed on: %S
statusFailed=Install Failed
pauseButtonPause=Pause
pauseButtonResume=Resume
# 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=
hideButtonLabel=Hide
progressFormatKBKB=#1 of #2 KB

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

@ -1326,13 +1326,10 @@ var gErrorsPage = {
var errorReason = document.getElementById("errorReason");
errorReason.value = gUpdates.update.statusText;
var errorLink = document.getElementById("errorLink");
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var manualURL = pref.getComplexValue(PREF_UPDATE_MANUAL_URL,
Components.interfaces.nsIPrefLocalizedString);
errorLink.href = manualURL.data;
var manualURL = getPref("getCharPref", PREF_UPDATE_MANUAL_URL, "");
errorLink.href = manualURL;
var errorLinkLabel = document.getElementById("errorLinkLabel");
errorLinkLabel.value = manualURL.data;
errorLinkLabel.value = manualURL;
},
/**

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

@ -1,4 +1,4 @@
#
# vim:set ts=8 sw=8 sts=8 noet:
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#

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

@ -45,6 +45,7 @@ const PREF_APP_UPDATE_TIMER = "app.update.timer";
const PREF_APP_UPDATE_LOG_BRANCH = "app.update.log.";
const PREF_APP_UPDATE_URL = "app.update.url";
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
const PREF_APP_UPDATE_LASTUPDATETIME_FMT = "app.update.lastUpdateTime.%ID%";
const PREF_APP_EXTENSIONS_VERSION = "app.extensions.version";
@ -1480,29 +1481,43 @@ Checker.prototype = {
* about available updates.
*/
get updateURL() {
var url;
try {
// Use the override URL if specified.
url = gPref.getComplexValue(PREF_APP_UPDATE_URL_OVERRIDE,
nsIPrefLocalizedString).data;
if (url && url != "")
return url;
} catch (e) {}
var defaults =
gPref.QueryInterface(Components.interfaces.nsIPrefService).
getDefaultBranch(null);
// Use the override URL if specified.
var url = getPref("getCharPref", PREF_APP_UPDATE_URL_OVERRIDE, null);
// Otherwise, construct the update URL from component parts.
try {
url = gPref.getComplexValue(PREF_APP_UPDATE_URL,
nsIPrefLocalizedString).data;
} catch (e) {
LOG("Checker", PREF_APP_UPDATE_URL + " not defined");
if (!url) {
try {
url = defaults.getCharPref(PREF_APP_UPDATE_URL);
} catch (e) {
}
}
if (!url || url == "") {
LOG("Checker", "Update URL not defined");
return null;
}
// Read the update channel from defaults only. We do this to ensure that
// the channel is tightly coupled with the application and does not apply
// to other instances of the application that may use the same profile.
function getUpdateChannel() {
try {
return defaults.getCharPref(PREF_APP_UPDATE_CHANNEL);
} catch (e) {
return "default"; // failover when pref not found
}
}
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, getLocale());
url = url.replace(/%CHANNEL%/g, getUpdateChannel());
url = url.replace(/\+/g, "%2B");
LOG("Checker", "update url: " + url);