tor-browser

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

permissions-policy-video.https.sub.html (1474B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <body>
      4  <script src="/resources/testharness.js"
      5          type="text/javascript{{GET[in-iframe]}}"></script>
      6  <script src="/resources/testharnessreport.js"
      7          type="text/javascript{{GET[in-iframe]}}"></script>
      8  <script src="/resources/testdriver.js"></script>
      9  <script src="/resources/testdriver-vendor.js"></script>
     10  <script src="/common/get-host-info.sub.js"></script>
     11  <script src="/permissions-policy/resources/permissions-policy.js"></script>
     12  <script>
     13  'use strict';
     14 
     15  async function getDisplayMedia(constraints) {
     16    await test_driver.bless('transient activation for getDisplayMedia()');
     17    return navigator.mediaDevices.getDisplayMedia(constraints);
     18  }
     19 
     20  async function testGDM({audio, video}) {
     21    let stream;
     22    try {
     23      stream = await getDisplayMedia({audio, video});
     24      if (stream.getVideoTracks().length == 0) {
     25        throw Error(`requested video track must be present with ` +
     26                     `audio ${audio} and video ${video}, or fail`);
     27      }
     28    } finally {
     29      if (stream) {
     30        stream.getTracks().forEach(track => track.stop());
     31      }
     32    }
     33  }
     34 
     35  if (page_loaded_in_iframe()) {
     36    test_driver.set_test_context(window.parent);
     37  }
     38  const cross_domain = get_host_info().HTTPS_REMOTE_ORIGIN;
     39  run_all_fp_tests_allow_self(
     40    cross_domain,
     41    'display-capture',
     42    'NotAllowedError',
     43    async () => {
     44      await testGDM({video: true});
     45    }
     46  );
     47  </script>
     48 </body>