tor-browser

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

different_html.sjs (778B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2  * License, v. 2.0. If a copy of the MPL was not distributed with this
      3  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 "use strict";
      6 
      7 const contents = `
      8 <div>Hello COUNTER</div>
      9 <script>
     10 function f() {
     11   console.log("First Inline Script " + COUNTER);
     12 }
     13 setInterval(f, 1000);
     14 </script>
     15 <script>
     16 function f() {
     17   console.log("Second Inline Script " + COUNTER);
     18 }
     19 setInterval(f, 1000);
     20 </script>
     21 `;
     22 
     23 function handleRequest(request, response) {
     24   response.setHeader("Cache-Control", "no-store");
     25   response.setHeader("Content-Type", "text/html");
     26 
     27   let counter = 1 + (+getState("counter") % 4);
     28   setState("counter", "" + counter);
     29 
     30   response.write(contents.replace(/COUNTER/g, counter));
     31 }