michael@0: // This is essentially a crashtest for accessing an out of range port michael@0: // Perform the async open several times in order to induce exponential michael@0: // scheduling behavior bugs. michael@0: michael@0: const CC = Components.Constructor; michael@0: michael@0: var counter = 0; michael@0: const iterations = 10; michael@0: michael@0: var listener = { michael@0: onStartRequest: function test_onStartR(request, ctx) { michael@0: }, michael@0: michael@0: onDataAvailable: function test_ODA() { michael@0: do_throw("Should not get any data!"); michael@0: }, michael@0: michael@0: onStopRequest: function test_onStopR(request, ctx, status) { michael@0: if (counter++ == iterations) michael@0: do_test_finished(); michael@0: else michael@0: execute_test(); michael@0: }, michael@0: }; michael@0: michael@0: function run_test() { michael@0: execute_test(); michael@0: do_test_pending(); michael@0: } michael@0: michael@0: function execute_test() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: var chan = ios.newChannel("http://localhost:75000", "", null); michael@0: chan.QueryInterface(Ci.nsIHttpChannel); michael@0: chan.asyncOpen(listener, null); michael@0: } michael@0: