Skip to content

Commit b4cafb5

Browse files
authored
Default empty string paths to URL's path
Also correct the algorithm as it incorrectly assumed that path could be null when in fact it's always a string. Tests: web-platform-tests/wpt#54264. Closes #242.
1 parent c0d2bb7 commit b4cafb5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

index.bs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,13 +1095,12 @@ run the following steps:
10951095
1. If the [=byte sequence=] [=byte sequence/length=] of |encodedDomain| is greater than the [=cookie/maximum attribute value size=], then return failure.
10961096
1. [=list/Append=] \``Domain`\`/|encodedDomain| to |attributes|.
10971097
1. If |expires| is given, then [=list/append=] \``Expires`\`/|expires| ([=date serialized=]) to |attributes|.
1098-
1. If |path| is not null:
1099-
1. If |path| does not start with U+002F (/), then return failure.
1100-
1. If |path| is not U+002F (/), and |name|, [=byte-lowercased=], [=byte sequence/starts with=] \``__host-`\`, then return failure.
1101-
1. Let |encodedPath| be the result of [=UTF-8 encode|UTF-8 encoding=] |path|.
1102-
1. If the [=byte sequence=] [=byte sequence/length=] of |encodedPath| is greater than the [=cookie/maximum attribute value size=], then return failure.
1103-
1. [=list/Append=] \``Path`\`/|encodedPath| to |attributes|.
1104-
1. Otherwise, [=list/append=] \``Path`\`/ U+002F (/) to |attributes|.
1098+
1. If |path| is the empty string, then set |path| to the [=/serialized cookie default path=] of |url|.
1099+
1. If |path| does not start with U+002F (/), then return failure.
1100+
1. If |path| is not U+002F (/), and |name|, [=byte-lowercased=], [=byte sequence/starts with=] \``__host-`\`, then return failure.
1101+
1. Let |encodedPath| be the result of [=UTF-8 encode|UTF-8 encoding=] |path|.
1102+
1. If the [=byte sequence=] [=byte sequence/length=] of |encodedPath| is greater than the [=cookie/maximum attribute value size=], then return failure.
1103+
1. [=list/Append=] \``Path`\`/|encodedPath| to |attributes|.
11051104
1. [=list/Append=] \``Secure`\`/\`\` to |attributes|.
11061105
1. Switch on |sameSite|:
11071106
<dl class=switch>

0 commit comments

Comments
 (0)