Issue #1909 - Ensure UpdateChecker and UpdateParser can handle empty manifest URLs.

This commit is contained in:
Jeremy Andrews
2022-06-08 15:15:42 -05:00
committed by roytam1
parent afbfbcb1e1
commit 41b9919e7c
2 changed files with 17 additions and 0 deletions
@@ -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);
@@ -6134,6 +6134,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,