summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/update/nsUpdateService.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/update/nsUpdateService.js')
-rw-r--r--toolkit/mozapps/update/nsUpdateService.js38
1 files changed, 31 insertions, 7 deletions
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js
index 0cf7b8938..e5c81aa19 100644
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -44,6 +44,7 @@ const PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT = "app.update.socket.retryTimeout";
const PREF_APP_UPDATE_STAGING_ENABLED = "app.update.staging.enabled";
const PREF_APP_UPDATE_URL = "app.update.url";
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
+const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
const PREFBRANCH_APP_UPDATE_NEVER = "app.update.never.";
@@ -2143,6 +2144,14 @@ UpdateService.prototype = {
}
}
+ let prefType = Services.prefs.getPrefType(PREF_APP_UPDATE_URL_OVERRIDE);
+ let overridePrefHasValue = prefType != Ci.nsIPrefBranch.PREF_INVALID;
+ // Histogram IDs:
+ // UPDATE_HAS_PREF_URL_OVERRIDE_EXTERNAL
+ // UPDATE_HAS_PREF_URL_OVERRIDE_NOTIFY
+ AUSTLMY.pingGeneric("UPDATE_HAS_PREF_URL_OVERRIDE_" + this._pingSuffix,
+ overridePrefHasValue, false);
+
// If a download is in progress or the patch has been staged do nothing.
if (this.isDownloading) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_IS_DOWNLOADING);
@@ -2173,8 +2182,18 @@ UpdateService.prototype = {
} else if (!UpdateUtils.ABI) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_OS_ABI);
} else if (!validUpdateURL) {
- AUSTLMY.pingCheckCode(this._pingSuffix,
- AUSTLMY.CHK_INVALID_DEFAULT_URL);
+ if (overridePrefHasValue) {
+ if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
+ AUSTLMY.pingCheckCode(this._pingSuffix,
+ AUSTLMY.CHK_INVALID_USER_OVERRIDE_URL);
+ } else {
+ AUSTLMY.pingCheckCode(this._pingSuffix,
+ AUSTLMY.CHK_INVALID_DEFAULT_OVERRIDE_URL);
+ }
+ } else {
+ AUSTLMY.pingCheckCode(this._pingSuffix,
+ AUSTLMY.CHK_INVALID_DEFAULT_URL);
+ }
} else if (!getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true)) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
} else if (!hasUpdateMutex()) {
@@ -3023,11 +3042,16 @@ Checker.prototype = {
getUpdateURL: function UC_getUpdateURL(force) {
this._forced = force;
- let url;
- try {
- url = Services.prefs.getDefaultBranch(null).
- getCharPref(PREF_APP_UPDATE_URL);
- } catch (e) {
+ // Use the override URL if specified.
+ let url = getPref("getCharPref", PREF_APP_UPDATE_URL_OVERRIDE, null);
+
+ // Otherwise, construct the update URL from component parts.
+ if (!url) {
+ try {
+ url = Services.prefs.getDefaultBranch(null).
+ getCharPref(PREF_APP_UPDATE_URL);
+ } catch (e) {
+ }
}
if (!url || url == "") {