Skip to content

Commit

Permalink
Re-sync web-platform-tests/cookies from upstream
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=263024

Reviewed by Tim Nguyen.

Re-sync web-platform-tests/cookies from upstream a6f8efca11d57f3d0e376.

* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/attributes-ctl.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/attributes-ctl.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/domain.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/domain.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/resources/domain-child.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/name/name-ctl-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/name/name-ctl.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/name/name.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/ordering/ordering.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/ordering/ordering.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/ordering/resources/ordering-child.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/partitioned-cookies/partitioned-cookies.tentative.https.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/partitioned-cookies/resources/partitioned-cookies-cross-site-embed.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/partitioned-cookies/resources/partitioned-cookies-cross-site-window.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/partitioned-cookies/resources/test-helpers.js:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie.https.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.header-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.header.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.header.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__host.header.https.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie.https.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.header-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.header.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/__secure.header.https.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/document-cookie.non-secure-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/prefix/document-cookie.non-secure.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/__init__.py:
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/cookie-helper.sub.js:
(cookieStringHasCookie):
(assert_dom_cookie):
(async create_cookie):
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/cookie-test.js:
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/list-cookies-for-script.py: Added.
(main):
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/set-cookie.py:
(main):
* LayoutTests/imported/w3c/web-platform-tests/cookies/resources/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/cookies/samesite/get_all_cookies-default-samesite-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/samesite/get_all_cookies-default-samesite.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/samesite/get_named_cookie-default-samesite-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/samesite/get_named_cookie-default-samesite.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/samesite/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/cookies/schemeful-same-site/schemeful-navigation.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/resources/test-helpers.js: Added.
(testHttpCookies):
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/resources/third-party-cookies-cross-site-embed.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/resources/third-party-cookies-cross-site-window.html: Copied from LayoutTests/imported/w3c/web-platform-tests/cookies/partitioned-cookies/resources/partitioned-cookies-cross-site-window.html.
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/resources/w3c-import.log: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/third-party-cookies.tentative.https-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/third-party-cookies.tentative.https.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/third-party-cookies/w3c-import.log: Added.
* LayoutTests/imported/w3c/web-platform-tests/cookies/value/value-ctl-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/value/value-ctl.html:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* LayoutTests/tests-options.json:

Canonical link: https://commits.webkit.org/269267@main
  • Loading branch information
cdumez committed Oct 12, 2023
1 parent b5ebe19 commit 0a54278
Show file tree
Hide file tree
Showing 56 changed files with 1,442 additions and 645 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,16 @@ imported/w3c/web-platform-tests/workers/interfaces/WorkerGlobalScope/onerror/mes
[ Debug ] imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-revert.html [ Skip ]
[ Debug ] imported/w3c/web-platform-tests/css/css-scoping/slotted-matches.html [ Skip ]

# Cookie tests that are flaky since their import because they fail and and out some kind of unique id.
imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__host.document-cookie.https.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__host.header.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__host.header.https.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__secure.document-cookie.https.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/__secure.header.html [ Pass Failure ]
imported/w3c/web-platform-tests/cookies/prefix/document-cookie.non-secure.html [ Pass Failure ]

# These tests have generated UUIDs in their output.
imported/w3c/web-platform-tests/html/syntax/speculative-parsing/generated/document-write/ [ Pass Failure ]

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,80 +30,65 @@
// would not be rejected. That way, if the attribute value is ignored
// instead of the cookie line being rejected, the test will catch it.
for (const ctl of CTLS) {
// NOTE: 'expected' below is only expected in the case of the tab
// character. Otherwise, '' is expected.
const controlCharacterAttributeTests = [
{
cookie: `test${ctl.code}domain=t; Domain=test${ctl.chr}.co; Domain=${host};`,
expected: `test${ctl.code}domain=t`,
name: `Cookie with %x${ctl.code.toString(16)} in Domain attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}domain2=t; Domain=${host}${ctl.chr};`,
expected: `test${ctl.code}domain2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after Domain attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}path=t; Path=/te${ctl.chr}st; Path=${path}`,
expected: `test${ctl.code}path=t`,
name: `Cookie with %x${ctl.code.toString(16)} in Path attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}path2=t; Path=${path}${ctl.chr};`,
expected: `test${ctl.code}path2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after Path attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}maxage=t; Max-Age=10${ctl.chr}00; Max-Age=1000;`,
expected: `test${ctl.code}maxage=t`,
name: `Cookie with %x${ctl.code.toString(16)} in Max-Age attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}maxage2=t; Max-Age=1000${ctl.chr};`,
expected: `test${ctl.code}maxage2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after Max-Age attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}expires=t; Expires=Fri, 01 Jan 20${ctl.chr}38 00:00:00 GMT; ` +
'Expires=Fri, 01 Jan 2038 00:00:00 GMT;',
expected: `test${ctl.code}expires=t`,
name: `Cookie with %x${ctl.code.toString(16)} in Expires attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}expires2=t; Expires=Fri, 01 Jan 2038 00:00:00 GMT${ctl.chr};`,
expected: `test${ctl.code}expires2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after Expires attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}secure=t; Sec${ctl.chr}ure;`,
expected: `test${ctl.code}secure=t`,
name: `Cookie with %x${ctl.code.toString(16)} in Secure attribute is handled correctly.`,
},
{
cookie: `test${ctl.code}secure2=t; Secure${ctl.chr};`,
expected: `test${ctl.code}secure2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after Secure attribute is handled correctly.`,
},
{
cookie: `test${ctl.code}httponly=t; Http${ctl.chr}Only;`,
expected: `test${ctl.code}httponly=t`,
name: `Cookie with %x${ctl.code.toString(16)} in HttpOnly attribute is handled correctly.`,
},
{
cookie: `test${ctl.code}samesite=t; SameSite=La${ctl.chr}x; SameSite=Lax;`,
expected: `test${ctl.code}samesite=t`,
name: `Cookie with %x${ctl.code.toString(16)} in SameSite attribute value is handled correctly.`,
},
{
cookie: `test${ctl.code}samesite2=t; SameSite=Lax${ctl.chr};`,
expected: `test${ctl.code}samesite2=t`,
name: `Cookie with %x${ctl.code.toString(16)} after SameSite attribute value is handled correctly.`,
},
];

for (const test of controlCharacterAttributeTests) {
if (ctl.code === 0x09) {
domCookieTest(test.cookie, test.expected, test.name);
domCookieTest(test.cookie, test.cookie.split(";")[0], test.name);
} else {
domCookieTest(test.cookie, "", test.name);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONSOLE MESSAGE: Domain is malformed!
Blocked access to external URL http://www.localhost:8800/cookies/attributes/resources/domain-child.sub.html

Harness Error (FAIL), message = Domain is malformed!
Harness Error (TIMEOUT), message = null

PASS Test cookie domain attribute parsing

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<script>
const port = "{{ports[http][0]}}";
const wwwHost = "{{hosts[alt][]}}";
const wwwHost = "{{domains[www]}}";

test(t => {
const win = window.open(`http://${wwwHost}:${port}/cookies/attributes/resources/domain-child.sub.html`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const path = "path=/cookies/attributes"
const port = "{{ports[http][0]}}";
const host = "{{host}}"; // example.org
const wwwHost = "{{hosts[alt][]}}"; // home.example.org
const wwwHost = "{{domains[www]}}"; // home.example.org
const www1Host = "{{domains[www1]}}"; // sibling.example.org
const www2wwwHost = "{{domains[www2.www]}}"; // subdomain.home.example.org

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,68 @@

PASS Cookie with %x0 in name is rejected.
PASS Cookie with %x1 in name is rejected.
PASS Cookie with %x2 in name is rejected.
PASS Cookie with %x3 in name is rejected.
PASS Cookie with %x4 in name is rejected.
PASS Cookie with %x5 in name is rejected.
PASS Cookie with %x6 in name is rejected.
PASS Cookie with %x7 in name is rejected.
PASS Cookie with %x8 in name is rejected.
PASS Cookie with %x9 in name is accepted.
PASS Cookie with %xa in name is rejected.
PASS Cookie with %xb in name is rejected.
PASS Cookie with %xc in name is rejected.
PASS Cookie with %xd in name is rejected.
PASS Cookie with %xe in name is rejected.
PASS Cookie with %xf in name is rejected.
PASS Cookie with %x10 in name is rejected.
PASS Cookie with %x11 in name is rejected.
PASS Cookie with %x12 in name is rejected.
PASS Cookie with %x13 in name is rejected.
PASS Cookie with %x14 in name is rejected.
PASS Cookie with %x15 in name is rejected.
PASS Cookie with %x16 in name is rejected.
PASS Cookie with %x17 in name is rejected.
PASS Cookie with %x18 in name is rejected.
PASS Cookie with %x19 in name is rejected.
PASS Cookie with %x1a in name is rejected.
PASS Cookie with %x1b in name is rejected.
PASS Cookie with %x1c in name is rejected.
PASS Cookie with %x1d in name is rejected.
PASS Cookie with %x1e in name is rejected.
PASS Cookie with %x1f in name is rejected.
PASS Cookie with %x7f in name is rejected.
PASS Cookie with %x0 in name is rejected (DOM).
PASS Cookie with %x1 in name is rejected (DOM).
PASS Cookie with %x2 in name is rejected (DOM).
PASS Cookie with %x3 in name is rejected (DOM).
PASS Cookie with %x4 in name is rejected (DOM).
PASS Cookie with %x5 in name is rejected (DOM).
PASS Cookie with %x6 in name is rejected (DOM).
PASS Cookie with %x7 in name is rejected (DOM).
PASS Cookie with %x8 in name is rejected (DOM).
PASS Cookie with %x9 in name is accepted (DOM).
PASS Cookie with %xa in name is rejected (DOM).
PASS Cookie with %xb in name is rejected (DOM).
PASS Cookie with %xc in name is rejected (DOM).
PASS Cookie with %xd in name is rejected (DOM).
PASS Cookie with %xe in name is rejected (DOM).
PASS Cookie with %xf in name is rejected (DOM).
PASS Cookie with %x10 in name is rejected (DOM).
PASS Cookie with %x11 in name is rejected (DOM).
PASS Cookie with %x12 in name is rejected (DOM).
PASS Cookie with %x13 in name is rejected (DOM).
PASS Cookie with %x14 in name is rejected (DOM).
PASS Cookie with %x15 in name is rejected (DOM).
PASS Cookie with %x16 in name is rejected (DOM).
PASS Cookie with %x17 in name is rejected (DOM).
PASS Cookie with %x18 in name is rejected (DOM).
PASS Cookie with %x19 in name is rejected (DOM).
PASS Cookie with %x1a in name is rejected (DOM).
PASS Cookie with %x1b in name is rejected (DOM).
PASS Cookie with %x1c in name is rejected (DOM).
PASS Cookie with %x1d in name is rejected (DOM).
PASS Cookie with %x1e in name is rejected (DOM).
PASS Cookie with %x1f in name is rejected (DOM).
PASS Cookie with %x7f in name is rejected (DOM).
FAIL Cookie with %x0 in name is rejected or modified (HTTP). assert_equals: The cookie was set as expected. expected "test0 name=0" but got ""
PASS Cookie with %x1 in name is rejected (HTTP).
PASS Cookie with %x2 in name is rejected (HTTP).
PASS Cookie with %x3 in name is rejected (HTTP).
PASS Cookie with %x4 in name is rejected (HTTP).
PASS Cookie with %x5 in name is rejected (HTTP).
PASS Cookie with %x6 in name is rejected (HTTP).
PASS Cookie with %x7 in name is rejected (HTTP).
PASS Cookie with %x8 in name is rejected (HTTP).
PASS Cookie with %x9 in name is accepted (HTTP).
FAIL Cookie with %xa in name is rejected or modified (HTTP). assert_equals: The cookie was set as expected. expected "test10 name=10" but got ""
PASS Cookie with %xb in name is rejected (HTTP).
PASS Cookie with %xc in name is rejected (HTTP).
FAIL Cookie with %xd in name is rejected or modified (HTTP). assert_equals: The cookie was set as expected. expected "test13 name=13" but got ""
PASS Cookie with %xe in name is rejected (HTTP).
PASS Cookie with %xf in name is rejected (HTTP).
PASS Cookie with %x10 in name is rejected (HTTP).
PASS Cookie with %x11 in name is rejected (HTTP).
PASS Cookie with %x12 in name is rejected (HTTP).
PASS Cookie with %x13 in name is rejected (HTTP).
PASS Cookie with %x14 in name is rejected (HTTP).
PASS Cookie with %x15 in name is rejected (HTTP).
PASS Cookie with %x16 in name is rejected (HTTP).
PASS Cookie with %x17 in name is rejected (HTTP).
PASS Cookie with %x18 in name is rejected (HTTP).
PASS Cookie with %x19 in name is rejected (HTTP).
PASS Cookie with %x1a in name is rejected (HTTP).
PASS Cookie with %x1b in name is rejected (HTTP).
PASS Cookie with %x1c in name is rejected (HTTP).
PASS Cookie with %x1d in name is rejected (HTTP).
PASS Cookie with %x1e in name is rejected (HTTP).
PASS Cookie with %x1f in name is rejected (HTTP).
PASS Cookie with %x7f in name is rejected (HTTP).

Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,37 @@
domCookieTest(
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
`Cookie with %x${ctl.code.toString(16)} in name is accepted.`);
`Cookie with %x${ctl.code.toString(16)} in name is accepted (DOM).`);
} else {
domCookieTest(
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
'',
`Cookie with %x${ctl.code.toString(16)} in name is rejected.`);
`Cookie with %x${ctl.code.toString(16)} in name is rejected (DOM).`);
}
}

// Note that per RFC 9110, %x00, %x0A, and %x0D characters in the HTTP
// header MUST either cause the HTTP message to be rejected or be
// replaced with %x20 (space) characters. Both cases will result in a
// passing test here. For more info, see:
// https://www.rfc-editor.org/rfc/rfc9110.html#section-5.5
for (const ctl of CTLS) {
if (ctl.code === 0x09) {
httpCookieTest(
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
`Cookie with %x${ctl.code.toString(16)} in name is accepted (HTTP).`);
} else if (ctl.code === 0x00 || ctl.code === 0x0A || ctl.code === 0x0D) {
httpCookieTest(
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
`test${ctl.code} name=${ctl.code}`,
`Cookie with %x${ctl.code.toString(16)} in name is rejected or modified (HTTP).`,
/* defaultPath */ true, /* allowFetchFailure */ true);
} else {
httpCookieTest(
`test${ctl.code}${ctl.chr}name=${ctl.code}`,
'',
`Cookie with %x${ctl.code.toString(16)} in name is rejected (HTTP).`);
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
expected: "test17b",
name: "Overwrite nameless cookie",
},
{
cookie: ["=__Secure-abc=123", "=__Host-abc=123", "=__SeCuRe-abc=123", "=__HoSt-abc=123", "__Secure-abc", "__Host-abc", "__SeCuRe-abc", "__HoSt-abc"],
expected: "",
name: "Ignore nameless cookies that impersonate cookie prefixes",
},
{
cookie: "=",
expected: "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

PASS Test cookie ordering
FAIL Cookies with longer path attribute values are ordered before shorter ones assert_equals: The cookie was set as expected. expected "testF=1; testB=1; testC=1; testE=1" but got "testB=1; testC=1"
FAIL Cookies with longer path attribute values are ordered before shorter ones (2) assert_equals: The cookie was set as expected. expected "testG=2; testB=2; testF=2; testH=2; testC=2" but got "testB=2; testH=2; testC=2"
PASS Cookies with longer path attribute values are ordered before shorter ones
PASS Cookies with longer path attribute values are ordered before shorter ones (2)
PASS Cookies with longer paths are listed before cookies with shorter paths
FAIL For equal length paths, list the cookie with an earlier creation time first assert_equals: The cookie was set as expected. expected "testB=4; testZ=4; testA=4" but got "testB=4; testA=4; testZ=4"
PASS For equal length paths, list the cookie with an earlier creation time first

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<body>
<script>
const port = "{{ports[http][0]}}";
const wwwHost = "{{hosts[alt][]}}";
const wwwHost = "{{domains[www]}}";

test(t => {
const win = window.open(`http://${wwwHost}:${port}/cookies/ordering/resources/ordering-child.sub.html`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div id=log></div>
<script>
const host = "{{host}}";
const wwwHost = "{{hosts[alt][]}}";
const wwwHost = "{{domains[www]}}";

const orderingTests = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,34 @@
const domCookieName = "__Host-pcdom";
document.cookie = `${domCookieName}=foobar;${attributes}`;

// Set another partitioned cookie using the CookieStore API.
const cookieStoreCookieName = "__Host-pccookistore";
await cookieStore.set({
name: cookieStoreCookieName,
value: "foobar",
path: "/",
sameSite: "none",
partitioned: true,
});
// Set another partitioned cookie using the CookieStore API, if supported.
if (window.cookieStore) {
const cookieStoreCookieName = "__Host-pccookiestore";
await cookieStore.set({
name: cookieStoreCookieName,
value: "foobar",
path: "/",
sameSite: "none",
partitioned: true,
});
}

const cookieNames = getCookieNames();

// Verify that the cookies are sent in requests from this top-level site.
testHttpPartitionedCookies({
origin: self.origin,
cookieNames: [httpCookieName, domCookieName, cookieStoreCookieName],
cookieNames,
expectsCookie: true,
});

// Verify that the cookies are exposed to the DOM on this top-level site.
testDomPartitionedCookies({
cookieNames: [httpCookieName, domCookieName, cookieStoreCookieName],
cookieNames,
expectsCookie: true,
});
testCookieStorePartitionedCookies({
cookieNames: [httpCookieName, domCookieName, cookieStoreCookieName],
cookieNames,
expectsCookie: true,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<script>

const cookieNames = ["__Host-pchttp", "__Host-pcdom", "__Host-pccookiestore"];
const cookieNames = getCookieNames();

testDomPartitionedCookies({
cookieNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// partitioned cookie.
testHttpPartitionedCookies({
origin,
cookieNames: ["__Host-pchttp", "__Host-pcdom"],
cookieNames: getCookieNames(),
expectsCookie: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function testDomPartitionedCookies({cookieNames, expectsCookie}) {
}

function testCookieStorePartitionedCookies({cookieNames, expectsCookie}) {
if (!window.cookieStore) return;
promise_test(async () => {
const cookies = await cookieStore.getAll({partitioned: true});
for (const cookieName of cookieNames) {
Expand All @@ -53,3 +54,11 @@ function testCookieStorePartitionedCookies({cookieNames, expectsCookie}) {
}
}, getPartitionedCookieTestName(expectsCookie, "CookieStore"));
}

function getCookieNames() {
const cookieNames = ["__Host-pchttp", "__Host-pcdom"];
if (window.cookieStore) {
cookieNames.push("__Host-pccookiestore");
}
return cookieNames;
}
Loading

0 comments on commit 0a54278

Please sign in to comment.