tor-browser

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

report-preload-and-consume.https.html (1008B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test that reports are sent with credentials to same-origin endpoints</title>
      5  <script src="/common/utils.js"></script>
      6  <script src='/resources/testharness.js'></script>
      7  <script src='/resources/testharnessreport.js'></script>
      8  <script src='/reporting/resources/report-helper.js'></script>
      9 </head>
     10 <body>
     11  <script>
     12    const endpoint = '/reporting/resources/report.py';
     13 
     14    promise_test(async t => {
     15        const uid = token();
     16        const win = window.open(`./support/preload-csp-report.https.sub.html?uid=${uid}`);
     17        t.add_cleanup(() => win.close());
     18        return t.step_wait(async () => {
     19            const reports = await pollReports(endpoint, uid);
     20            const failures = reports.filter(
     21              r => r['csp-report']['blocked-uri'].endsWith('fail.png'));
     22            return failures.length === 2;
     23        }, "Should receive 2 CSP reports.", 10000, 500);
     24    }, "Reporting endpoints received credentials.");
     25  </script>
     26 </body>
     27 </html>