tor-browser

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

sjs_delay-test-server.sjs (536B)


      1 "use strict";
      2 
      3 let timer;
      4 
      5 function handleRequest(request, response) {
      6   response.processAsync();
      7   const { queryString } = request;
      8   const DELAY_MS = queryString.split("=")[1];
      9   timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     10   timer.init(
     11     () => {
     12       response.setHeader("Content-Type", "text/html", false);
     13       response.write(
     14         "<body>Slow loading page for netmonitor test. You should never see this.</body>"
     15       );
     16       response.finish();
     17     },
     18     DELAY_MS,
     19     Ci.nsITimer.TYPE_ONE_SHOT
     20   );
     21 }