tor-browser

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

file_insecure_reload.sjs (798B)


      1 // https://bugzilla.mozilla.org/show_bug.cgi?id=1702001
      2 
      3 // An onload postmessage to window opener
      4 const ON_LOAD = `
      5   <html>
      6   <body>
      7   send onload message...
      8   <script type="application/javascript">
      9     window.opener.postMessage({result: 'you entered the http page', historyLength: history.length}, '*');
     10   </script>
     11   </body>
     12   </html>`;
     13 
     14 // When an https request is sent, cause a timeout so that the https-only error
     15 // page is displayed.
     16 function handleRequest(request, response) {
     17   response.setHeader("Cache-Control", "no-cache", false);
     18   if (request.scheme === "https") {
     19     // Simulating a timeout by processing the https request
     20     // async and *never* return anything!
     21     response.processAsync();
     22     return;
     23   }
     24   if (request.scheme === "http") {
     25     response.write(ON_LOAD);
     26   }
     27 }