Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 40c01e0830ae322be1fae407faf577d5e5fb57fb
https://github.com/WebKit/WebKit/commit/40c01e0830ae322be1fae407faf577d5e5fb57fb
Author: Ronan Turner <[email protected]>
Date: 2026-01-21 (Wed, 21 Jan 2026)
Changed paths:
M Source/WebCore/platform/network/cocoa/CookieStorageObserver.h
M Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm
M Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/EnhancedSecurityPolicies.mm
Log Message:
-----------
Workaround Cookie observer issues with Enhanced Security heuristics
https://bugs.webkit.org/show_bug.cgi?id=305331
rdar://167988684
Reviewed by Matthew Finkel.
A bug exists in CFNetwork which can cause our notification registration
for cookie changes to be unregistered. This occurs when a
NSHTTPCookieStorage object is destroyed, particularly when a
non-persistent website data store is used.
When the Enhanced Security heuristics flag is enabled, we perform a
hasCookies call to check for cookies more regularly, which surfaces this
bug more frequently. This change applies a temporary workaround that
re-registers for cookie notifications, if required, after a call to
hasCookies.
A new test is also added that ensures this behaviour is tested for.
Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/EnhancedSecurityPolicies.mm
* Source/WebCore/platform/network/cocoa/CookieStorageObserver.h:
* Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm:
(WebCore::CookieStorageObserver::startObserving):
(WebCore::CookieStorageObserver::registerInternalsForNotifications):
* Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::hasCookies const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/EnhancedSecurityPolicies.mm:
(-[EnhancedSecurityCookieObserver cookiesDidChangeInCookieStore:]):
(TEST(EnhancedSecurityPolicies, NonPersistentDataStoreCookieNotification)):
Canonical link: https://commits.webkit.org/305930@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications