toolkit/mozapps/extensions/test/xpinstall/browser_hash.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 // Test whether an install succeeds when a valid hash is included
     3 // This verifies bug 302284
     4 function test() {
     5   Harness.installEndedCallback = install_ended;
     6   Harness.installsCompletedCallback = finish_test;
     7   Harness.setup();
     9   var pm = Services.perms;
    10   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
    12   var triggers = encodeURIComponent(JSON.stringify({
    13     "Unsigned XPI": {
    14       URL: TESTROOT + "unsigned.xpi",
    15       Hash: "sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
    16       toString: function() { return this.URL; }
    17     }
    18   }));
    19   gBrowser.selectedTab = gBrowser.addTab();
    20   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
    21 }
    23 function install_ended(install, addon) {
    24   install.cancel();
    25 }
    27 function finish_test(count) {
    28   is(count, 1, "1 Add-on should have been successfully installed");
    30   Services.perms.remove("example.com", "install");
    32   gBrowser.removeCurrentTab();
    33   Harness.finish();
    34 }

mercurial