toolkit/mozapps/extensions/test/xpinstall/browser_bug645699.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 an InstallTrigger call in web
     3 // content. This should be blocked by the whitelist check.
     4 // This verifies bug 645699
     5 function test() {
     6   Harness.installConfirmCallback = confirm_install;
     7   Harness.installBlockedCallback = allow_blocked;
     8   Harness.installsCompletedCallback = finish_test;
     9   Harness.setup();
    11   var pm = Services.perms;
    12   pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
    14   gBrowser.selectedTab = gBrowser.addTab();
    15   gBrowser.loadURI(TESTROOT + "bug645699.html");
    16 }
    18 function allow_blocked(installInfo) {
    19   is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
    20   is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
    21   return false;
    22 }
    24 function confirm_install(window) {
    25   ok(false, "Should not see the install dialog");
    26   return false;
    27 }
    29 function finish_test(count) {
    30   is(count, 0, "0 Add-ons should have been successfully installed");
    31   Services.perms.remove("addons.mozilla.org", "install");
    33   gBrowser.removeCurrentTab();
    34   Harness.finish();
    35 }
    36 // ----------------------------------------------------------------------------

mercurial