Bug 552759: Allow treating untrusted signers as unsigned. r=robstrong
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -3281,17 +3281,17 @@ AddonInstall.prototype = {
loadManifest: function AI_loadManifest() {
let zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
createInstance(Ci.nsIZipReader);
zipreader.open(this.file);
try {
let principal = zipreader.getCertificatePrincipal(null);
if (principal && principal.hasCertificate) {
- LOG("Verifying XPI signiture");
+ LOG("Verifying XPI signature");
if (verifyZipSigning(zipreader, principal)) {
let x509 = principal.certificate;
if (x509 instanceof Ci.nsIX509Cert)
this.certificate = x509;
if (this.certificate && this.certificate.commonName.length > 0)
this.certName = this.certificate.commonName;
else
this.certName = principal.prettyName;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_signed_untrusted.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_signed_untrusted.js
@@ -1,35 +1,41 @@
// ----------------------------------------------------------------------------
// Tests installing an add-on signed by an untrusted certificate through an
// InstallTrigger call in web content.
function test() {
Harness.installConfirmCallback = confirm_install;
- Harness.installEndedCallback = download_failed;
+ Harness.installEndedCallback = install_ended;
Harness.installsCompletedCallback = finish_test;
Harness.setup();
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Untrusted Signed XPI": TESTROOT + "signed-untrusted.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function confirm_install(window) {
- ok(false, "Should not offer to install");
+ items = window.document.getElementById("itemList").childNodes;
+ is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
+ is(items[0].name, "Signed XPI Test", "Should have had the filename for the item name");
+ is(items[0].url, TESTROOT + "signed-untrusted.xpi", "Should have listed the correct url for the item");
+ is(items[0].icon, "", "Should have listed no icon for the item");
+ is(items[0].signed, "false", "Should have listed the item as unsigned");
+ return true;
}
-function download_failed(install, status) {
- is(status, AddonManager.ERROR_CORRUPTFILE, "Should have seen a corrupt file");
+function install_ended(install, addon) {
+ install.cancel();
}
function finish_test(count) {
- is(count, 0, "No add-ons should have been installed");
+ is(count, 1, "1 Add-on should have been successfully installed");
Services.perms.remove("example.com", "install");
gBrowser.removeCurrentTab();
Harness.finish();
}
// ----------------------------------------------------------------------------