2f26a2219ed829193000a12d912bd9f5a5342785
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / alert-in-event-handler.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
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 type="text/javascript">
11 description("Make sure event handler called serially.");
12
13 window.jsTestIsAsync = true;
14
15 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/send2");
16
17 ws.onopen = function()
18 {
19     debug("Connected");
20 };
21
22 ws.onmessage = function(messageEvent)
23 {
24     debug("Enter onmessage: " + messageEvent.data);
25     // alert() will suspend/resume WebSocket.
26     alert("message handled." + messageEvent.data);
27     debug("Leave onmessage: " + messageEvent.data);
28 };
29
30 ws.onclose = function()
31 {
32     debug("Closed");
33     finishJSTest();
34 };
35
36 debug("alert will suspend/resume WebSocket.");
37 alert("waiting for open");
38 debug("onopen should fire later.");
39 var successfullyParsed = true;
40 </script>
41 <script src="../../../js-test-resources/js-test-post.js"></script>
42 </body>
43 </html>