Skip to content

Commit

Permalink
Support header error debug reports for Attribution Reporting API
Browse files Browse the repository at this point in the history
WICG/attribution-reporting-api#1180

This CL introduces a new mojo method in AttributionDataHost mojo
interface to plumb the errors from header validation in the renderer to
the browser. This is necessary as the permission check for debug
reporting is performed in the browser, and also it helps to unify the
code path for errors from header validation in the browser.

Change-Id: If8c0f1295dfc08d914138362c9275b0952b2e4b4
  • Loading branch information
linnan-github authored and chromium-wpt-export-bot committed Mar 4, 2024
1 parent 9a57836 commit be583d0
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<meta name=timeout content=long>
<script src="/common/get-host-info.sub.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/attribution-reporting/resources/helpers.js"></script>
<script>
attribution_reporting_promise_test(async t => {
await registerAttributionSrc({
trigger: {
event_trigger_data: {},
},
extraHeaders: [
{
name: 'Attribution-Reporting-Info',
value: 'report-header-errors',
},
],
method: 'img',
});

const payload = await pollVerboseDebugReports();
assert_equals(payload.reports.length, 1);
const report = JSON.parse(payload.reports[0].body);
assert_equals(report.length, 1);
assert_equals(report[0].type, 'header-parsing-error');
assert_own_property(report[0], 'body');
assert_equals(report[0].body.context_site, 'https://{{host}}');
assert_equals(report[0].body.header, 'Attribution-Reporting-Register-Trigger');
assert_equals(report[0].body.value, '{"event_trigger_data":{}}');
}, 'Header error debug report is received.');
</script>

0 comments on commit be583d0

Please sign in to comment.