WebSocket: Implement hybi framing
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hybi / broken-utf8.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../../js-test-resources/js-test-style.css">
5 <script src="../../../../js-test-resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <div id="description"></div>
9 <div id="console"></div>
10 <script>
11 description("Test whether WebSocket aborts the connection when it receives a text frame containing broken UTF-8 data.");
12
13 window.jsTestIsAsync = true;
14 if (window.layoutTestController)
15     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
16
17 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/broken-utf8");
18 var closeEvent;
19
20 ws.onopen = function()
21 {
22     debug("onopen() was called.");
23 };
24
25 ws.onmessage = function(event)
26 {
27     var message = event.data;
28     testFailed("onmessage() was called. (message = \"" + message + "\")");
29 };
30
31 ws.onclose = function(event)
32 {
33     debug("onclose() was called.");
34     closeEvent = event;
35     shouldBeFalse("closeEvent.wasClean");
36     finishJSTest();
37 };
38
39 var successfullyParsed = true;
40 </script>
41 <script src="../../../../js-test-resources/js-test-post.js"></script>
42 </body>
43 </html>