Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 78ba6679d9abb85c6a70a713296eb03605092c20
https://github.com/WebKit/WebKit/commit/78ba6679d9abb85c6a70a713296eb03605092c20
Author: Sihui Liu <[email protected]>
Date: 2024-01-25 (Thu, 25 Jan 2024)
Changed paths:
A
LayoutTests/http/tests/resourceLoadStatistics/exemptDomains/managed-domains-cookieEnabled-expected.txt
A
LayoutTests/http/tests/resourceLoadStatistics/exemptDomains/managed-domains-cookieEnabled.html
A
LayoutTests/http/tests/resourceLoadStatistics/resources/managed-domains-cookieEnabled-iframe.html
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/loader/CookieJar.cpp
M Source/WebCore/loader/CookieJar.h
M Source/WebCore/platform/network/NetworkStorageSession.cpp
M Source/WebCore/platform/network/NetworkStorageSession.h
M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
M Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
M Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
M Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in
M Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp
M Source/WebKit/WebProcess/WebPage/WebCookieJar.h
M Source/WebKit/WebProcess/WebProcess.cpp
M Source/WebKit/WebProcess/WebProcess.h
Log Message:
-----------
navigator.cookieEnabled should return false when cookies are actually blocked
https://bugs.webkit.org/show_bug.cgi?id=267789
rdar://121284878
Reviewed by Chris Dumez.
According to
https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-cookieenabled,
cookieEnabled should
return false when cookies cannot be set (i.e. cookies are blocked). However, in
our current implementation, when cookies
are blocked, cookieEnabled may return true. This is because
WebCookieJar::cookiesEnabled returns true when cookie accept
policy is not never, but WebKit does not rely on cookies accept policy to
decide whether cookies should be blocked, see
NetworkStorageSession::shouldBlockCookies, where network process decides
whether to block cookies.
Other cookies operations in WebCookieJar send sync messages to network process
for answer. To make the result of
cookieEnabled consistent with the other operations,
WebCookieJar::cookiesEnabled now also fetches the result from
network process. To avoid performance issues, instead of sending sync message,
web process prefetches and cache the
result in Document. The cache is updated on demand, like when document
navigates to another URL or when cookie blocking
policy changes.
*
LayoutTests/http/tests/resourceLoadStatistics/exemptDomains/managed-domains-cookieEnabled-expected.txt:
Added.
*
LayoutTests/http/tests/resourceLoadStatistics/exemptDomains/managed-domains-cookieEnabled.html:
Added.
*
LayoutTests/http/tests/resourceLoadStatistics/resources/managed-domains-cookieEnabled-iframe.html:
Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setCookieURL):
(WebCore::Document::setFirstPartyForCookies):
(WebCore::Document::updateCachedCookiesEnabled):
* Source/WebCore/dom/Document.h:
(WebCore::Document::cachedCookiesEnabled const):
(WebCore::Document::setCachedCookiesEnabled):
(WebCore::Document::setFirstPartyForCookies): Deleted.
* Source/WebCore/loader/CookieJar.cpp:
(WebCore::CookieJar::cookiesEnabled):
(WebCore::CookieJar::remoteCookiesEnabled const):
(WebCore::CookieJar::cookiesEnabled const): Deleted.
* Source/WebCore/loader/CookieJar.h:
* Source/WebCore/platform/network/NetworkStorageSession.cpp:
(WebCore::NetworkStorageSession::setPrevalentDomainsToBlockAndDeleteCookiesFor):
(WebCore::NetworkStorageSession::setPrevalentDomainsToBlockButKeepCookiesFor):
(WebCore::NetworkStorageSession::setDomainsWithUserInteractionAsFirstParty):
(WebCore::NetworkStorageSession::setAppBoundDomains):
(WebCore::NetworkStorageSession::resetAppBoundDomains):
(WebCore::NetworkStorageSession::setManagedDomains):
(WebCore::NetworkStorageSession::resetManagedDomains):
(WebCore::NetworkStorageSession::cookiesEnabled const):
(WebCore::NetworkStorageSession::addCookiesEnabledStateObserver):
(WebCore::NetworkStorageSession::removeCookiesEnabledStateObserver):
(WebCore::NetworkStorageSession::cookieEnabledStateMayHaveChanged):
* Source/WebCore/platform/network/NetworkStorageSession.h:
(WebCore::CookiesEnabledStateObserver::~CookiesEnabledStateObserver):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
(WebKit::NetworkConnectionToWebProcess::cookiesEnabledSync):
(WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
(WebKit::NetworkConnectionToWebProcess::cookieEnabledStateMayHaveChanged):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
(WebKit::NetworkConnectionToWebProcess::protectedConnection):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::updateCachedCookiesEnabled):
* Source/WebKit/WebProcess/Network/NetworkProcessConnection.h:
* Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in:
* Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp:
(WebKit::WebCookieJar::cookiesEnabled):
(WebKit::WebCookieJar::remoteCookiesEnabledSync const):
(WebKit::WebCookieJar::remoteCookiesEnabled const):
(WebKit::WebCookieJar::cookiesEnabled const): Deleted.
* Source/WebKit/WebProcess/WebPage/WebCookieJar.h:
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setThirdPartyCookieBlockingMode):
(WebKit::WebProcess::updateCachedCookiesEnabled):
* Source/WebKit/WebProcess/WebProcess.h:
Canonical link: https://commits.webkit.org/273522@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes