tor-browser

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

RTCPeerConnection-add-track-no-deadlock.https.html (1287B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerConnection addTrack does not deadlock</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="RTCPeerConnection-helper.js"></script>
      7 <script>
      8  'use strict';
      9 
     10  // This test sets up two peer connections using a sequence of operations
     11  // that triggered a deadlock in Chrome. See https://crbug.com/736725.
     12  // If a deadlock is introduced again, this test times out.
     13  promise_test(async t => {
     14    const pc1 = new RTCPeerConnection();
     15    t.add_cleanup(() => pc1.close());
     16    const stream = await getNoiseStream(
     17      {audio: false, video: true});
     18    t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
     19    const videoTrack = stream.getVideoTracks()[0];
     20    pc1.addTrack(videoTrack, stream);
     21    const offer = await pc1.createOffer();
     22    await pc1.setLocalDescription(offer);
     23    const pc2 = new RTCPeerConnection();
     24    t.add_cleanup(() => pc2.close());
     25    const srdPromise = pc2.setRemoteDescription(offer);
     26    pc2.addTrack(videoTrack, stream);
     27    // The deadlock encountered in https://crbug.com/736725 occured here.
     28    await srdPromise;
     29    await pc2.createAnswer();
     30  }, 'RTCPeerConnection addTrack does not deadlock.');
     31 </script>