https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c2b8c888626597462c9e9261aa1bedd4c4edb850 authored by Frédéric Wang on 27 June 2018, 07:37:03 UTC
Convert to manual test, add a version where the click happens from a subframe
Tip revision: c2b8c88
close-invalid.any.js
// META: script=websocket.sub.js

[
  [0, "0"],
  [500, "500"],
  [NaN, "NaN"],
  ["string", "String"],
  [null, "null"],
  [0x10000 + 1000, "2**16+1000"],
].forEach(function(t) {
  [true, false].forEach(function(secure) {
    test(function() {
      var ws = CreateWebSocket(secure, false, false);
      assert_throws("InvalidAccessError", function() {
        ws.close(t[0]);
      });
      wsocket.onerror = this.unreached_func();
    }, t[1] + " on a " + (secure ? "secure" : "insecure") + " websocket");
  });
});
back to top