OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/js-test-resources/js-test.js"></script> | 4 <script src="/js-test-resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="description"></div> | 7 <div id="description"></div> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description("Test whether WebSocket aborts the connection when it receives a tex
t frame containing broken UTF-8 data."); | 10 description("Test whether WebSocket aborts the connection when it receives a tex
t frame containing broken UTF-8 data."); |
11 | 11 |
12 window.jsTestIsAsync = true; | 12 window.jsTestIsAsync = true; |
13 | 13 |
14 var ws = new WebSocket("ws://127.0.0.1:8880/broken-utf8"); | 14 var ws = new WebSocket("ws://127.0.0.1:8880/broken-utf8"); |
15 var closeEvent; | 15 var closeEvent; |
16 | 16 |
17 ws.onopen = function() | 17 ws.onopen = function() |
18 { | 18 { |
19 debug("onopen() was called."); | 19 debug("onopen() was called."); |
20 }; | 20 }; |
21 | 21 |
| 22 ws.onerror = function(event) |
| 23 { |
| 24 debug("onerror() was called."); |
| 25 }; |
| 26 |
22 ws.onmessage = function(event) | 27 ws.onmessage = function(event) |
23 { | 28 { |
24 var message = event.data; | 29 var message = event.data; |
25 testFailed("onmessage() was called. (message = \"" + message + "\")"); | 30 testFailed("onmessage() was called. (message = \"" + message + "\")"); |
26 }; | 31 }; |
27 | 32 |
28 ws.onclose = function(event) | 33 ws.onclose = function(event) |
29 { | 34 { |
30 debug("onclose() was called."); | 35 debug("onclose() was called."); |
31 closeEvent = event; | 36 closeEvent = event; |
32 shouldBeFalse("closeEvent.wasClean"); | 37 shouldBeFalse("closeEvent.wasClean"); |
33 finishJSTest(); | 38 finishJSTest(); |
34 }; | 39 }; |
35 | 40 |
36 </script> | 41 </script> |
37 </body> | 42 </body> |
38 </html> | 43 </html> |
OLD | NEW |