Files
sousa-gecko/testing/web-platform/tests/fenced-frame/fence-report-event-sub-fencedframe.https.html
T
Blink WPT Bot 1786bba601 Bug 1944957 [wpt PR 50394] - Fix selectURL() loaded iframes not getting window.fence., a=testonly
Automatic update from web-platform-tests
Fix selectURL() loaded iframes not getting window.fence. (#50394)

We are temporarily allowing APIs like Protected Audience and Shared
Storage selectURL() to load into iframes as part of the fenced frame
transition process. As part of this, we expose the fenced frame
window.fence call to these kinds of iframes. This was launched as part
of the fenced frames launch.
See: https://chromestatus.com/feature/5699388062040064

A restriction currently exists where the config created by the API must
have some kind of reporting metadata to give the iframe access to
window.fence. This is a legacy restriction and is no longer necessary,
and it results in selectURL()-created iframes without reporting metadata
supplied from accessing window.fence.

This CL fixes that by removing the restriction. It also adds a test to
check the selectURL() without reporting path. It also updates the fenced
frame WPT infrastructure to allow selectURL() to be invoked with or
without reporting metadata.

As part of this change, the renderer is no longer being told whether the
fenced frame has reporting metadata. This is information that can be
determined in the browser rather than calculating it on the
renderer-side and then verifying the calculation in the browser, so
having the renderer be part of this check is unnecessary.

Change-Id: Ieec3cdaa31cd62bfe6fdb1993e13d68f00f00f28
Bug: 392650252
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6197762
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Commit-Queue: Liam Brady <lbrady@google.com>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Xiaochen Zhou <xiaochenzh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1413688}

Co-authored-by: Liam Brady <lbrady@google.com>
--

wpt-commits: 03ab2bf22955b20c141c326d10d9391ff48b19ce
wpt-pr: 50394
2025-02-05 09:09:35 +00:00

48 lines
1.6 KiB
HTML

<!DOCTYPE html>
<title>Test window.fence.reportEvent from nested fenced frames.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/automatic-beacon-helper.js"></script>
<script src="resources/utils.js"></script>
<body>
<script>
promise_test(async(t) => {
const fencedframe = await attachFencedFrameContext({
generator_api: 'fledge',
headers: [[
'Allow-Cross-Origin-Event-Reporting', '?1'
]],
register_beacon: true
});
await fencedframe.execute(async () => {
const fencedframe = await attachFencedFrameContext({
generator_api: 'sharedstorage',
register_beacon: true
});
await fencedframe.execute(() => {
const destination_url = new URL(BEACON_URL + "?type=url",
get_host_info().HTTPS_ORIGIN);
window.fence.reportEvent({
eventType: "click",
eventData: "enum",
destination: ["buyer"],
crossOriginExposed: true
});
window.fence.reportEvent({
destinationURL: destination_url,
crossOriginExposed: true
});
});
});
// Check that both the destination enum and destination URL events were
// reported.
await verifyBeaconData("click", "enum", null, false, t);
await verifyBeaconData("url", "<No data>", null, false, t);
}, 'window.fence.reportEvent should not work in a nested fenced frame');
</script>
</body>