tor-browser

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

automatic-beacon-data-set-by-sibling.https.html (2159B)


      1 <!DOCTYPE html>
      2 <title>Test window.fence.setReportEventDataForAutomaticBeacons</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  // This test creates the following frame tree:
     18  // Root Frame (A)
     19  // └─Fenced Frame (A)
     20  //    ├─IFrame (B) [performs navigation]
     21  //    └─IFrame (B) [sets data]
     22  // It then checks that B's navigation sends an automatic beacon without data,
     23  // even if a different B sets automatic beacon data.
     24  const fencedframe = await attachFencedFrameContext({
     25    generator_api: 'fledge', register_beacon: true
     26  });
     27 
     28  const beacon = {
     29    eventType: "reserved.top_navigation_start",
     30    eventData: "This data should not be sent",
     31    destination: ["buyer"],
     32    crossOriginExposed: true
     33  }
     34 
     35  await fencedframe.execute(async (beacon) => {
     36    const iframe_a = await attachIFrameContext({
     37      origin: get_host_info().HTTPS_REMOTE_ORIGIN,
     38      headers: [['Allow-Fenced-Frame-Automatic-Beacons', 'true']]
     39    });
     40    const iframe_b = await attachIFrameContext({
     41      origin: get_host_info().HTTPS_REMOTE_ORIGIN,
     42      headers: [['Allow-Fenced-Frame-Automatic-Beacons', 'true']]
     43    });
     44    iframe_b.execute((beacon) => {
     45      window.fence.setReportEventDataForAutomaticBeacons(beacon);
     46    }, [beacon]);
     47    await setupAutomaticBeacon(iframe_a, [],
     48        "resources/close.html", NavigationTrigger.ClickOnce,
     49        "_blank");
     50  }, [beacon]);
     51 
     52  await multiClick(10, 10, fencedframe.element)
     53 
     54  await verifyBeaconData(beacon.eventType, "<No data>",
     55      get_host_info().HTTPS_REMOTE_ORIGIN);
     56 }, 'An automatic beacon does not use data set by a same-origin sibling.');
     57 
     58 </script>
     59 </body>