Thu, 15 Jan 2015 21:03:48 +0100
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 <head>
4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
6 </head>
7 <body>
9 <p id="display"></p>
10 <div id="content" style="display: none">
11 </div>
12 <pre id="test">
14 <script class="testbody" type="text/javascript">
16 function debug(msg) {
17 ok(1, msg);
18 }
20 function startsWith(target, prefix)
21 {
22 return target.indexOf(prefix) === 0;
23 }
25 function createArrayBufferContainingHelloWorld()
26 {
27 var hello = "Hello, world!";
28 var array = new Uint8Array(hello.length);
29 for (var i = 0; i < hello.length; ++i)
30 array[i] = hello.charCodeAt(i);
31 return array.buffer;
32 }
34 function createEmptyArrayBuffer()
35 {
36 return new ArrayBuffer(0);
37 }
39 function createArrayBufferContainingAllDistinctBytes()
40 {
41 var array = new Uint8Array(256);
42 for (var i = 0; i < 256; ++i)
43 array[i] = i;
44 return array.buffer;
45 }
47 var ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_check-binary-messages");
48 var closeEvent;
50 ws.onopen = function()
51 {
52 ok(true, "onopen reached");
53 ws.send(createArrayBufferContainingHelloWorld());
54 ws.send(createEmptyArrayBuffer());
55 ws.send(createArrayBufferContainingAllDistinctBytes());
56 };
58 ws.onmessage = function(event)
59 {
60 var message = event.data;
61 if (startsWith(message, "PASS"))
62 ok(true, message);
63 else
64 ok(false, message);
65 };
67 ws.onclose = function(event)
68 {
69 ok(event.wasClean, "should have closed cleanly");
70 SimpleTest.finish();
71 };
73 ws.onerror = function(event)
74 {
75 ok(false, "onerror should not have been called");
76 };
78 SimpleTest.waitForExplicitFinish();
80 </script>
81 </body>
82 </html>