|
1 // This is essentially a crashtest for accessing an out of range port |
|
2 // Perform the async open several times in order to induce exponential |
|
3 // scheduling behavior bugs. |
|
4 |
|
5 const CC = Components.Constructor; |
|
6 |
|
7 var counter = 0; |
|
8 const iterations = 10; |
|
9 |
|
10 var listener = { |
|
11 onStartRequest: function test_onStartR(request, ctx) { |
|
12 }, |
|
13 |
|
14 onDataAvailable: function test_ODA() { |
|
15 do_throw("Should not get any data!"); |
|
16 }, |
|
17 |
|
18 onStopRequest: function test_onStopR(request, ctx, status) { |
|
19 if (counter++ == iterations) |
|
20 do_test_finished(); |
|
21 else |
|
22 execute_test(); |
|
23 }, |
|
24 }; |
|
25 |
|
26 function run_test() { |
|
27 execute_test(); |
|
28 do_test_pending(); |
|
29 } |
|
30 |
|
31 function execute_test() { |
|
32 var ios = Cc["@mozilla.org/network/io-service;1"]. |
|
33 getService(Ci.nsIIOService); |
|
34 var chan = ios.newChannel("http://localhost:75000", "", null); |
|
35 chan.QueryInterface(Ci.nsIHttpChannel); |
|
36 chan.asyncOpen(listener, null); |
|
37 } |
|
38 |