michael@0: var Cc = Components.classes; michael@0: var Ci = Components.interfaces; michael@0: michael@0: // Regression test for bug 370103 - crash when passing a null listener to michael@0: // nsIChannel.asyncOpen michael@0: function run_test() { michael@0: // Compose the jar: url michael@0: var ioService = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: var file = do_get_file("data/test_bug370103.jar"); michael@0: var url = ioService.newFileURI(file).spec; michael@0: url = "jar:" + url + "!/test_bug370103"; michael@0: michael@0: // Try opening channel with null listener michael@0: var channel = ioService.newChannel(url, null, null); michael@0: michael@0: var exception = false; michael@0: try { michael@0: channel.asyncOpen(null, null); michael@0: } michael@0: catch(e) { michael@0: exception = true; michael@0: } michael@0: michael@0: do_check_true(exception); // should throw exception instead of crashing michael@0: }