Non-prevalent resources should be allowed access to existing cookies in a third-party context
https://bugs.webkit.org/show_bug.cgi?id=177336
<rdar://problem/
34578257>
Reviewed by Brent Fulgham.
Source/WebCore:
No new tests. I will update existing tests and add at least
one new test in a follow-up patch,
see https://bugs.webkit.org/show_bug.cgi?id=177337. Need to
land this to meet submission deadline and fix the regression.
This patch restructures what is communicated to the network process,
from two vectors - with user interaction and without user interaction -
to three vectors - to partition, to block, to neither partition nor block.
The previous two vectors did not allow proper categorization into which
domains should be partitioned, blocked, or left alone. That was the cause
of the regression where non-prevalent third-party domains erroneously had
their cookies blocked when they should fall back to the old behavior of
access but no new cookies allowed to be set.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::toString const):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::shouldPartitionCookies const):
(WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
(WebCore::NetworkStorageSession::shouldBlockCookies const):
(WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
(WebCore::NetworkStorageSession::removePrevalentDomains):
(WebCore::NetworkStorageSession::shouldAllowThirdPartyCookies const): Deleted.
(WebCore::NetworkStorageSession::setPrevalentDomainsWithAndWithoutInteraction): Deleted.
* platform/network/mac/CookieJarMac.mm:
(WebCore::cookiesInBlockedForURL):
(WebCore::cookiesForURL):
Source/WebKit:
This patch restructures what is communicated to the network process,
from two vectors - with user interaction and without user interaction -
to three vectors - to partition, to block, to neither partition nor block.
The previous two vectors did not allow proper categorization into which
domains should be partitioned, blocked, or left alone. That was the cause
of the regression where non-prevalent third-party domains erroneously had
their cookies blocked when they should fall back to the old behavior of
access but no new cookies allowed to be set.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies):
(WebKit::NetworkProcess::updatePrevalentDomainsWithAndWithoutInteraction): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
(WebKit::WebResourceLoadStatisticsStore::clearInMemory):
(WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
(WebKit::WebResourceLoadStatisticsStore::shouldBlockCookies const):
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
(WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains):
(WebKit::WebResourceLoadStatisticsStore::resetCookiePartitioningState):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
(WebKit::WebsiteDataStore::updatePrevalentDomainsWithAndWithoutInteraction): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
LayoutTests:
This patch restructures what is communicated to the network process,
from two vectors - with user interaction and without user interaction -
to three vectors - to partition, to block, to neither partition nor block.
The previous two vectors did not allow proper categorization into which
domains should be partitioned, blocked, or left alone. That was the cause
of the regression where non-prevalent third-party domains erroneously had
their cookies blocked when they should fall back to the old behavior of
access but no new cookies allowed to be set.
See follow-up bug to assess these tests:
https://bugs.webkit.org/show_bug.cgi?id=177337
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-network-process-crash.html:
* http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html:
* platform/mac-wk2/TestExpectations:
Marked two new failures since the need to be reworked in:
https://bugs.webkit.org/show_bug.cgi?id=177337
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222396
268f45cc-cd09-0410-ab3c-
d52691b4dbfc