https://github.com/web-platform-tests/wpt
Raw File
Tip revision: acc0c18614330cd8cc280eae0a3a1977889f00c4 authored by Lennart Grahl on 09 May 2018, 13:35:25 UTC
Update all data channel tests to use async/await
Tip revision: acc0c18
eventhandlers.any.js
// META: script=websocket.sub.js

function testEventHandler(name) {
  test(function() {
    var ws = new WebSocket("ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH,
      "echo")
    assert_equals(ws["on" + name], null);
    ws["on" + name] = function() {};
    ws["on" + name] = 2;
    assert_equals(ws["on" + name], null);
  }, "Event handler for " + name + " should have [TreatNonCallableAsNull]")
}
["open", "error", "close", "message"].forEach(testEventHandler);
back to top