tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_freshconnection.js (738B)


      1 // This is essentially a debug mode crashtest to make sure everything
      2 // involved in a reload runs on the right thread. It relies on the
      3 // assertions in necko.
      4 
      5 "use strict";
      6 
      7 var listener = {
      8  onStartRequest: function test_onStartR() {},
      9 
     10  onDataAvailable: function test_ODA() {
     11    do_throw("Should not get any data!");
     12  },
     13 
     14  onStopRequest: function test_onStopR() {
     15    do_test_finished();
     16  },
     17 };
     18 
     19 function run_test() {
     20  var chan = NetUtil.newChannel({
     21    uri: "http://localhost:4444",
     22    loadUsingSystemPrincipal: true,
     23  });
     24  chan.loadFlags =
     25    Ci.nsIRequest.LOAD_FRESH_CONNECTION |
     26    Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
     27  chan.QueryInterface(Ci.nsIHttpChannel);
     28  chan.asyncOpen(listener);
     29  do_test_pending();
     30 }