From 856230102b1945fca46816673890549fbe009c51 Mon Sep 17 00:00:00 2001 From: Anton Maliev Date: Mon, 4 Mar 2024 10:49:38 -0800 Subject: [PATCH] Workaround to deflake 3PC heuristics WPT. Firefox is flaky on both assertions for default 3PC access. Force-failing the test to avoid calling these flaky assertions until Firefox implements them. (We don't want to force-succeed as it will hide the test which is tentative but should be implemented.) Bug: 326123298 Fixed: 326123298 Change-Id: Ic2bd69549a746452cea24fc9c77cec39c575bd26 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5322658 Reviewed-by: Joshua Hood Commit-Queue: Anton Maliev Cr-Commit-Position: refs/heads/main@{#1267950} --- ...-party-cookies-cross-site-popup-opener.html | 18 ++++++++++-------- ...-party-cookies-cross-site-popup-verify.html | 2 ++ .../third-party-cookies-cross-site-popup.html | 2 ++ ...arty-cookie-heuristics.tentative.https.html | 2 ++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-opener.html b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-opener.html index 0e25f79261924e..a09b07e5b70231 100644 --- a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-opener.html +++ b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-opener.html @@ -1,4 +1,6 @@ + + Window that opens a popup in a cross-site context @@ -26,17 +28,17 @@ } // Verify whether third-party cookies are blocked by default. - promise_test(async () => { - const thirdPartyHttpCookie = "3P_http" - await credFetch( - `${origin}/cookies/resources/set.py?${thirdPartyHttpCookie}=foobar;` + - "Secure;Path=/;SameSite=None"); - await assertHttpOriginCanAccessCookies({ + if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) { + assertThirdPartyHttpCookies({ + desc: "3P fetch", origin, - cookieNames: [thirdPartyHttpCookie], + cookieNames, expectsCookie: false, }); - }, "3P fetch: Cross site window setting HTTP cookies"); + } else { + // Default behavior for third-party cookie blocking is flaky in Firefox. + throw new AssertionError("Testing default third-party cookie blocking is not implemented in Firefox."); + } // Open the cookies' origin in a popup to activate the heuristic. const popupUrl = new URL( diff --git a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-verify.html b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-verify.html index 8d4819ad82912d..6deb88b5d03d74 100644 --- a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-verify.html +++ b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup-verify.html @@ -1,4 +1,6 @@ + + Verifies heuristics enabled by popup diff --git a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup.html b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup.html index 6f802007f8d074..7addc7943c0ee2 100644 --- a/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup.html +++ b/cookies/third-party-cookies/resources/third-party-cookies-cross-site-popup.html @@ -1,4 +1,6 @@ + + Cross-site popup diff --git a/cookies/third-party-cookies/third-party-cookie-heuristics.tentative.https.html b/cookies/third-party-cookies/third-party-cookie-heuristics.tentative.https.html index 3eb70432b947a9..32e7ab6d9ab344 100644 --- a/cookies/third-party-cookies/third-party-cookie-heuristics.tentative.https.html +++ b/cookies/third-party-cookies/third-party-cookie-heuristics.tentative.https.html @@ -1,4 +1,6 @@ + + Test third-party cookie heuristics