1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
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("Make sure WebSocket fires CloseEvent when closed.");
12 window.jsTestIsAsync = true;
14 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/simple");
16 ws.onopen = function()
18 debug("WebSocket is open");
21 ws.onmessage = function(messageEvent)
23 debug("Received: '" + messageEvent.data + "'");
28 ws.onclose = function(event)
32 closeEventType = closeEvent.type;
33 shouldBe("closeEventType", '"close"')
34 shouldBeTrue("'wasClean' in closeEvent");
35 shouldBeTrue("closeEvent.wasClean");
36 shouldBeTrue("Object.getPrototypeOf(closeEvent) === CloseEvent.prototype");
37 shouldBeTrue("Object.getPrototypeOf(closeEvent) !== Event.prototype");
42 <script src="../../../../js-test-resources/js-test-post.js"></script>