tor-browser

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

test_websocket_hello.html (1000B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 -->
      5 <head>
      6  <title>Basic websocket test</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body onload="testWebSocket()">
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472529">Mozilla Bug </a>
     12 <p id="display"></p>
     13 <div id="content" style="display: none">
     14 </div>
     15 <pre id="test">
     16 <script class="testbody" type="text/javascript">
     17 
     18 var ws;
     19 
     20 function testWebSocket () {
     21  ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
     22  ws.onopen = function() {
     23    ws.send("data");
     24  }
     25  ws.onclose = function() {
     26  }
     27  ws.onerror = function() {
     28    ok(false, "onerror called!");
     29    SimpleTest.finish();
     30  }
     31  ws.onmessage = function(e) {
     32    is(e.data, "Hello world!", "Wrong data");
     33    ws.close();
     34    SimpleTest.finish();
     35  }
     36 }
     37 
     38 SimpleTest.waitForExplicitFinish();
     39 
     40 </script>
     41 </pre>
     42 <div>
     43 
     44 
     45 </div>
     46 
     47 
     48 </body>
     49 </html>