tor-browser

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

bufferedAmount-unchanged-by-sync-xhr.any.js (785B)


      1 // META: script=constants.sub.js
      2 // META: global=window,dedicatedworker,sharedworker
      3 // META: variant=?default
      4 // META: variant=?wss
      5 // META: variant=?wpt_flags=h2
      6 
      7 async_test(t => {
      8  const ws = CreateWebSocket(false, false);
      9  ws.onopen = t.step_func(() => {
     10    ws.onclose = ws.onerror = null;
     11    assert_equals(ws.bufferedAmount, 0);
     12    ws.send('hello');
     13    assert_equals(ws.bufferedAmount, 5);
     14    // Stop execution for 1s with a sync XHR.
     15    const xhr = new XMLHttpRequest();
     16    xhr.open('GET', '/common/blank.html?pipe=trickle(d1)', false);
     17    xhr.send();
     18    assert_equals(ws.bufferedAmount, 5);
     19    ws.close();
     20    t.done();
     21  });
     22  ws.onerror = ws.onclose = t.unreached_func('open should succeed');
     23 }, 'bufferedAmount should not be updated during a sync XHR');
     24 
     25 done();