toolkit/mozapps/extensions/test/xpinstall/browser_multipackage.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 by navigating directly to the url
     3 function test() {
     4   Harness.installConfirmCallback = confirm_install;
     5   Harness.installEndedCallback = install_ended;
     6   Harness.installsCompletedCallback = finish_test;
     7   Harness.setup();
     9   gBrowser.selectedTab = gBrowser.addTab();
    10   gBrowser.loadURI(TESTROOT + "multipackage.xpi");
    11 }
    13 function get_item(items, name) {
    14   for (let item of items) {
    15     if (item.name == name)
    16       return item;
    17   }
    18   ok(false, "Item for " + name + " was not listed");
    19   return null;
    20 }
    22 function confirm_install(window) {
    23   let items = window.document.getElementById("itemList").childNodes;
    24   is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
    26   let item = get_item(items, "XPI Test");
    27   if (item) {
    28     is(item.signed, "false", "Should not have listed the item as signed");
    29     is(item.icon, "", "Should have listed no icon for the item");
    30   }
    32   item = get_item(items, "Signed XPI Test");
    33   if (item) {
    34     is(item.cert, "(Object Signer)", "Should have seen the signer");
    35     is(item.signed, "true", "Should have listed the item as signed");
    36     is(item.icon, "", "Should have listed no icon for the item");
    37   }
    39   return true;
    40 }
    42 function install_ended(install, addon) {
    43   install.cancel();
    44 }
    46 function finish_test(count) {
    47   is(count, 2, "2 Add-ons should have been successfully installed");
    48   gBrowser.removeCurrentTab();
    49   Harness.finish();
    50 }
    51 // ----------------------------------------------------------------------------

mercurial