tor-browser

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

report-to-multiple-endpoints.https.sub.html (1854B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <script src='/resources/testharness.js'></script>
      5    <script src='/resources/testharnessreport.js'></script>
      6    <script src='/resources/testdriver.js'></script>
      7    <script src='/resources/testdriver-vendor.js'></script>
      8    <script src='../../mediacapture-streams/permission-helper.js'></script>
      9    <script src='/reporting/resources/report-helper.js'></script>
     10  </head>
     11  <body>
     12    <script>
     13  const base_url = `${location.protocol}//${location.host}`;
     14  const endpoint = `${base_url}/reporting/resources/report.py`;
     15  const camera_id = '6e0f343f-0a7a-4fee-82d9-00eb64531c26';
     16  const microphone_id = 'c63eecea-490b-4c38-8c4b-d72ecccd4e31';
     17 
     18  promise_test(async t => {
     19    await setMediaPermission("granted", ["camera","microphone"]);
     20    await promise_rejects_dom(
     21        t, "NotAllowedError", navigator.mediaDevices.getUserMedia({video: true}),
     22        "UserMedia camera access should not be allowed in this document.");
     23    await promise_rejects_dom(
     24        t, "NotAllowedError", navigator.mediaDevices.getUserMedia({audio: true}),
     25        "UserMedia microphone access should not be allowed in this document.");
     26 
     27    let camera_reports=[], microphone_reports=[];
     28    while(true) {
     29      await wait(100);
     30      if (!camera_reports.length) {
     31        camera_reports = await pollReports(endpoint, camera_id);
     32      }
     33      if (!microphone_reports.length) {
     34        microphone_reports = await pollReports(endpoint, microphone_id);
     35      }
     36      if (camera_reports.length && microphone_reports.length) {
     37        checkReportExists(camera_reports, 'permissions-policy-violation', location.href);
     38        checkReportExists(microphone_reports, 'permissions-policy-violation', location.href);
     39        break;
     40      }
     41    }
     42  }, "Reporting-Endpoints defined endpoint received reports.");
     43    </script>
     44  </body>
     45 </html>