tor-browser

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

001.html (867B)


      1 <!doctype html>
      2 <title>WebSockets: Send/Receive blob, blob size less than network array buffer</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 ws = new WebSocket(SCHEME_DOMAIN_PORT + '/echo');
     13  var data = "";
     14  var datasize = 10;
     15  ws.onopen = t.step_func(function(e) {
     16   ws.binaryType = "blob";
     17   data = new ArrayBuffer(datasize);
     18   ws.send(data);
     19  })
     20  ws.onmessage = t.step_func(function(e) {
     21    assert_true(e.data instanceof Blob);
     22    assert_equals(e.data.size, datasize);
     23    t.done();
     24  })
     25  ws.onclose = t.unreached_func('close event should not fire');
     26 });
     27 </script>