|
1 // ---------------------------------------------------------------------------- |
|
2 // Tests installing an unsigned add-on through an InstallTrigger call in web |
|
3 // content. This should be blocked by the whitelist check. |
|
4 // This verifies bug 645699 |
|
5 function test() { |
|
6 Harness.installConfirmCallback = confirm_install; |
|
7 Harness.installBlockedCallback = allow_blocked; |
|
8 Harness.installsCompletedCallback = finish_test; |
|
9 Harness.setup(); |
|
10 |
|
11 var pm = Services.perms; |
|
12 pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION); |
|
13 |
|
14 gBrowser.selectedTab = gBrowser.addTab(); |
|
15 gBrowser.loadURI(TESTROOT + "bug645699.html"); |
|
16 } |
|
17 |
|
18 function allow_blocked(installInfo) { |
|
19 is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window"); |
|
20 is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri"); |
|
21 return false; |
|
22 } |
|
23 |
|
24 function confirm_install(window) { |
|
25 ok(false, "Should not see the install dialog"); |
|
26 return false; |
|
27 } |
|
28 |
|
29 function finish_test(count) { |
|
30 is(count, 0, "0 Add-ons should have been successfully installed"); |
|
31 Services.perms.remove("addons.mozilla.org", "install"); |
|
32 |
|
33 gBrowser.removeCurrentTab(); |
|
34 Harness.finish(); |
|
35 } |
|
36 // ---------------------------------------------------------------------------- |