toolkit/mozapps/extensions/test/xpinstall/browser_signed_trigger.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 signed add-on through an InstallTrigger call in web
     3 // content.
     4 function test() {
     5   Harness.installConfirmCallback = confirm_install;
     6   Harness.installEndedCallback = install_ended;
     7   Harness.installsCompletedCallback = finish_test;
     8   Harness.setup();
    10   var pm = Services.perms;
    11   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
    13   var triggers = encodeURIComponent(JSON.stringify({
    14     "Signed XPI": TESTROOT + "signed.xpi"
    15   }));
    16   gBrowser.selectedTab = gBrowser.addTab();
    17   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
    18 }
    20 function confirm_install(window) {
    21   var items = window.document.getElementById("itemList").childNodes;
    22   is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
    23   is(items[0].name, "Signed XPI Test", "Should have seen the name from the trigger list");
    24   is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
    25   is(items[0].cert, "(Object Signer)", "Should have seen the signer");
    26   is(items[0].signed, "true", "Should have listed the item as signed");
    27   return true;
    28 }
    30 function install_ended(install, addon) {
    31   install.cancel();
    32 }
    34 function finish_test(count) {
    35   is(count, 1, "1 Add-on should have been successfully installed");
    37   Services.perms.remove("example.com", "install");
    39   gBrowser.removeCurrentTab();
    40   Harness.finish();
    41 }

mercurial