modules/libjar/test/unit/test_bug370103.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 var Cc = Components.classes;
     2 var Ci = Components.interfaces;
     4 // Regression test for bug 370103 - crash when passing a null listener to
     5 // nsIChannel.asyncOpen
     6 function run_test() {
     7   // Compose the jar: url
     8   var ioService = Cc["@mozilla.org/network/io-service;1"].
     9                     getService(Ci.nsIIOService);
    10   var file = do_get_file("data/test_bug370103.jar");
    11   var url = ioService.newFileURI(file).spec;
    12   url = "jar:" + url + "!/test_bug370103";
    14   // Try opening channel with null listener
    15   var channel = ioService.newChannel(url, null, null);
    17   var exception = false;
    18   try {
    19     channel.asyncOpen(null, null);
    20   }
    21   catch(e) {
    22     exception = true;
    23   }
    25   do_check_true(exception); // should throw exception instead of crashing
    26 }

mercurial