toolkit/mozapps/extensions/test/xpinstall/browser_bug672485.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 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 gWindowWatcher = null;
     7 function test() {
     8   Harness.installConfirmCallback = confirm_install;
     9   Harness.installCancelledCallback = cancelled_install;
    10   Harness.installEndedCallback = complete_install;
    11   Harness.installsCompletedCallback = finish_test;
    12   Harness.setup();
    14   gWindowWatcher = Services.ww;
    15   delete Services.ww;
    16   is(Services.ww, undefined, "Services.ww should now be undefined");
    18   var pm = Services.perms;
    19   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
    21   var triggers = encodeURIComponent(JSON.stringify({
    22     "Unsigned XPI": TESTROOT + "unsigned.xpi"
    23   }));
    24   gBrowser.selectedTab = gBrowser.addTab();
    25   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
    26 }
    28 function confirm_install(window) {
    29   ok(false, "Should not see the install dialog");
    30   return false;
    31 }
    33 function cancelled_install() {
    34   ok(true, "Install should b cancelled");
    35 }
    37 function complete_install() {
    38   ok(false, "Install should not have completed");
    39   return false;
    40 }
    42 function finish_test(count) {
    43   is(count, 0, "0 Add-ons should have been successfully installed");
    45   gBrowser.removeCurrentTab();
    47   Services.ww = gWindowWatcher;
    49   Services.perms.remove("example.com", "install");
    51   Harness.finish();
    52 }

mercurial