[Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / alert-in-event-handler.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../js-test-resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script type="text/javascript">
10 description("Make sure event handler called serially.");
11
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14     layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 1);
15
16 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/send2");
17
18 ws.onopen = function()
19 {
20     debug("Connected");
21 };
22
23 ws.onmessage = function(messageEvent)
24 {
25     debug("Enter onmessage: " + messageEvent.data);
26     // alert() will suspend/resume WebSocket.
27     alert("message handled." + messageEvent.data);
28     debug("Leave onmessage: " + messageEvent.data);
29 };
30
31 ws.onclose = function()
32 {
33     debug("Closed");
34     finishJSTest();
35 };
36
37 debug("alert will suspend/resume WebSocket.");
38 alert("waiting for open");
39 debug("onopen should fire later.");
40 </script>
41 <script src="../../../../js-test-resources/js-test-post.js"></script>
42 </body>
43 </html>