| krisk@microsoft.com | 8fec27d | 2012-10-30 10:59:19 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <title>WebSocket event handlers</title> |
| 3 | <script src="/resources/testharness.js"></script> |
| 4 | <script src="/resources/testharnessreport.js"></script> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 5 | <script src="websocket.js?pipe=sub"></script> |
| krisk@microsoft.com | 8fec27d | 2012-10-30 10:59:19 | [diff] [blame] | 6 | <div id="log"></div> |
| 7 | <script> |
| 8 | function testEventHandler(name) { |
| 9 | test(function() { |
| 10 | var ws = new WebSocket("ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH, |
| 11 | "echo") |
| 12 | assert_equals(ws["on" + name], null); |
| 13 | ws["on" + name] = function() {}; |
| 14 | ws["on" + name] = 2; |
| 15 | assert_equals(ws["on" + name], null); |
| 16 | }, "Event handler for " + name + " should have [TreatNonCallableAsNull]") |
| 17 | } |
| 18 | ["open", "error", "close", "message"].forEach(testEventHandler); |
| 19 | </script> |