tor-browser

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

005.html (902B)


      1 <!doctype html>
      2 <title>WebSockets: response header and close frame in same packet</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 async_test(function(t) {
     11  var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/simple_handshake');
     12  ws.onmessage = t.unreached_func();
     13  ws.onopen = t.step_func(function(e) {
     14    ws.onclose = t.step_func(function(e) {
     15      assert_equals(e.wasClean, true);
     16      assert_equals(e.code, 1001);
     17      assert_equals(e.reason, 'PASS');
     18      ws.onclose = t.unreached_func('onclose should not be called twice');
     19      t.step_timeout(() => t.done(), 50);
     20    })
     21    ws.close();
     22  })
     23  ws.onclose = t.unreached_func('onclose should not be called before onopen');
     24 });
     25 </script>