Bug 1697693 [wpt PR 28015] - Cookie Domain WPTs: Clean up cookies at the end of each test, a=testonly

Automatic update from web-platform-tests
Cookie Domain WPTs: Clean up cookies at the end of each test

This attempts to fix an issue where cookies from previous tests stick
around and interfere with cookie-line test assertions in subsequent
tests, when many tests are run in series.

This adds cookie deletion to the end of each test in
wpt/cookies/domain which was failing to do so. (There are tests in
other directories that fail to clean up cookies, but those will be
handled separately.)

Change-Id: I26d0f342e401f4bbcf8ba318683861fa5a45faac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2748837
Reviewed-by: Steven Bingler <bingler@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862525}

--

wpt-commits: 50b6da2d34f7bb1084ad919a865f6d3ab8aa3ae1
wpt-pr: 28015
This commit is contained in:
Lily Chen 2021-03-17 13:30:23 +00:00 committed by moz-wptsync-bot
parent 2bf097c465
commit 43258e8acc
4 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,10 @@
// Set-Cookie: domain-attribute-host-with-and-without-leading-period=c; Path=/; Domain={{host}}
//
const cookieName = "domain-attribute-host-with-and-without-leading-period";
// Clean up cookie at the end to avoid interfering with subsequent tests.
add_completion_callback(tests => document.cookie =
`${cookieName}=0; Path=/; Domain={{host}}; expires=01-jan-1970 00:00:00 GMT`);
test(t => {
assert_dom_cookie(cookieName, "c", true);
}, "Domain=.{{host}} => Second value available via `document.cookie`");

View File

@ -10,6 +10,10 @@
// Set-Cookie: domain-attribute-host-with-leading-period=b; Path=/; Domain=.{{host}}
//
const cookieName = "domain-attribute-host-with-leading-period";
// Clean up cookie at the end to avoid interfering with subsequent tests.
add_completion_callback(tests => document.cookie =
`${cookieName}=0; Path=/; Domain=.{{host}}; expires=01-jan-1970 00:00:00 GMT`);
test(t => {
assert_dom_cookie(cookieName, "b", true);
}, "Domain=.{{host}} => available via `document.cookie`");

View File

@ -10,6 +10,10 @@
// Set-Cookie: domain-attribute-matches-host=b; Path=/; Domain={{host}}
//
const cookieName = "domain-attribute-matches-host";
// Clean up cookie at the end to avoid interfering with subsequent tests.
add_completion_callback(tests => document.cookie =
`${cookieName}=0; Path=/; Domain={{host}}; expires=01-jan-1970 00:00:00 GMT`);
test(t => {
assert_dom_cookie(cookieName, "b", true);
}, "Domain={{host}} => available via `document.cookie`");

View File

@ -10,6 +10,10 @@
// Set-Cookie: domain-attribute-missing=b; Path=/
//
const cookieName = "domain-attribute-missing";
// Clean up cookie at the end to avoid interfering with subsequent tests.
add_completion_callback(tests => document.cookie =
`${cookieName}=0; Path=/; expires=01-jan-1970 00:00:00 GMT`);
test(t => {
assert_dom_cookie(cookieName, "b", true);
}, "No domain attribute => available via `document.cookie`");