netwerk/test/unit/test_invalidport.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial