Resource Load Statistics: Introduce shorter time-to-live for cookie partition whiteli...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 01:22:55 +0000 (01:22 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Apr 2017 01:22:55 +0000 (01:22 +0000)
commit51f7b4989a34216501fe354de71fffe4b533c719
tree2d8d1e138ce5f6b97aede854b31f94559fb2b0fc
parentd5a4675df94ab8b0a0f30a82705cbcc7d99311a4
Resource Load Statistics: Introduce shorter time-to-live for cookie partition whitelisting
https://bugs.webkit.org/show_bug.cgi?id=171295
<rdar://problem/31823818>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html

* loader/ResourceLoadObserver.cpp:
(WebCore::reduceTimeResolutionToOneDay): Deleted.
(WebCore::reduceTimeResolution):
    Changed name to no longer lock this to a specific resolution.
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Now calls WebCore::reduceTimeResolution().
(WebCore::ResourceLoadObserver::setTimeToLiveCookiePartitionFree):
    Added for testing purposes.
(WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
    Added for testing purposes.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::shouldPartitionCookies):
    Static inline convenience function.
(WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
    Now decides whether a domain should get partitioned cookies
    based on timeToLiveCookiePartitionFree.
    Removed clearFirst parameter since it's not needed here
    and it introduced complexity in keeping the store and the
    network process cache in sync.
(WebCore::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
    Added for testing purposes.
* loader/ResourceLoadStatisticsStore.h:

Source/WebKit2:

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain):
    Changes and additions to test infrastructure.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain):
(WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
    Changes and additions to test infrastructure.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
    No longer sends a boolean parameter to
    WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setStatisticsTimeToLiveCookiePartitionFree):
(WTR::TestRunner::statisticsFireShouldPartitionCookiesHandler):
(WTR::TestRunner::statisticsFireShouldPartitionCookiesHandlerForOneDomain):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setStatisticsTimeToLiveCookiePartitionFree):
(WTR::TestController::statisticsFireShouldPartitionCookiesHandler):
(WTR::TestController::statisticsFireShouldPartitionCookiesHandlerForOneDomain):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html:
    Changed a TestRunner function name to
    statisticsFireShouldPartitionCookiesHandlerForOneDomain().
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html: Added.
* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html:
    Changed a TestRunner function name to
    statisticsFireShouldPartitionCookiesHandlerForOneDomain().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [new file with mode: 0644]
LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadObserver.h
Source/WebCore/loader/ResourceLoadStatisticsStore.cpp
Source/WebCore/loader/ResourceLoadStatisticsStore.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp