tor-browser

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

Close-server-initiated-close.any.js (795B)


      1 // META: script=constants.sub.js
      2 // META: variant=?default
      3 // META: variant=?wpt_flags=h2
      4 // META: variant=?wss
      5 
      6 var test = async_test("Create WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - 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.send("Goodbye");
     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(wsocket.readyState, 3, "readyState should be 3(CLOSED)");
     19  assert_equals(evt.wasClean, true, "wasClean should be TRUE");
     20  test.done();
     21 }), true);