|
1 function run_test() { |
|
2 var stream = Cc["@mozilla.org/io/string-input-stream;1"]. |
|
3 createInstance(Ci.nsISupportsCString); |
|
4 stream.data = "foo bar baz"; |
|
5 |
|
6 var pump = Cc["@mozilla.org/network/input-stream-pump;1"]. |
|
7 createInstance(Ci.nsIInputStreamPump); |
|
8 pump.init(stream, -1, -1, 0, 0, false); |
|
9 |
|
10 // When we pass a null listener argument too asyncRead we expect it to throw |
|
11 // instead of crashing. |
|
12 try { |
|
13 pump.asyncRead(null, null); |
|
14 } |
|
15 catch (e) { |
|
16 return; |
|
17 } |
|
18 |
|
19 do_throw("asyncRead didn't throw when passed a null listener argument."); |
|
20 } |