Resource Load Statistics: Block cookies for prevalent resources without user interaction
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2018 19:16:23 +0000 (19:16 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2018 19:16:23 +0000 (19:16 +0000)
commit8a5e62982eb01ad2d22567e0a2a31b2ae5c1fa41
tree21b35df9f2af12a10dd28aad334a6d7681aabeb4
parent24ec3c616f334d67d09c5da249e257a954c89a53
Resource Load Statistics: Block cookies for prevalent resources without user interaction
https://bugs.webkit.org/show_bug.cgi?id=177394
<rdar://problem/34613960>

Reviewed by Alex Christensen.

Source/WebCore:

Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
       http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
       http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
       http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html

* platform/network/NetworkStorageSession.h:
    Now exports NetworkStorageSession::nsCookieStorage().
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
    Fixes the FIXME.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:
    Declaration of _initWithIdentifier() on NSHTTPCookieStorage.

Source/WebKit:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
    Now has m_hasBeenSetToUseStatelessCookieStorage to handle
    cookie blocking.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
    Returns singleton empty, deny-all cookie storage for cookie blocking.
(WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
    Instead of just decision making, this now applies the policy.
(WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy):
    New method.
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
    Now blocks cookies for domains where cookies will be purged anyway.
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
    Now blocks cookies for domains where cookies will be purged anyway.
(WebKit::shouldChangePartition): Deleted.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
    Now downgrades for blocked cookies instead of partitioned cookies.
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
    Now downgrades for blocked cookies instead of partitioned cookies.

LayoutTests:

* http/tests/resourceLoadStatistics/add-blocking-to-redirect-expected.txt: Added.
* http/tests/resourceLoadStatistics/add-blocking-to-redirect.html: Added.
* http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html:
* http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html: Added.
* http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html:
* http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt: Added.
* http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html: Added.
* http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt: Removed.
* http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html: Removed.
    Test case reworked and is now remove-partitioning-in-redirect.html.
* http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt: Added.
* http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html: Added.
* platform/ios/TestExpectations:
    New tests marked as [ Pass ] for iOS.
* platform/mac-wk2/TestExpectations:
    New tests marked as [ Pass ] for High Sierra+.
* platform/wk2/TestExpectations:
    New tests skipped for WK2 in general.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [moved from LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html with 54% similarity]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm