mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Enhanced WebExtension support + detailed reason on why a extension is "corrupt"
This commit is contained in:
parent
257ddfa48d
commit
c961f4e45c
4 changed files with 60 additions and 7 deletions
|
|
@ -5275,8 +5275,10 @@ AddonInstall.prototype = {
|
|||
this.certName = this.certificate.organization;
|
||||
}
|
||||
} else {
|
||||
zipreader.close();
|
||||
throw new Error("XPI is incorrectly signed");
|
||||
// Don't treat unverifiable object signatures as file corruption.
|
||||
// UXP may encounter AMO signatures it cannot verify, while the
|
||||
// package itself is still valid and installable.
|
||||
logger.warn("XPI signature verification failed; continuing install");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5598,6 +5600,17 @@ AddonInstall.prototype = {
|
|||
logger.warn("Download of " + this.sourceURI.spec + " failed", aError);
|
||||
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
|
||||
this.error = aReason;
|
||||
if (aError !== undefined && aError !== null) {
|
||||
if (typeof aError == "string") {
|
||||
this.errorDetail = aError;
|
||||
} else if (aError && typeof aError.message == "string" && aError.message) {
|
||||
this.errorDetail = aError.message;
|
||||
} else {
|
||||
this.errorDetail = String(aError);
|
||||
}
|
||||
} else {
|
||||
this.errorDetail = null;
|
||||
}
|
||||
XPIProvider.removeActiveInstall(this);
|
||||
AddonManagerPrivate.callInstallListeners("onDownloadFailed", this.listeners,
|
||||
this.wrapper);
|
||||
|
|
@ -6007,7 +6020,7 @@ function AddonInstallWrapper(aInstall) {
|
|||
});
|
||||
#endif
|
||||
|
||||
["name", "type", "version", "icons", "releaseNotesURI", "file", "state", "error",
|
||||
["name", "type", "version", "icons", "releaseNotesURI", "file", "state", "error", "errorDetail",
|
||||
"progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
|
||||
this.__defineGetter__(aProp, function AIW_propertyGetter() aInstall[aProp]);
|
||||
}, this);
|
||||
|
|
|
|||
|
|
@ -5533,9 +5533,11 @@ class AddonInstall {
|
|||
this.certName = this.certificate.organization;
|
||||
}
|
||||
} else {
|
||||
zipreader.close();
|
||||
return Promise.reject([AddonManager.ERROR_CORRUPT_FILE,
|
||||
"XPI is incorrectly signed"]);
|
||||
// In non-required-signing mode, allow installation to proceed
|
||||
// when signature verification fails instead of treating it as a
|
||||
// corrupt XPI. This improves compatibility with third-party
|
||||
// signed add-ons on older platforms.
|
||||
logger.warn("XPI signature verification failed; continuing because signatures are not required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6321,6 +6323,17 @@ class DownloadAddonInstall extends AddonInstall {
|
|||
logger.warn("Download of " + this.sourceURI.spec + " failed", aError);
|
||||
this.state = AddonManager.STATE_DOWNLOAD_FAILED;
|
||||
this.error = aReason;
|
||||
if (aError !== undefined && aError !== null) {
|
||||
if (typeof aError == "string") {
|
||||
this.errorDetail = aError;
|
||||
} else if (aError && typeof aError.message == "string" && aError.message) {
|
||||
this.errorDetail = aError.message;
|
||||
} else {
|
||||
this.errorDetail = String(aError);
|
||||
}
|
||||
} else {
|
||||
this.errorDetail = null;
|
||||
}
|
||||
XPIProvider.removeActiveInstall(this);
|
||||
AddonManagerPrivate.callInstallListeners("onDownloadFailed", this.listeners,
|
||||
this.wrapper);
|
||||
|
|
@ -6655,7 +6668,7 @@ AddonInstallWrapper.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
["name", "version", "icons", "releaseNotesURI", "file", "state", "error",
|
||||
["name", "version", "icons", "releaseNotesURI", "file", "state", "error", "errorDetail",
|
||||
"progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
|
||||
Object.defineProperty(AddonInstallWrapper.prototype, aProp, {
|
||||
get: function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue