Files
sousa-gecko/testing/web-platform/tests/attribution-reporting/request-format.sub.https.html
T
Andrew Paseltiner 3d573e8bd4 Bug 1935687 [wpt PR 49568] - Expose attributionsrc support on <area> through IDL, a=testonly
Automatic update from web-platform-tests
Expose attributionsrc support on <area> through IDL

This was already unintentionally supported due to the handling of the
attributionsrc attribute on HTMLAnchorBaseElement, and is reasonable to
support anyway, as <area> is a first-class navigation surface, just like
the already supported <a> and window.open.

https://github.com/WICG/attribution-reporting-api/pull/1465

I2S: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/673f72a6.2b0a0220.3bb1d2.02f2.GAE%40google.com

Bug: 369219144, 379275911
Change-Id: I7230229de087c752af7a5be2f7663fff999d66e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6022268
Reviewed-by: Nate Chapin <japhet@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Commit-Queue: Andrew Paseltiner <apaseltiner@chromium.org>
Reviewed-by: John Delaney <johnidel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392912}

--

wpt-commits: 9535d4d010f2b40dc7f406d2c0ca53b8bda84e2c
wpt-pr: 49568
2024-12-11 10:56:04 +00:00

66 lines
2.7 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<meta name=timeout content=long>
<meta name=variant content="?method=a&expected-eligible=navigation-source">
<meta name=variant content="?method=area&expected-eligible=navigation-source">
<meta name=variant content="?method=img&expected-eligible=event-source, trigger">
<meta name=variant content="?method=img&eligible&expected-eligible=event-source, trigger">
<meta name=variant content="?method=open&expected-eligible=navigation-source">
<meta name=variant content="?method=script&expected-eligible=event-source, trigger">
<meta name=variant content="?method=script&eligible&expected-eligible=event-source, trigger">
<meta name=variant content="?method=fetch">
<meta name=variant content='?method=fetch&eligible={"eventSourceEligible":true,"triggerEligible":false}&expected-eligible=event-source'>
<meta name=variant content="?method=xhr">
<meta name=variant content='?method=xhr&eligible={"eventSourceEligible":true,"triggerEligible":false}&expected-eligible=event-source'>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<body>
<script>
const waitForRequest = async () => {
const url = blankURL();
url.searchParams.set('get-requests', 'true');
for (let i = 0; i < 20; i++) {
const resp = await fetch(url);
const payload = await resp.json();
if (payload !== null && payload.length > 0) {
return payload;
}
await delay(100);
}
throw new Error('Timeout polling requests');
};
const searchParams = new URLSearchParams(location.search);
const expected_eligible =
searchParams.get('expected-eligible') === null ? undefined : searchParams.get('expected-eligible');
promise_test(async t => {
// Set mixed-case query params to ensure that they are propagated correctly.
registerAttributionSrc({
method: 'variant',
extraQueryParams: {'aB': 'Cd', 'store-request': 'true'},
});
const requests = await waitForRequest();
assert_equals(requests.length, 1);
assert_equals(requests[0].method, 'GET');
// TODO(apaseltiner): Check header values once WPT can parse structured dictionaries.
if (expected_eligible) {
assert_own_property(requests[0], 'attribution-reporting-eligible');
} else {
assert_not_own_property(requests[0], 'attribution-reporting-eligible');
}
// TODO(apaseltiner): Test cookie propagation.
const expectedURL = blankURL();
expectedURL.searchParams.set('aB', 'Cd');
expectedURL.searchParams.set('store-request', 'true');
assert_equals(requests[0].url, expectedURL.toString());
}, 'attributionsrc request has the proper format.');
</script>