toolkit/mozapps/extensions/test/xpinstall/browser_badargs2.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 // Test whether passing an undefined url InstallTrigger.install throws an
     3 // exception
     4 function test() {
     5   waitForExplicitFinish();
     7   var triggers = encodeURIComponent(JSON.stringify({
     8     "Unsigned XPI": {
     9       URL: undefined
    10     }
    11   }));
    12   gBrowser.selectedTab = gBrowser.addTab();
    13   gBrowser.selectedBrowser.addEventListener("load", function() {
    14     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
    15     // Allow the in-page load handler to run first
    16     executeSoon(page_loaded);
    17   }, true);
    18   expectUncaughtException();
    19   gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
    20 }
    22 function page_loaded() {
    23   var doc = gBrowser.contentDocument;
    24   is(doc.getElementById("return").textContent, "exception", "installTrigger should have failed");
    25   gBrowser.removeCurrentTab();
    26   finish();
    27 }
    28 // ----------------------------------------------------------------------------

mercurial