tor-browser

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

automatic-beacon-no-opt-in.https.html (1685B)


      1 <!DOCTYPE html>
      2 <title>Test window.fence.setReportEventDataForAutomaticBeacons opt out</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 <script src="/resources/testdriver.js"></script>
      9 <script src="/resources/testdriver-actions.js"></script>
     10 <script src="/resources/testdriver-vendor.js"></script>
     11 <script src="/common/get-host-info.sub.js"></script>
     12 <script src="resources/automatic-beacon-helper.js"></script>
     13 
     14 <body>
     15 <script>
     16 promise_test(async (t) => {
     17  const actions = new test_driver.Actions();
     18  const fencedframe = await attachFencedFrameContext({
     19    generator_api: "fledge",
     20    register_beacon: true,
     21  });
     22  const new_url = new URL("resources/dummy.html", location.href);
     23 
     24  await fencedframe.execute(
     25    (new_url) => {
     26      addEventListener("click", (event) => {
     27        window.open(new_url, "_blank");
     28      });
     29    },
     30    [new_url]
     31  );
     32 
     33  // An automatic beacon should not be sent out, as the document did not opt in
     34  // through the call to setReportEventDataForAutomaticBeacons(), nor through
     35  // the 'Allow-Fenced-Frame-Automatic-Beacons' header.
     36  // Set up a timeout to ensure that there's enough time to send any potential
     37  // automatic beacons.
     38  await actions
     39    .pointerMove(0, 0, { origin: fencedframe.element })
     40    .pointerDown()
     41    .pointerUp()
     42    .send();
     43  await verifyBeaconData("reserved.top_navigation_start", "<No data>", null,
     44      false, t);
     45 }, "Automatic beacons will not send if the document does not opt in.");
     46 
     47 </script>
     48 </body>