tor-browser

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

Close-readyState-Closing.any.js (658B)


      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 - readyState should be in CLOSING state just before onclose is called");
      7 
      8 var wsocket = CreateWebSocket(false, false);
      9 var isOpenCalled = false;
     10 
     11 wsocket.addEventListener('open', test.step_func(function(evt) {
     12  isOpenCalled = true;
     13  wsocket.close();
     14  assert_equals(wsocket.readyState, 2, "readyState should be 2(CLOSING)");
     15 }), true);
     16 
     17 wsocket.addEventListener('close', test.step_func(function(evt) {
     18  assert_true(isOpenCalled, 'open must be called');
     19  test.done();
     20 }), true);