tor-browser

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

html_infinite-get-page.html (1274B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 <!doctype html>
      4 
      5 <html>
      6  <head>
      7    <meta charset="utf-8"/>
      8    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
      9    <meta http-equiv="Pragma" content="no-cache" />
     10    <meta http-equiv="Expires" content="0" />
     11    <title>Network Monitor test page</title>
     12  </head>
     13 
     14  <body>
     15    <p>Infinite GETs</p>
     16 
     17    <script type="text/javascript">
     18      "use strict";
     19 
     20      function get(address) {
     21        return new Promise(resolve => {
     22          const xhr = new XMLHttpRequest();
     23          xhr.open("GET", address, true);
     24 
     25          xhr.onreadystatechange = function() {
     26            if (this.readyState == this.DONE) {
     27              resolve();
     28            }
     29          };
     30          xhr.send(null);
     31        });
     32      }
     33 
     34      // Use a count parameter to defeat caching.
     35      let count = 0;
     36      let doRequests = true;
     37      function stopRequests() { // eslint-disable-line no-unused-vars
     38        doRequests = false;
     39      }
     40 
     41      (async function performRequests() {
     42        await get("request_" + (count++));
     43        if (doRequests) {
     44          setTimeout(performRequests, 50);
     45        }
     46      })();
     47    </script>
     48  </body>
     49 
     50 </html>