summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/attribution-reporting/resources
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /testing/web-platform/tests/attribution-reporting/resources
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/attribution-reporting/resources')
-rw-r--r--testing/web-platform/tests/attribution-reporting/resources/helpers.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/testing/web-platform/tests/attribution-reporting/resources/helpers.js b/testing/web-platform/tests/attribution-reporting/resources/helpers.js
index e5c749931e..054df6b972 100644
--- a/testing/web-platform/tests/attribution-reporting/resources/helpers.js
+++ b/testing/web-platform/tests/attribution-reporting/resources/helpers.js
@@ -171,6 +171,7 @@ const registerAttributionSrc = async ({
extraQueryParams = {},
reportingOrigin,
extraHeaders = [],
+ referrerPolicy = '',
}) => {
const searchParams = new URLSearchParams(location.search);
@@ -201,7 +202,6 @@ const registerAttributionSrc = async ({
headers.push({name, value: cookie});
}
-
let credentials;
if (method === 'fetch') {
const params = getFetchParams(reportingOrigin, cookie);
@@ -219,6 +219,7 @@ const registerAttributionSrc = async ({
switch (method) {
case 'img':
const img = document.createElement('img');
+ img.referrerPolicy = referrerPolicy;
if (eligible === null) {
img.attributionSrc = url;
} else {
@@ -236,6 +237,7 @@ const registerAttributionSrc = async ({
return 'event';
case 'script':
const script = document.createElement('script');
+ script.referrerPolicy = referrerPolicy;
if (eligible === null) {
script.attributionSrc = url;
} else {
@@ -249,6 +251,7 @@ const registerAttributionSrc = async ({
return 'event';
case 'a':
const a = document.createElement('a');
+ a.referrerPolicy = referrerPolicy;
a.target = '_blank';
a.textContent = 'link';
if (eligible === null) {
@@ -263,12 +266,13 @@ const registerAttributionSrc = async ({
return 'navigation';
case 'open':
await test_driver.bless('open window', () => {
+ const feature = referrerPolicy === 'no-referrer' ? 'noreferrer' : '';
if (eligible === null) {
open(
blankURL(), '_blank',
- `attributionsrc=${encodeURIComponent(url)}`);
+ `attributionsrc=${encodeURIComponent(url)} ${feature}`);
} else {
- open(url, '_blank', 'attributionsrc');
+ open(url, '_blank', `attributionsrc ${feature}`);
}
});
return 'navigation';
@@ -277,7 +281,7 @@ const registerAttributionSrc = async ({
if (eligible !== null) {
attributionReporting = JSON.parse(eligible);
}
- await fetch(url, {credentials, attributionReporting});
+ await fetch(url, {credentials, attributionReporting, referrerPolicy});
return 'event';
}
case 'xhr':