CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / xpinstall / tests / browser_cookies.js
blob5235fd05abfb462e67248aea749676b1a7a4f7e6
1 // Load in the test harness
2 var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
3 .getService(Components.interfaces.mozIJSSubScriptLoader);
6 var rootDir = getRootDirectory(window.location.href);
7 scriptLoader.loadSubScript(rootDir + "harness.js", this);
9 // ----------------------------------------------------------------------------
10 // Test that an install that requires cookies to be sent fails when no cookies
11 // are set
12 // This verifies bug 462739
13 function test() {
14 Harness.installEndedCallback = check_xpi_install;
15 Harness.installsCompletedCallback = finish_test;
16 Harness.setup();
18 var pm = Services.perms;
19 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
21 var triggers = encodeURIComponent(JSON.stringify({
22 "Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
23 }));
24 gBrowser.selectedTab = gBrowser.addTab();
25 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
28 function check_xpi_install(addon, status) {
29 is(status, -228, "Install should fail");
32 function finish_test() {
33 Services.perms.remove("example.com", "install");
35 gBrowser.removeCurrentTab();
36 Harness.finish();