|
1 // ---------------------------------------------------------------------------- |
|
2 // Test that an install that requires cookies to be sent fails when no cookies |
|
3 // are set |
|
4 // This verifies bug 462739 |
|
5 function test() { |
|
6 Harness.downloadFailedCallback = download_failed; |
|
7 Harness.installsCompletedCallback = finish_test; |
|
8 Harness.setup(); |
|
9 |
|
10 var pm = Services.perms; |
|
11 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); |
|
12 |
|
13 var triggers = encodeURIComponent(JSON.stringify({ |
|
14 "Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi" |
|
15 })); |
|
16 gBrowser.selectedTab = gBrowser.addTab(); |
|
17 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); |
|
18 } |
|
19 |
|
20 function download_failed(install) { |
|
21 is(install.error, AddonManager.ERROR_NETWORK_FAILURE, "Install should fail"); |
|
22 } |
|
23 |
|
24 function finish_test(count) { |
|
25 is(count, 0, "No add-ons should have been installed"); |
|
26 Services.perms.remove("example.com", "install"); |
|
27 |
|
28 gBrowser.removeCurrentTab(); |
|
29 Harness.finish(); |
|
30 } |