tor-browser

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

close-multiple.html (691B)


      1 <!doctype html>
      2 <title>WebSockets: close() several times</title>
      3 <script src=/resources/testharness.js></script>
      4 <script src=/resources/testharnessreport.js></script>
      5 <script src=../../../constants.sub.js></script>
      6 <meta name="variant" content="?default">
      7 <meta name="variant" content="?wss">
      8 <div id=log></div>
      9 <script>
     10 var i = 0;
     11 async_test(function(t) {
     12  var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
     13  ws.onclose = t.step_func(function(e) {
     14    i++;
     15  });
     16  ws.close();
     17  ws.close();
     18  ws.close();
     19  var f = t.step_func(function() {
     20    if (i < 1) {
     21      t.step_timeout(f, 500);
     22      return;
     23    }
     24    assert_equals(i, 1);
     25    t.done()
     26  });
     27  t.step_timeout(f, 500);
     28 });
     29 </script>