toolkit/mozapps/extensions/test/xpinstall/browser_whitelist7.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // ----------------------------------------------------------------------------
     2 // Tests installing an unsigned add-on through a direct install request from
     3 // web content. This should be blocked by the whitelist check because we disable
     4 // direct request whitelisting, even though the target URI is whitelisted.
     5 function test() {
     6   Harness.installBlockedCallback = allow_blocked;
     7   Harness.installsCompletedCallback = finish_test;
     8   Harness.setup();
    10   // Disable direct request whitelisting, installing should be blocked.
    11   Services.prefs.setBoolPref("xpinstall.whitelist.directRequest", false);
    13   gBrowser.selectedTab = gBrowser.addTab();
    14   gBrowser.loadURI(TESTROOT + "unsigned.xpi");
    15 }
    17 function allow_blocked(installInfo) {
    18   ok(true, "Seen blocked");
    19   return false;
    20 }
    22 function finish_test(count) {
    23   is(count, 0, "No add-ons should have been installed");
    25   Services.perms.remove("example.org", "install");
    26   Services.prefs.clearUserPref("xpinstall.whitelist.directRequest");
    28   gBrowser.removeCurrentTab();
    29   Harness.finish();
    30 }

mercurial