toolkit/mozapps/extensions/test/xpinstall/browser_bug645699.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 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