fence-report-event-sub-fencedframe.https.html (1593B)
1 <!DOCTYPE html> 2 <title>Test window.fence.reportEvent from nested fenced frames.</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="/common/get-host-info.sub.js"></script> 8 <script src="resources/automatic-beacon-helper.js"></script> 9 <script src="resources/utils.js"></script> 10 11 <body> 12 <script> 13 promise_test(async(t) => { 14 const fencedframe = await attachFencedFrameContext({ 15 generator_api: 'fledge', 16 headers: [[ 17 'Allow-Cross-Origin-Event-Reporting', '?1' 18 ]], 19 register_beacon: true 20 }); 21 await fencedframe.execute(async () => { 22 const fencedframe = await attachFencedFrameContext({ 23 generator_api: 'sharedstorage', 24 register_beacon: true 25 }); 26 await fencedframe.execute(() => { 27 const destination_url = new URL(BEACON_URL + "?type=url", 28 get_host_info().HTTPS_ORIGIN); 29 window.fence.reportEvent({ 30 eventType: "click", 31 eventData: "enum", 32 destination: ["buyer"], 33 crossOriginExposed: true 34 }); 35 window.fence.reportEvent({ 36 destinationURL: destination_url, 37 crossOriginExposed: true 38 }); 39 }); 40 }); 41 // Check that both the destination enum and destination URL events were 42 // reported. 43 await verifyBeaconData("click", "enum", null, false, t); 44 await verifyBeaconData("url", "<No data>", null, false, t); 45 }, 'window.fence.reportEvent should not work in a nested fenced frame'); 46 </script> 47 </body>