Non-prevalent resources should be allowed access to existing cookies in a third-party...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 18:53:32 +0000 (18:53 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 18:53:32 +0000 (18:53 +0000)
commit9e9b4755340e70df918016b13182314b8ebe2cae
tree1448eb3198d3a70d3e6f60ac6a296ae84c7dfb35
parent37e0acc2f9b05ea8eec9c5b368d1d90fc40f6512
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
19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-network-process-crash.html
LayoutTests/http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadStatistics.cpp
Source/WebCore/loader/ResourceLoadStatistics.h
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h