PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/modules/libjar/test/unit/test_bug370103.js

http://github.com/zpao/v8monkey
JavaScript | 26 lines | 18 code | 4 blank | 4 comment | 0 complexity | 0c687ee61de8f9402e941b88970dbfab MD5 | raw file
 1var Cc = Components.classes;
 2var Ci = Components.interfaces;
 3
 4// Regression test for bug 370103 - crash when passing a null listener to
 5// nsIChannel.asyncOpen
 6function 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";
13
14  // Try opening channel with null listener
15  var channel = ioService.newChannel(url, null, null);
16
17  var exception = false;
18  try {
19    channel.asyncOpen(null, null);
20  }
21  catch(e) {
22    exception = true;
23  }
24
25  do_check_true(exception); // should throw exception instead of crashing
26}