tor-browser

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

direction.html (1524B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerconnection direction handling</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 
      8 promise_test(async t => {
      9  const pc1 = new RTCPeerConnection();
     10  t.add_cleanup(() => pc1.close());
     11  const pc2 = new RTCPeerConnection();
     12  t.add_cleanup(() => pc2.close());
     13 
     14  pc1.addTransceiver('audio').direction = 'recvonly';
     15  await pc1.setLocalDescription();
     16  await pc2.setRemoteDescription(pc1.localDescription);
     17  await pc2.setLocalDescription();
     18  return promise_rejects_dom(t, 'InvalidAccessError',
     19        pc1.setRemoteDescription({
     20            type: 'answer',
     21            // Since pc2 had no track to send the m-line will be inactive.
     22            sdp: pc2.localDescription.sdp.replace('inactive', 'recvonly')
     23        }));
     24 }, 'Rejects invalid modification of send direction');
     25 
     26 promise_test(async t => {
     27  const pc1 = new RTCPeerConnection();
     28  t.add_cleanup(() => pc1.close());
     29  const pc2 = new RTCPeerConnection();
     30  t.add_cleanup(() => pc2.close());
     31 
     32  pc1.addTransceiver('audio').direction = 'sendonly';
     33  await pc1.setLocalDescription();
     34  await pc2.setRemoteDescription(pc1.localDescription);
     35  await pc2.setLocalDescription();
     36  return promise_rejects_dom(t, 'InvalidAccessError',
     37        pc1.setRemoteDescription({
     38            type: 'answer',
     39            sdp: pc2.localDescription.sdp.replace('recvonly', 'sendrecv')
     40        }));
     41 }, 'Rejects invalid modification of receive direction');
     42 </script>