tor-browser

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

serial-report-only.https.html (1555B)


      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  </head>
      9  <body>
     10    <div id='fs'></div>
     11    <script>
     12 var check_report_format = ([reports, observer]) => {
     13  let report = reports[0];
     14  assert_equals(report.type, "permissions-policy-violation");
     15  assert_equals(report.body.featureId, "serial");
     16  assert_equals(report.body.disposition, "report");
     17 };
     18 
     19 promise_test(async t => {
     20  const report = new Promise(resolve => {
     21    new ReportingObserver((reports, observer) => resolve([reports, observer]),
     22                          {types: ['permissions-policy-violation']}).observe();
     23  });
     24 
     25  await test_driver.bless('Activate document for serial.requestPort');
     26  try {
     27    await navigator.serial.requestPort({filters: []});
     28    assert_unreached('requestPort() call should fail when no port is selected.');
     29  } catch (e) {
     30    assert_equals(e.code, DOMException.NOT_FOUND_ERR);
     31  }
     32  check_report_format(await report);
     33 }, "requestPort in serial report only mode");
     34 
     35 promise_test(async t => {
     36  const report = new Promise(resolve => {
     37    new ReportingObserver((reports, observer) => resolve([reports, observer]),
     38                          {types: ['permissions-policy-violation']}).observe();
     39  });
     40 
     41  await navigator.serial.getPorts();
     42  check_report_format(await report);
     43 }, "getPorts in serial report only mode");
     44    </script>
     45  </body>
     46 </html>