test_bug370103.js (700B)
1 const { NetUtil } = ChromeUtils.importESModule( 2 "resource://gre/modules/NetUtil.sys.mjs" 3 ); 4 5 // Regression test for bug 370103 - crash when passing a null listener to 6 // nsIChannel.asyncOpen 7 function run_test() { 8 // Compose the jar: url 9 var file = do_get_file("data/test_bug370103.jar"); 10 var url = Services.io.newFileURI(file).spec; 11 url = "jar:" + url + "!/test_bug370103"; 12 13 // Try opening channel with null listener 14 var channel = NetUtil.newChannel({ 15 uri: url, 16 loadUsingSystemPrincipal: true, 17 }); 18 19 var exception = false; 20 try { 21 channel.asyncOpen(null); 22 } catch (e) { 23 exception = true; 24 } 25 26 Assert.ok(exception); // should throw exception instead of crashing 27 }