tor-browser

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

screen-wake-lock-reporting.https.html (1439B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <script src='/resources/testharness.js'></script>
      5    <script src='/resources/testharnessreport.js'></script>
      6  </head>
      7  <body>
      8    <script>
      9      promise_test(async (t) => {
     10        const reportPromise = new Promise(resolve => {
     11          new ReportingObserver((reports, observer) => resolve(reports),
     12                                {types: ["permissions-policy-violation"]}).observe();
     13        });
     14        // Even though we do not explicitly allow screen wake lock requests in
     15        // testdriver, per spec Permissions Policy checks should happen earlier.
     16        await promise_rejects_dom(t, 'NotAllowedError', navigator.wakeLock.request("screen"),
     17                                  "Screen Wake Lock should not be allowed in this document.");
     18        const reports = await reportPromise;
     19 
     20        assert_equals(reports.length, 1);
     21        const report = reports[0];
     22        assert_equals(report.type, "permissions-policy-violation");
     23        assert_equals(report.url, document.location.href);
     24        assert_equals(report.body.featureId, "screen-wake-lock");
     25        assert_equals(report.body.sourceFile, document.location.href);
     26        assert_equals(typeof report.body.lineNumber, "number");
     27        assert_equals(typeof report.body.columnNumber, "number");
     28        assert_equals(report.body.disposition, "enforce");
     29      }, "Screen Wake Lock Report Format");
     30    </script>
     31  </body>
     32 </html>