tor-browser

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

006.html (952B)


      1 <!doctype html>
      2 <title>WebSockets: converting first arguments</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 <meta name="variant" content="?wpt_flags=h2">
      9 <div id=log></div>
     10 <script>
     11 async_test(function(t) {
     12  var a = document.createElement('a');
     13  a.href = SCHEME_DOMAIN_PORT+'/echo';
     14  var ws = new WebSocket(a); // should stringify arguments; <a> stringifies to its .href
     15  assert_equals(ws.url, a.href);
     16  ws.onopen = t.step_func(function(e) {
     17    ws.send('test');
     18  });
     19  ws.onmessage = t.step_func(function(e) {
     20    assert_equals(e.data, 'test');
     21    ws.onclose = t.step_func(function(e) {
     22      ws.onclose = t.unreached_func();
     23      t.step_timeout(() => t.done(), 50);
     24    });
     25    ws.close();
     26  });
     27  ws.onerror = ws.onclose = t.unreached_func();
     28 });
     29 </script>