Bug 247037
| Summary: | Safari strips whitespace around comma when setting with document.cookie | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | April King <april> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | achristensen, ap, cdumez, webkit-bug-importer, wilander |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
April King
Extremely bizarre bug and I'm hard pressed to think of what would cause it but running this code:
> document.cookie="foo=hello , world"
< "foo=hello , world"
> document.cookie
< "foo=hello,world"
Shows that setting a cookie to "hello , world" causes it to be saved as "hello,world".
Note that using characters besides commas seem to not have this issue:
> document.cookie="foo=hello $ world"
< "foo=hello $ world"
> document.cookie
< "foo=hello $ world"
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
One theory is that the cookie value is parsed by a function that treats commas as in HTTP, separating multiple values.
In NetworkStorageSessionCocoa.mm:
NSHTTPCookie *initialCookie = [NSHTTPCookie _cookieForSetCookieString:cookieString forURL:cookieURL partition:nil];
Radar WebKit Bug Importer
<rdar://problem/101834060>