Skip to content

Commit

Permalink
Switch assertion in test=42 to follow latest 6265bis update.
Browse files Browse the repository at this point in the history
Also, add a few more tests inspired by bingler@'s GitHub comments.

Previously, the cookie spec left an empty domain attribute as
undefined behavior with SHOULD-level guidance.
httpwg/http-extensions#1709 changes the
spec to require handling of a cookie as a host cookie when its
last domain attribute is empty. This matches the current behavior
of Firefox and Safari.

See httpwg/http-extensions#1332 for
more discussion.

Change-Id: Ibf4f243c929b11768ff406e940d6988a37434754
Bug: 1255273
  • Loading branch information
miketaylr authored and chromium-wpt-export-bot committed Oct 12, 2021
1 parent a8c0487 commit 23f848c
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions cookies/attributes/resources/domain-child.sub.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@
},
{
cookie: `test=42; domain=${www1Host}; domain=`,
expected: "",
name: "No cookie returned for domain mismatch (with domain mismatch as first domain attribute and second a bare attribute)",
expected: "test=42",
name: "Cookie returned for bare domain attribute following mismatched domain attribute (after redirect to same-origin page).",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
{
Expand All @@ -332,6 +332,30 @@
name: "Cookies with same name, path, and domain (differing only in leading '.') overwrite each other ('.' first)",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
{
cookie: `test=46; domain=.`,
expected: "test=46",
name: "Domain with single . as value should be treated as host cookie",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
{
cookie: ["test=47", `test=47b; domain=${host}`,`test=47b; domain=${www1Host}; domain=`],
expected: "test=47b; test=47b",
name: "Empty domain treated as host cookie 1",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
{
cookie: ["test=48", `test=48b; domain=${host}`,`test=48b; domain=${host}; domain=`],
expected: "test=48b; test=48b",
name: "Empty domain treated as host cookie 2",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
{
cookie: ["test=49", `test=49b; domain=${host}`,`test=49b; domain=`],
expected: "test=49b; test=49b",
name: "Empty domain treated as host cookie 3",
location: `http://${wwwHost}:${port}/cookies/attributes/resources/path.html`,
},
];

for (const test of domainTests) {
Expand Down

0 comments on commit 23f848c

Please sign in to comment.