content/base/test/test_websocket_hello.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 -->
     5 <head>
     6   <title>Basic websocket test</title>
     7   <script type="text/javascript" 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">
    18 var ws;
    20 function testWebSocket () {
    21   ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_hello");
    22   ws.onopen = function(e) {
    23     ws.send("data");
    24   }
    25   ws.onclose = function(e) {
    26   }
    27   ws.onerror = function(e) {
    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 }
    38 SimpleTest.waitForExplicitFinish();
    40 </script>
    41 </pre>
    42 <div>
    45 </div>
    48 </body>
    49 </html>

mercurial