Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | var Cc = Components.classes; |
michael@0 | 2 | var Ci = Components.interfaces; |
michael@0 | 3 | |
michael@0 | 4 | // Regression test for bug 370103 - crash when passing a null listener to |
michael@0 | 5 | // nsIChannel.asyncOpen |
michael@0 | 6 | function run_test() { |
michael@0 | 7 | // Compose the jar: url |
michael@0 | 8 | var ioService = Cc["@mozilla.org/network/io-service;1"]. |
michael@0 | 9 | getService(Ci.nsIIOService); |
michael@0 | 10 | var file = do_get_file("data/test_bug370103.jar"); |
michael@0 | 11 | var url = ioService.newFileURI(file).spec; |
michael@0 | 12 | url = "jar:" + url + "!/test_bug370103"; |
michael@0 | 13 | |
michael@0 | 14 | // Try opening channel with null listener |
michael@0 | 15 | var channel = ioService.newChannel(url, null, null); |
michael@0 | 16 | |
michael@0 | 17 | var exception = false; |
michael@0 | 18 | try { |
michael@0 | 19 | channel.asyncOpen(null, null); |
michael@0 | 20 | } |
michael@0 | 21 | catch(e) { |
michael@0 | 22 | exception = true; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | do_check_true(exception); // should throw exception instead of crashing |
michael@0 | 26 | } |