From d73e63c437344813e65d689f9ae5c6285a3c5422 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Fri, 10 May 2024 04:54:42 -0700 Subject: [PATCH] Revert "Use resource-level referrer policy for attributionsrc requests" This reverts commit 4c4802b8681c23f09e62c1fb82ed2c00a65d12a6. Reason for revert: Getting approvals on the revert in case launch approvals are not received in time. Original change's description: > Use resource-level referrer policy for attributionsrc requests > > For and - - - - - - diff --git a/attribution-reporting/request-format.sub.https.html b/attribution-reporting/request-format.sub.https.html index 83a2d8f6bdfe78..a9e36dd126771f 100644 --- a/attribution-reporting/request-format.sub.https.html +++ b/attribution-reporting/request-format.sub.https.html @@ -53,7 +53,9 @@ } else { assert_not_own_property(requests[0], 'attribution-reporting-eligible'); } + assert_equals(requests[0].referer, location.toString()); + // TODO(apaseltiner): Test various referrer policies. // TODO(apaseltiner): Test cookie propagation. const expectedURL = blankURL(); diff --git a/attribution-reporting/resources/helpers.js b/attribution-reporting/resources/helpers.js index 054df6b97295a5..e5c749931e03c2 100644 --- a/attribution-reporting/resources/helpers.js +++ b/attribution-reporting/resources/helpers.js @@ -171,7 +171,6 @@ const registerAttributionSrc = async ({ extraQueryParams = {}, reportingOrigin, extraHeaders = [], - referrerPolicy = '', }) => { const searchParams = new URLSearchParams(location.search); @@ -202,6 +201,7 @@ const registerAttributionSrc = async ({ headers.push({name, value: cookie}); } + let credentials; if (method === 'fetch') { const params = getFetchParams(reportingOrigin, cookie); @@ -219,7 +219,6 @@ const registerAttributionSrc = async ({ switch (method) { case 'img': const img = document.createElement('img'); - img.referrerPolicy = referrerPolicy; if (eligible === null) { img.attributionSrc = url; } else { @@ -237,7 +236,6 @@ const registerAttributionSrc = async ({ return 'event'; case 'script': const script = document.createElement('script'); - script.referrerPolicy = referrerPolicy; if (eligible === null) { script.attributionSrc = url; } else { @@ -251,7 +249,6 @@ const registerAttributionSrc = async ({ return 'event'; case 'a': const a = document.createElement('a'); - a.referrerPolicy = referrerPolicy; a.target = '_blank'; a.textContent = 'link'; if (eligible === null) { @@ -266,13 +263,12 @@ 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)} ${feature}`); + `attributionsrc=${encodeURIComponent(url)}`); } else { - open(url, '_blank', `attributionsrc ${feature}`); + open(url, '_blank', 'attributionsrc'); } }); return 'navigation'; @@ -281,7 +277,7 @@ const registerAttributionSrc = async ({ if (eligible !== null) { attributionReporting = JSON.parse(eligible); } - await fetch(url, {credentials, attributionReporting, referrerPolicy}); + await fetch(url, {credentials, attributionReporting}); return 'event'; } case 'xhr':