1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_invalidport.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +// This is essentially a crashtest for accessing an out of range port 1.5 +// Perform the async open several times in order to induce exponential 1.6 +// scheduling behavior bugs. 1.7 + 1.8 +const CC = Components.Constructor; 1.9 + 1.10 +var counter = 0; 1.11 +const iterations = 10; 1.12 + 1.13 +var listener = { 1.14 + onStartRequest: function test_onStartR(request, ctx) { 1.15 + }, 1.16 + 1.17 + onDataAvailable: function test_ODA() { 1.18 + do_throw("Should not get any data!"); 1.19 + }, 1.20 + 1.21 + onStopRequest: function test_onStopR(request, ctx, status) { 1.22 + if (counter++ == iterations) 1.23 + do_test_finished(); 1.24 + else 1.25 + execute_test(); 1.26 + }, 1.27 +}; 1.28 + 1.29 +function run_test() { 1.30 + execute_test(); 1.31 + do_test_pending(); 1.32 +} 1.33 + 1.34 +function execute_test() { 1.35 + var ios = Cc["@mozilla.org/network/io-service;1"]. 1.36 + getService(Ci.nsIIOService); 1.37 + var chan = ios.newChannel("http://localhost:75000", "", null); 1.38 + chan.QueryInterface(Ci.nsIHttpChannel); 1.39 + chan.asyncOpen(listener, null); 1.40 +} 1.41 +