Revision 36857c5f01b941752b8877902dccd8b7b01202be authored by Tooru Fujisawa on 02 October 2018, 08:23:59 UTC, committed by moz-wptsync-bot on 02 October 2018, 08:23:59 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1495601
gecko-commit: 6568853848ac62384a094e521965e101978b1f62
gecko-integration-branch: mozilla-inbound
gecko-reviewers: sfink
1 parent b7fcdf3
Raw File
Secure-Close-3000-verify-code.any.js
// META: script=websocket.sub.js

var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed");

var wsocket = CreateWebSocket(true, false, false);
var isOpenCalled = false;

wsocket.addEventListener('open', testOpen.step_func(function(evt) {
  wsocket.close(3000, "Clean Close");
  isOpenCalled = true;
  testOpen.done();
}), true);

wsocket.addEventListener('close', testClose.step_func(function(evt) {
  assert_true(isOpenCalled, "WebSocket connection should be open");
  assert_equals(evt.code, 3000, "CloseEvent.code should be 3000");
  testClose.done();
}), true);
back to top