|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 gWindowWatcher = null; |
|
6 |
|
7 function test() { |
|
8 Harness.installConfirmCallback = confirm_install; |
|
9 Harness.installCancelledCallback = cancelled_install; |
|
10 Harness.installEndedCallback = complete_install; |
|
11 Harness.installsCompletedCallback = finish_test; |
|
12 Harness.setup(); |
|
13 |
|
14 gWindowWatcher = Services.ww; |
|
15 delete Services.ww; |
|
16 is(Services.ww, undefined, "Services.ww should now be undefined"); |
|
17 |
|
18 var pm = Services.perms; |
|
19 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); |
|
20 |
|
21 var triggers = encodeURIComponent(JSON.stringify({ |
|
22 "Unsigned XPI": TESTROOT + "unsigned.xpi" |
|
23 })); |
|
24 gBrowser.selectedTab = gBrowser.addTab(); |
|
25 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); |
|
26 } |
|
27 |
|
28 function confirm_install(window) { |
|
29 ok(false, "Should not see the install dialog"); |
|
30 return false; |
|
31 } |
|
32 |
|
33 function cancelled_install() { |
|
34 ok(true, "Install should b cancelled"); |
|
35 } |
|
36 |
|
37 function complete_install() { |
|
38 ok(false, "Install should not have completed"); |
|
39 return false; |
|
40 } |
|
41 |
|
42 function finish_test(count) { |
|
43 is(count, 0, "0 Add-ons should have been successfully installed"); |
|
44 |
|
45 gBrowser.removeCurrentTab(); |
|
46 |
|
47 Services.ww = gWindowWatcher; |
|
48 |
|
49 Services.perms.remove("example.com", "install"); |
|
50 |
|
51 Harness.finish(); |
|
52 } |