summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-06-11 16:05:53 +0000
committerMoonchild <moonchild@palemoon.org>2022-06-11 16:05:53 +0000
commita164537057a031328a3f688cbfa17738aed067b1 (patch)
tree38b82bc5437ad17d49817f9bb07b92cbcd383f17
parent9ad788853f6f2be403ec54d1c56e8bd608014f02 (diff)
parent2b8f6866cbbeb3e36cdfbdd273997f254707d111 (diff)
downloaduxp-a164537057a031328a3f688cbfa17738aed067b1.tar.gz
Merge pull request 'Ensure UpdateChecker and UpdateParser can handle empty manifest URLs.' (#1913) from athenian200/UXP:1909_second_attempt into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/1913
-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..e12549094d 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,