tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Close-1005-verify-code.any.js (734B)


      1 // META: script=constants.sub.js
      2 // META: variant=?default
      3 // META: variant=?wss
      4 // META: variant=?wpt_flags=h2
      5 
      6 var test = async_test("Create WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed");
      7 
      8 var wsocket = CreateWebSocket(false, false);
      9 var isOpenCalled = false;
     10 
     11 wsocket.addEventListener('open', test.step_func(function(evt) {
     12  wsocket.close();
     13  isOpenCalled = true;
     14 }), true);
     15 
     16 wsocket.addEventListener('close', test.step_func(function(evt) {
     17  assert_true(isOpenCalled, "WebSocket connection should be open");
     18  assert_equals(evt.code, 1005, "CloseEvent.code should be 1005");
     19  assert_equals(evt.reason, "", "CloseEvent.reason should be empty");
     20  test.done();
     21 }), true);