netwerk/test/unit/test_invalidport.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     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.
     5 const CC = Components.Constructor;
     7 var counter = 0;
     8 const iterations = 10;
    10 var listener = {
    11   onStartRequest: function test_onStartR(request, ctx) {
    12   },
    14   onDataAvailable: function test_ODA() {
    15     do_throw("Should not get any data!");
    16   },
    18   onStopRequest: function test_onStopR(request, ctx, status) {
    19     if (counter++ == iterations)
    20       do_test_finished();
    21     else
    22       execute_test();
    23   },
    24 };
    26 function run_test() {
    27   execute_test();
    28   do_test_pending();
    29 }
    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 }

mercurial