tor-browser

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

automatic-beacon-data-cross-origin-ancestor.sub.https.html (1932B)


      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) [sets data]
     21  //        └─IFrame (C) [performs navigation]
     22  // It then checks that C's navigation uses the data set in B, even if B is
     23  // cross-origin to fencedframe A.
     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 is the start data",
     31    destination: ["buyer"],
     32    crossOriginExposed: true
     33  }
     34 
     35  await fencedframe.execute(async (beacon) => {
     36    const iframe = await attachIFrameContext({
     37      origin: 'https://{{hosts[][www2]}}:{{ports[https][1]}}'
     38    });
     39    // IFrame (C) is created during this setupAutomaticBeacon() call. The data
     40    // for IFrame (B) is also set during this call.
     41    return setupAutomaticBeacon(iframe, [beacon],
     42        "resources/close.html", NavigationTrigger.CrossOriginClick,
     43        "_blank");
     44  }, [beacon]);
     45 
     46  await multiClick(10, 10, fencedframe.element)
     47 
     48  await verifyBeaconData(beacon.eventType, beacon.eventData,
     49      get_host_info().HTTPS_REMOTE_ORIGIN);
     50 }, 'An automatic beacon can use data set by a cross-origin ancestor.');
     51 
     52 </script>
     53 </body>