PHANTOM
🇮🇳 IN
Skip to content

Commit 939731a

Browse files
chlily1chromium-wpt-export-bot
authored andcommitted
Remove legacy-samesite Web Platform Tests
SameSite-Lax-by-default and SameSite=None-requires-Secure have been standardized ([1], [2]) and launched in Chromium [3] as well as Firefox [4]. The WPTs testing "legacy" behavior are no longer needed, and they are also failing on wpt.fyi [5]. This change removes the legacy-samesite virtual test suite, as well as the ?legacy-samesite variant of the tests in wpt/cookie/samesite/. The test for SameSite=None-requires-Secure also loses its "tentative" designation. Chromium will soon no longer support the configuration used in the virtual test suite, so there would be no way to run these tests anyway. [1] httpwg/http-extensions#1325 [2] httpwg/http-extensions#1323 [3] https://crrev.com/c/2231445 [4] https://hacks.mozilla.org/2020/08/changes-to-samesite-cookie-behavior/ [5] https://wpt.fyi/results/cookies/samesite?run_id=5099687737556992&run_id=5641857632567296&run_id=5678463840157696&run_id=5638004375814144 Bug: 961439, 1211388 Change-Id: Idb3c835908bcd61dde3593b4fb4f9349e738031f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3047679 Reviewed-by: Steven Bingler <bingler@chromium.org> Commit-Queue: Lily Chen <chlily@chromium.org> Cr-Commit-Position: refs/heads/master@{#905289}
1 parent 39fb1e2 commit 939731a

15 files changed

+32
-127
lines changed

cookies/resources/cookie-helper.sub.js

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -167,32 +167,9 @@ async function resetSameSiteCookies(origin, value) {
167167
}
168168
}
169169

170-
// Given an |expectedStatus| and |expectedValue|, assert the |cookies| contains the
171-
// proper set of cookie names and values, according to the legacy behavior where
172-
// unspecified SameSite attribute defaults to SameSite=None behavior.
173-
function verifySameSiteCookieStateLegacy(expectedStatus, expectedValue, cookies, domCookieStatus) {
174-
assert_equals(cookies["samesite_none"], expectedValue, "SameSite=None cookies are always sent.");
175-
assert_equals(cookies["samesite_unspecified"], expectedValue, "Unspecified-SameSite cookies are always sent.");
176-
if (expectedStatus == SameSiteStatus.CROSS_SITE) {
177-
assert_not_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are not sent with cross-site requests.");
178-
assert_not_equals(cookies["samesite_lax"], expectedValue, "SameSite=Lax cookies are not sent with cross-site requests.");
179-
} else if (expectedStatus == SameSiteStatus.LAX) {
180-
assert_not_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are not sent with lax requests.");
181-
assert_equals(cookies["samesite_lax"], expectedValue, "SameSite=Lax cookies are sent with lax requests.");
182-
} else if (expectedStatus == SameSiteStatus.STRICT) {
183-
assert_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are sent with strict requests.");
184-
assert_equals(cookies["samesite_lax"], expectedValue, "SameSite=Lax cookies are sent with strict requests.");
185-
}
186-
187-
if (cookies["domcookies"]) {
188-
verifyDocumentCookieLegacy(domCookieStatus, expectedValue, cookies["domcookies"]);
189-
}
190-
}
191-
192-
// Same as above except this expects samesite_unspecified to act the same as
193-
// samesite_lax (which is the behavior expected when SameSiteByDefault is
194-
// enabled).
195-
function verifySameSiteCookieStateWithSameSiteByDefault(expectedStatus, expectedValue, cookies, domCookieStatus) {
170+
// Given an |expectedStatus| and |expectedValue|, assert the |cookies| contains
171+
// the proper set of cookie names and values. Expects SameSite-Lax-by-default.
172+
function verifySameSiteCookieState(expectedStatus, expectedValue, cookies, domCookieStatus) {
196173
assert_equals(cookies["samesite_none"], expectedValue, "SameSite=None cookies are always sent.");
197174
if (expectedStatus == SameSiteStatus.CROSS_SITE) {
198175
assert_not_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are not sent with cross-site requests.");
@@ -209,32 +186,11 @@ function verifySameSiteCookieStateWithSameSiteByDefault(expectedStatus, expected
209186
}
210187

211188
if (cookies["domcookies"]) {
212-
verifyDocumentCookieWithSameSiteByDefault(domCookieStatus, expectedValue, cookies["domcookies"]);
213-
}
214-
}
215-
216-
function verifyDocumentCookieLegacy(expectedStatus, expectedValue, domcookies) {
217-
const cookies = domcookies.split(";")
218-
.map(cookie => cookie.trim().split("="))
219-
.reduce((obj, cookie) => {
220-
obj[cookie[0]] = cookie[1];
221-
return obj;
222-
}, {});
223-
224-
if (expectedStatus == DomSameSiteStatus.SAME_SITE) {
225-
assert_equals(cookies["samesite_none"], expectedValue, "SameSite=None cookies are always included in document.cookie.");
226-
assert_equals(cookies["samesite_unspecified"], expectedValue, "Unspecified-SameSite cookies are always included in document.cookie.");
227-
assert_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are always included in document.cookie.");
228-
assert_equals(cookies["samesite_lax"], expectedValue, "SameSite=Lax cookies are always included in document.cookie.");
229-
} else if (expectedStatus == DomSameSiteStatus.CROSS_SITE) {
230-
assert_equals(cookies["samesite_none"], expectedValue, "SameSite=None cookies are always included in document.cookie.");
231-
assert_equals(cookies["samesite_unspecified"], expectedValue, "Unspecified-SameSite cookies are always included in document.cookie.");
232-
assert_not_equals(cookies["samesite_strict"], expectedValue, "SameSite=Strict cookies are not included in document.cookie when cross-site.");
233-
assert_not_equals(cookies["samesite_lax"], expectedValue, "SameSite=Lax cookies are not included in document.cookie when cross-site.");
189+
verifyDocumentCookieSameSite(domCookieStatus, expectedValue, cookies['domcookies']);
234190
}
235191
}
236192

237-
function verifyDocumentCookieWithSameSiteByDefault(expectedStatus, expectedValue, domcookies) {
193+
function verifyDocumentCookieSameSite(expectedStatus, expectedValue, domcookies) {
238194
const cookies = domcookies.split(";")
239195
.map(cookie => cookie.trim().split("="))
240196
.reduce((obj, cookie) => {
@@ -255,16 +211,6 @@ function verifyDocumentCookieWithSameSiteByDefault(expectedStatus, expectedValue
255211
}
256212
}
257213

258-
function isLegacySameSite() {
259-
return location.search === "?legacy-samesite";
260-
}
261-
262-
// Get the proper verifier based on the test's variant type.
263-
function getSameSiteVerifier() {
264-
return isLegacySameSite() ?
265-
verifySameSiteCookieStateLegacy : verifySameSiteCookieStateWithSameSiteByDefault;
266-
}
267-
268214
//
269215
// LeaveSecureCookiesAlone-specific test helpers:
270216
//

cookies/samesite-none-secure/cookies-without-samesite-must-be-secure.https.tentative.html renamed to cookies/samesite-none-secure/cookies-without-samesite-must-be-secure.https.html

File renamed without changes.

cookies/samesite/fetch.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -15,7 +13,7 @@
1513
return credFetch(target + "/cookies/resources/list.py")
1614

1715
.then(r => r.json())
18-
.then(cookies => getSameSiteVerifier()(expectedStatus, value, cookies, DomSameSiteStatus.SAME_SITE));
16+
.then(cookies => verifySameSiteCookieState(expectedStatus, value, cookies, DomSameSiteStatus.SAME_SITE));
1917
});
2018
}, title);
2119
}

cookies/samesite/form-get-blank-reload.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
3-
<meta name="variant" content="">
4-
<meta name="variant" content="?legacy-samesite">
53
<script src="/resources/testharness.js"></script>
64
<script src="/resources/testharnessreport.js"></script>
75
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -30,7 +28,7 @@
3028
var reloaded = false;
3129
var msgHandler = e => {
3230
try {
33-
getSameSiteVerifier()(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
31+
verifySameSiteCookieState(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
3432
} catch (e) {
3533
reject(e);
3634
}

cookies/samesite/form-get-blank.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -33,7 +31,7 @@
3331
window.removeEventListener("message", msgHandler);
3432
e.source.close();
3533
try {
36-
getSameSiteVerifier()(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
34+
verifySameSiteCookieState(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
3735
resolve("Popup received the cookie.");
3836
} catch (e) {
3937
reject(e);

cookies/samesite/form-post-blank-reload.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
3-
<meta name="variant" content="">
4-
<meta name="variant" content="?legacy-samesite">
53
<script src="/resources/testharness.js"></script>
64
<script src="/resources/testharnessreport.js"></script>
75
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -20,7 +18,7 @@
2018
var reloaded = false;
2119
var msgHandler = e => {
2220
try {
23-
getSameSiteVerifier()(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
21+
verifySameSiteCookieState(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
2422
} catch (e) {
2523
reject(e);
2624
}

cookies/samesite/form-post-blank.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -22,7 +20,7 @@
2220
window.removeEventListener("message", msgHandler);
2321
e.source.close();
2422
try {
25-
getSameSiteVerifier()(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
23+
verifySameSiteCookieState(expectedStatus, value, e.data, DomSameSiteStatus.SAME_SITE);
2624
resolve("Popup received the cookie.");
2725
} catch (e) {
2826
reject(e);

cookies/samesite/iframe-reload.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -21,7 +19,7 @@
2119
var reloaded = false;
2220
var msgHandler = e => {
2321
try {
24-
getSameSiteVerifier()(expectedStatus, value, e.data, expectedDomStatus);
22+
verifySameSiteCookieState(expectedStatus, value, e.data, expectedDomStatus);
2523
} catch (e) {
2624
reject(e);
2725
}

cookies/samesite/iframe.https.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -24,7 +22,7 @@
2422
document.body.removeChild(iframe);
2523
window.removeEventListener("message", msgHandler);
2624
try {
27-
getSameSiteVerifier()(expectedStatus, value, e.data, expectedDomStatus);
25+
verifySameSiteCookieState(expectedStatus, value, e.data, expectedDomStatus);
2826
resolve();
2927
} catch(e) {
3028
reject(e);

cookies/samesite/img.https.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8"/>
33
<meta name="timeout" content="long">
4-
<meta name="variant" content="">
5-
<meta name="variant" content="?legacy-samesite">
64
<script src="/resources/testharness.js"></script>
75
<script src="/resources/testharnessreport.js"></script>
86
<script src="/cookies/resources/cookie-helper.sub.js"></script>
@@ -46,15 +44,10 @@
4644
assert_cookie_absent(target, "samesite_strict", value),
4745
expectedStatus == SameSiteStatus.CROSS_SITE ?
4846
assert_cookie_absent(target, "samesite_lax", value) :
49-
assert_cookie_present(target, "samesite_lax", value)];
50-
if (isLegacySameSite()) {
51-
// Legacy behavior: unspecified SameSite acts like SameSite=None.
52-
asserts.push(assert_cookie_present(target, "samesite_unspecified", value));
53-
} else {
54-
asserts.push(expectedStatus == SameSiteStatus.CROSS_SITE ?
47+
assert_cookie_present(target, "samesite_lax", value),
48+
expectedStatus == SameSiteStatus.CROSS_SITE ?
5549
assert_cookie_absent(target, "samesite_unspecified", value) :
56-
assert_cookie_present(target, "samesite_unspecified", value));
57-
}
50+
assert_cookie_present(target, "samesite_unspecified", value)];
5851
return Promise.all(asserts);
5952
});
6053
}, title);

0 commit comments

Comments
 (0)