Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
5 // ----------------------------------------------------------------------------
6 // Tests that cancelling multiple installs doesn't fail
7 function test() {
8 Harness.installConfirmCallback = confirm_install;
9 Harness.installEndedCallback = install_ended;
10 Harness.installsCompletedCallback = finish_test;
11 Harness.setup();
13 var pm = Services.perms;
14 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
16 var triggers = encodeURIComponent(JSON.stringify({
17 "Signed XPI": TESTROOT + "signed.xpi",
18 "Signed XPI 2": TESTROOT + "signed2.xpi",
19 }));
20 gBrowser.selectedTab = gBrowser.addTab();
21 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
22 }
24 function get_item(items, url) {
25 for (let item of items) {
26 if (item.url == url)
27 return item;
28 }
29 ok(false, "Item for " + url + " was not listed");
30 return null;
31 }
33 function confirm_install(window) {
34 let items = window.document.getElementById("itemList").childNodes;
35 is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
36 let item = get_item(items, TESTROOT + "signed.xpi");
37 if (item) {
38 is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
39 is(item.cert, "(Object Signer)", "Should have seen the signer");
40 is(item.signed, "true", "Should have listed the item as signed");
41 }
42 item = get_item(items, TESTROOT + "signed2.xpi");
43 if (item) {
44 is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
45 is(item.cert, "(Object Signer)", "Should have seen the signer");
46 is(item.signed, "true", "Should have listed the item as signed");
47 }
48 return false;
49 }
51 function install_ended(install, addon) {
52 ok(false, "Should not have seen installs complete");
53 }
55 function finish_test(count) {
56 is(count, 0, "No add-ons should have been successfully installed");
58 Services.perms.remove("example.com", "install");
60 gBrowser.removeCurrentTab();
61 Harness.finish();
62 }