summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2022-06-08 15:15:42 -0500
committerJeremy Andrews <athenian200@outlook.com>2022-06-10 12:54:15 -0500
commitec277eacb88c659a713ef75bda6d6381ecbdbda4 (patch)
treec5b4ad7e68fe377e970bdd1932d5913226cbddc7
parentd8070a8e0d7f6df5ac864e4052bc293f5442b967 (diff)
downloaduxp-ec277eacb88c659a713ef75bda6d6381ecbdbda4.tar.gz
Issue #1909 - Ensure UpdateChecker and UpdateParser can handle empty manifest URLs.
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm9
2 files changed, 17 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index 0dfb7cd109..7eb8c9b9d5 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -611,6 +611,14 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) {
let requireBuiltIn = Services.prefs.getBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, true);
logger.debug("Requesting " + aUrl);
+
+ if (!aUrl) {
+ logger.warn("Request failed: empty update manifest URL");
+ this._doneAt = new Error("UP_emptyManifestURL");
+ this.notifyError(AddonUpdateChecker.ERROR_DOWNLOAD_ERROR);
+ return;
+ }
+
try {
this.request = new ServiceRequest();
this.request.open("GET", this.url, true);
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index dbb1a18dd1..eb8a306a27 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -6128,6 +6128,15 @@ function UpdateChecker(aAddon, aListener, aReason, aAppVersion, aPlatformVersion
aReason |= UPDATE_TYPE_COMPATIBILITY;
if ("onUpdateAvailable" in this.listener)
aReason |= UPDATE_TYPE_NEWVERSION;
+
+ // Pass an empty string as the url and call checkForUpdates now if
+ // updateURL is empty. UpdateParser should detect this and fail early.
+
+ if (!updateURL) {
+ this._parser = AddonUpdateChecker.checkForUpdates(aAddon.id, aAddon.updateKey,
+ "", this);
+ return;
+ }
let url = escapeAddonURI(aAddon, updateURL, aReason, aAppVersion);
this._parser = AddonUpdateChecker.checkForUpdates(aAddon.id, aAddon.updateKey,