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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // ----------------------------------------------------------------------------
     2 // Tests installing an unsigned add-on through an InstallTrigger call in web
     3 // content. This should be blocked by the whitelist check because the source
     4 // is not whitelisted, even though the target is.
     5 function test() {
     6   Harness.installBlockedCallback = allow_blocked;
     7   Harness.installsCompletedCallback = finish_test;
     8   Harness.setup();
    10   var pm = Services.perms;
    11   pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
    13   var triggers = encodeURIComponent(JSON.stringify({
    14     "Unsigned XPI": TESTROOT2 + "unsigned.xpi"
    15   }));
    16   gBrowser.selectedTab = gBrowser.addTab();
    17   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
    18 }
    20 function allow_blocked(installInfo) {
    21   is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
    22   is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
    23   return false;
    24 }
    26 function finish_test() {
    27   Services.perms.remove("example.org", "install");
    29   gBrowser.removeCurrentTab();
    30   Harness.finish();
    31 }

mercurial