tor-browser

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

microphone-reporting.https.html (1271B)


      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  </head>
     10  <body>
     11    <script>
     12 var t = async_test("Microphone Report Format");
     13 
     14 var check_report_format = (reports, observer) => {
     15  let report = reports[0];
     16  assert_equals(report.type, "permissions-policy-violation");
     17  assert_equals(report.url, document.location.href);
     18  assert_equals(report.body.featureId, "microphone");
     19  assert_equals(report.body.sourceFile, document.location.href);
     20  assert_equals(typeof report.body.lineNumber, "number");
     21  assert_equals(typeof report.body.columnNumber, "number");
     22  assert_equals(report.body.disposition, "enforce");
     23 };
     24 
     25 new ReportingObserver(t.step_func_done(check_report_format),
     26                      {types: ['permissions-policy-violation']}).observe();
     27 
     28 setMediaPermission().then(() => navigator.mediaDevices.getUserMedia({audio: true}))
     29  .then(
     30  t.unreached_func("UserMedia microphone access should not be allowed in this document.")
     31 ).catch(() => {});
     32    </script>
     33  </body>
     34 </html>