tor-browser

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

close-connecting.html (811B)


      1 <!doctype html>
      2 <title>WebSockets: close() when connecting</title>
      3 <meta name=timeout content=long>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src=../../../constants.sub.js></script>
      7 <meta name="variant" content="?default">
      8 <meta name="variant" content="?wss">
      9 <div id=log></div>
     10 <script>
     11 async_test(function(t) {
     12  var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/sleep_10_v13');
     13  t.step_timeout(function() {
     14    assert_equals(ws.readyState, ws.CONNECTING);
     15    ws.close();
     16    assert_equals(ws.readyState, ws.CLOSING);
     17    ws.onclose = t.step_func(function(e) {
     18      assert_equals(ws.readyState, ws.CLOSED);
     19      assert_equals(e.wasClean, false);
     20      t.done();
     21    });
     22  }, 1000);
     23  ws.onopen = ws.onclose = t.unreached_func();
     24 });
     25 </script>