4 <script src="../../../../js-test-resources/js-test-pre.js"></script>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script type="text/javascript">
10 description("WebSocket.protocol should not be modified.");
12 window.jsTestIsAsync = true;
13 if (window.layoutTestController)
14 layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
16 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/accept-first-subprotocol", "chat");
19 shouldBeEqualToString("ws.protocol", "");
20 ws.protocol = "superchat";
21 shouldBeEqualToString("ws.protocol", "");
23 ws.onopen = function()
26 shouldBeEqualToString("ws.protocol", "chat");
27 ws.protocol = "superchat";
28 shouldBeEqualToString("ws.protocol", "chat");
31 ws.onclose = function(event)
34 shouldBeEqualToString("ws.protocol", "chat");
35 ws.protocol = "superchat";
36 shouldBeEqualToString("ws.protocol", "chat");
38 shouldBeTrue("closeEvent.wasClean");
39 setTimeout("checkAfterOnClose()", 0);
42 function checkAfterOnClose()
44 debug("Exited onclose handler");
45 shouldBeEqualToString("ws.protocol", "chat");
46 ws.protocol = "superchat";
47 shouldBeEqualToString("ws.protocol", "chat");
52 <script src="../../../../js-test-resources/js-test-post.js"></script>