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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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