tor-browser

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

slow_loading_page.sjs (680B)


      1 /* Any copyright is dedicated to the Public Domain.
      2  * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 const DELAY_MS = 400;
      5 
      6 const HTML = `<!DOCTYPE HTML>
      7 <html dir="ltr" xml:lang="en-US" lang="en-US">
      8   <head>
      9     <meta charset="utf8">
     10   </head>
     11   <body>hi mom!
     12   </body>
     13 </html>`;
     14 
     15 function handleRequest(req, resp) {
     16   resp.processAsync();
     17 
     18   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     19   timer.init(
     20     () => {
     21       resp.setHeader("Cache-Control", "no-cache", false);
     22       resp.setHeader("Content-Type", "text/html;charset=utf-8", false);
     23       resp.write(HTML);
     24       resp.finish();
     25     },
     26     DELAY_MS,
     27     Ci.nsITimer.TYPE_ONE_SHOT
     28   );
     29 }