[JAEGER] Fixed GETELEM PIC not initializing memory (bug 588338, r=cdleary).
[mozilla-central.git] / xpinstall / tests / browser_signed_untrusted.js
blobdee923fe88c84059a9b775b153758f2f2f5e8b3e
1 // Load in the test harness
2 var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
3                              .getService(Components.interfaces.mozIJSSubScriptLoader);
4 scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
6 // ----------------------------------------------------------------------------
7 // Tests installing an add-on signed by an untrusted certificate through an
8 // InstallTrigger call in web content.
9 function test() {
10   Harness.installConfirmCallback = confirm_install;
11   Harness.installEndedCallback = check_xpi_install;
12   Harness.installsCompletedCallback = finish_test;
13   Harness.setup();
15   var pm = Services.perms;
16   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
18   var triggers = encodeURIComponent(JSON.stringify({
19     "Untrusted Signed XPI": TESTROOT + "signed-untrusted.xpi"
20   }));
21   gBrowser.selectedTab = gBrowser.addTab();
22   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
25 function confirm_install(window) {
26   items = window.document.getElementById("itemList").childNodes;
27   is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
28   is(items[0].name, "Untrusted Signed XPI", "Should have seen the name from the trigger list");
29   is(items[0].url, TESTROOT + "signed-untrusted.xpi", "Should have listed the correct url for the item");
30   is(items[0].cert, "(Unknown Signer)", "Should have seen the supposed signer");
31   is(items[0].signed, "true", "Should have listed the item as signed");
32   return true;
35 function check_xpi_install(addon, status) {
36   is(status, -260, "Install should fail");
39 function finish_test() {
40   Services.perms.remove("example.com", "install");
42   gBrowser.removeCurrentTab();
43   Harness.finish();
45 // ----------------------------------------------------------------------------