tor-browser

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

keepalive-requests.html (1355B)


      1 <!doctype html>
      2 <html>
      3 
      4 <head>
      5    <meta charset="utf-8">
      6    <title>page sending fetch keepalive requests</title>
      7    <meta name="timeout" content="long">
      8    <script src="/common/get-host-info.sub.js"></script>
      9    <script src="/resources/testharness.js"></script>
     10    <script src="/resources/testharnessreport.js"></script>
     11    <script src="/fetch/api/resources/keepalive-helper.js"></script>
     12 </head>
     13 
     14 <body>
     15    <script>
     16        'use strict';
     17 
     18        const standardDelay = 2000;
     19        try {
     20            let fetchPromises = [];
     21            const numberOfRequests = 5;
     22 
     23            for (let i = 0; i < numberOfRequests; i++) {
     24                fetchPromises.push(createPendingKeepAliveRequest(standardDelay, true));
     25            }
     26 
     27            window.opener.postMessage("REQUEST SENT", "*");
     28            Promise.all(fetchPromises)
     29                .then(() => {
     30                    // All requests complete, send request complete message
     31                    window.opener.postMessage("REQUEST COMPLETED", "*");
     32                })
     33                .catch((error) => {
     34                    // One or more requests failed, log the error
     35                    window.opener.postMessage("FAIL", "*");
     36                });
     37        } catch (error) {
     38            (error);
     39            window.opener.postMessage("FAIL", "*");
     40        }
     41 
     42    </script>
     43 </body>
     44 
     45 </html>