diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-02-12 16:33:11 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-02-12 16:33:11 +0100 |
commit | 71c81eb900ac3b8a770a4b844771faf335999861 (patch) | |
tree | e3cf1faad220d6a7eb9c703a92e26224e4b9cfc1 /toolkit/mozapps | |
parent | dd418226c6a91301002134f699117ba00f1e0804 (diff) | |
download | uxp-71c81eb900ac3b8a770a4b844771faf335999861.tar.gz |
Restore app.update.url.override preference.
Diffstat (limited to 'toolkit/mozapps')
-rw-r--r-- | toolkit/mozapps/update/nsUpdateService.js | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 0cf7b89380..e5c81aa196 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 == "") { |