tor-browser

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

document-reporting-destroy-after-document-close.https.sub.html (1424B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 
      4 <head>
      5  <title>Test that reports are not sent without Reporting-Endpoints header, with previous header set on same URL</title>
      6  <script src="/common/utils.js"></script>
      7  <script src='/resources/testharness.js'></script>
      8  <script src='/resources/testharnessreport.js'></script>
      9  <script src='resources/report-helper.js'></script>
     10 </head>
     11 
     12 <body>
     13  <iframe name="test"></iframe>
     14  <script>
     15    const base_url = `${location.protocol}//${location.host}`;
     16    const endpoint = `${base_url}/reporting/resources/report.py`;
     17    const report_id = token();
     18    const document_url =
     19      `resources/generate-report-once.py?reportID=${report_id}`;
     20    promise_test(async t => {
     21      // Load a document that generates report into iframe. Server should return
     22      // Reporting-Endpoints header.
     23      const w = window.open(document_url, "test");
     24      let reports = await pollReports(endpoint, report_id);
     25      // Verify that reporting is configured on the document.
     26      assert_equals(reports.length, 1);
     27      // reload opened window. This time server will not return
     28      // Reporting-Endpoints header.
     29      w.location.reload();
     30      reports = await pollReports(endpoint, report_id);
     31      // Verify no reports are sent this time.
     32      assert_equals(reports.length, 0);
     33 
     34    }, "No more reports received after navigation to same document without endpoint header");
     35  </script>
     36 
     37 </body>
     38 
     39 </html>