tor-browser

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

network-partition-about-blank-checker.html (1159B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>about:blank Network Partition Checker</title>
      6  <meta name="help" href="https://fetch.spec.whatwg.org/#network-partition-keys">
      7  <meta name="timeout" content="normal">
      8 </head>
      9 <body>
     10 <script>
     11  async function fetch_and_reply() {
     12    // Load about:blank in a new tab, and inject the network partition checking code into it.
     13    var win;
     14    try {
     15      win = window.open();
     16      var url = 'SUBRESOURCE_PREFIX:&dispatch=fetch_file&path=fetch/connection-pool/resources/network-partition-checker.html&sandbox=true';
     17      var response = await fetch(url, {credentials: 'omit', mode: 'cors'});
     18      win.document.write(await response.text());
     19    } catch (e) {
     20      win.close();
     21      window.parent.postMessage({result: 'error', details: e.message}, '*');
     22      return;
     23    }
     24 
     25    // Listen for first message from the new window and pass it back to the parent.
     26    function message_listener(event) {
     27      window.parent.postMessage(event.data, '*');
     28      win.close();
     29    }
     30    window.addEventListener('message', message_listener, {once: true});
     31  }
     32  fetch_and_reply();
     33 </script>
     34 </body>
     35 </html>