From 8c3c801a6d4c31b5cce86f82d6fe77cb51348923 Mon Sep 17 00:00:00 2001 From: Liam Brady Date: Fri, 21 Jul 2023 09:35:37 +0000 Subject: [PATCH] Bug 1843339 [wpt PR 41020] - Add option to send automatic beacons only once., a=testonly Automatic update from web-platform-tests Add option to send automatic beacons only once. Automatic beacons currently have a design flaw that can cause extra unwanted beacons to be sent out. For example, a top-level navigation beacon is set in a click handler for an ad when the user clicks on the ad. If the ad's visual display is programmed to change to have a button that says "why this ad?" after the ad is clicked (the button will take the user to an explainer page when clicked), then the automatic beacon data will still be in place. If a user clicks back to the tab the ad is on and clicks on "why this ad?" to perform a different top-level navigation, the beacon will send out again as if the user clicked on the ad normally. This creates an erroneous impression and results in incorrect data being sent to reporting servers. To fix the issue, this CL introduces a new parameter to the `FenceEvent` dictionary: `once`. It defaults to false (to preserve the current default behavior of automatic beacons). If set to true, when an automatic beacon is sent out, the automatic beacon data will be cleared. This CL also moves `AutomaticBeaconInfo` implementation functions from "fenced_frame_reporter.cc" to "fenced_frame_config.cc" to reflect the fact that its definition lives in "fenced_frame_config.h". Change-Id: I1240557844a3c47c680a0f3d8a227e31794ab49f Bug: 1464599 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4671534 Reviewed-by: Jonathan Ross Reviewed-by: Dominic Farolino Commit-Queue: Liam Brady Cr-Commit-Position: refs/heads/main@{#1173132} -- wpt-commits: f9206867fa91e0de3855b6b785631f3e906be82f wpt-pr: 41020 --- ...tomatic-beacon-two-events-clear.https.html | 58 +++++++++++++++++++ ...matic-beacon-two-events-persist.https.html | 54 +++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-clear.https.html create mode 100644 testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-persist.https.html diff --git a/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-clear.https.html b/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-clear.https.html new file mode 100644 index 0000000000000..ae246aaac0ad4 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-clear.https.html @@ -0,0 +1,58 @@ + +Test setReportEventDataForAutomaticBeacons called only once + + + + + + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-persist.https.html b/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-persist.https.html new file mode 100644 index 0000000000000..f944d7141d7ee --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-persist.https.html @@ -0,0 +1,54 @@ + +Test setReportEventDataForAutomaticBeacons called only once + + + + + + + + + + + +