Bug 917673 - Throw APP_PACKAGE_INVALID when the JAR is invalid and throw APP_PACKAGE_CORRUPT when the JAR has been tampered with. r=fabrice

This commit is contained in:
Marco Castelluccio 2013-12-15 14:03:28 -05:00
parent b24cf41faa
commit 3e8ae6fe31

View File

@ -2958,8 +2958,15 @@ onInstallSuccessAck: function onInstallSuccessAck(aManifestURL,
if (Components.isSuccessCode(result)) {
isSigned = true;
} else if (result == Cr.NS_ERROR_FILE_CORRUPTED) {
} else if (result == Cr.NS_ERROR_SIGNED_JAR_MODIFIED_ENTRY ||
result == Cr.NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY ||
result == Cr.NS_ERROR_SIGNED_JAR_ENTRY_MISSING) {
throw "APP_PACKAGE_CORRUPTED";
} else if (result == Cr.NS_ERROR_FILE_CORRUPTED ||
result == Cr.NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE ||
result == Cr.NS_ERROR_SIGNED_JAR_ENTRY_INVALID ||
result == Cr.NS_ERROR_SIGNED_JAR_MANIFEST_INVALID) {
throw "APP_PACKAGE_INVALID";
} else if ((!aIsLocalFileInstall || isLaterThanBuildTime) &&
(result != Cr.NS_ERROR_SIGNED_JAR_NOT_SIGNED)) {
throw "INVALID_SIGNATURE";