OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
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 type="text/javascript"> | 9 <script type="text/javascript"> |
10 description("Make sure WebSocket gives errors on long invalid upgrade header."); | 10 description("Make sure WebSocket gives errors on long invalid upgrade header."); |
11 | 11 |
12 window.jsTestIsAsync = true; | 12 window.jsTestIsAsync = true; |
13 | 13 |
14 function finish() { | 14 function finish() { |
15 clearTimeout(timeoutID); | 15 clearTimeout(timeoutID); |
16 finishJSTest(); | 16 finishJSTest(); |
17 } | 17 } |
18 | 18 |
19 var ws = new WebSocket("ws://127.0.0.1:8880/long-invalid-header"); | 19 var ws = new WebSocket("ws://127.0.0.1:8880/long-invalid-header"); |
20 ws.onopen = function () { | 20 ws.onopen = function () { |
21 debug("WebSocket is open"); | 21 debug("WebSocket is open"); |
22 }; | 22 }; |
23 ws.onclose = function () { | 23 ws.onclose = function () { |
24 debug("WebSocket is closed"); | 24 debug("WebSocket is closed"); |
25 finish(); | 25 finish(); |
26 }; | 26 }; |
| 27 ws.onerror = function(errorEvent) |
| 28 { |
| 29 testPassed("onerror() was called"); |
| 30 }; |
27 var timeoutID = setTimeout("finish()", 2000); | 31 var timeoutID = setTimeout("finish()", 2000); |
28 | 32 |
29 </script> | 33 </script> |
30 </body> | 34 </body> |
31 </html> | 35 </html> |
OLD | NEW |