Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d01d085ea0fdef14a17d1c9765c49b8fee40fa67
https://github.com/WebKit/WebKit/commit/d01d085ea0fdef14a17d1c9765c49b8fee40fa67
Author: Brent Fulgham <[email protected]>
Date: 2026-08-27 (Thu, 27 Aug 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/expires-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/expires.html
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/platform/Cookie.h
M Source/WebCore/platform/network/Cookie.cpp
M Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
M Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
Log Message:
-----------
[CFNetwork] Honor Expires cookie dates that use JS Date.toString() dates
(month-before-day Expires values)
https://bugs.webkit.org/show_bug.cgi?id=322546
rdar://185840799
Reviewed by Matthew Finkel.
CFNetwork's cookie-date parser rejects a cookie-date containing a
month-before-day date
format. Unfortunately, this is the format JavaScript's
Date.prototype.toString() method
produces (at least in some locales). This causes cookies with an Expires
attribute of
that form to be silently ignored, converting the cookie from a persistent value
to a
session cookie (which disappears when the browser quits).
This patch introduces an initial scan for month-first date formats, and fixes
up the
string if necessary. We perform the date fix-up prior to handing off to
CFNetwork (or
libSOUP) so that we only have to perform the cookie parsing logic once. The
cURL ports
never rejected month-before-day strings, so did not suffer from this behavior.
While this patch is largely a workaround until CFNetwork and libSOUP fix their
underlying
implementations, it also allows us to improve behavior for downlevel shipment
of Safari
as well as Safari Technology Preview.
This fix can only cover document.cookie cases. The Set-Cookie response-header
path is parsed
inside NSURLSession before WebKit sees the response, so there is no
interception point;
that half is fixed only by rdar://185837942.
*
LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/expires-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cookies/attributes/expires.html:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/Cookie.h:
* Source/WebCore/platform/network/Cookie.cpp:
(WebCore::CookieUtil::isMonthNameToken):
(WebCore::CookieUtil::cookieStringWithDayFirstExpires):
* Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::parseDOMCookie): Repair the parsed cookie before adjusting it.
* Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::setCookiesFromDOM const):
Canonical link: https://commits.webkit.org/320016@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications