tor-browser

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

websocket_frontend_iframe.html (1001B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 <!doctype HTML>
      4 <html>
      5  <head>
      6    <meta charset="utf-8"/>
      7    <title>Websocket Inspection Test Page</title>
      8  </head>
      9  <body>
     10    <h1>Websocket Inspection Test Page</h1>
     11    <script type="text/javascript">
     12    /* exported openConnection, closeConnection, sendData */
     13    "use strict";
     14 
     15    let webSocket;
     16    function openConnection() {
     17      return new Promise(resolve => {
     18        webSocket = new WebSocket(
     19          "wss://example.com/browser/devtools/shared/commands/resource/tests/websocket_backend"
     20        );
     21        webSocket.onopen = () => {
     22          resolve();
     23        };
     24      });
     25    }
     26 
     27    function closeConnection() {
     28      return new Promise(resolve => {
     29        webSocket.onclose = () => {
     30          resolve();
     31        };
     32        webSocket.close();
     33      })
     34    }
     35 
     36    function sendData(payload) {
     37      webSocket.send(payload);
     38    }
     39    </script>
     40  </body>
     41 </html>