Diff
Modified: trunk/LayoutTests/ChangeLog (215781 => 215782)
--- trunk/LayoutTests/ChangeLog 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/LayoutTests/ChangeLog 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1,3 +1,20 @@
+2017-04-25 John Wilander <wilan...@apple.com>
+
+ 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.
+
+ * 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().
+
2017-04-25 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r215476.
Modified: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html (215781 => 215782)
--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html 2017-04-26 01:22:55 UTC (rev 215782)
@@ -93,7 +93,7 @@
testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
testRunner.setStatisticsMinimumTimeBetweeenDataRecordsRemoval(0);
- testRunner.statisticsFireShouldPartitionCookiesHandler("localhost", true);
+ testRunner.statisticsFireShouldPartitionCookiesHandlerForOneDomain("localhost", true);
testRunner.setStatisticsPrevalentResource("http://localhost", true);
if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
testFailed("Host did not get set as prevalent resource.");
Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt (0 => 215782)
--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt 2017-04-26 01:22:55 UTC (rev 215782)
@@ -0,0 +1,108 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: Test for Partitioned and Unpartitioned Cookie With User Interaction
+main frame - didChangeLocationWithinPageForFrame
+CONSOLE MESSAGE: line 63: Step 1
+main frame - willPerformClientRedirectToURL: http://localhost:8000/loading/resourceLoadStatistics/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html#step2
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html#step2
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: Test for Partitioned and Unpartitioned Cookie With User Interaction
+CONSOLE MESSAGE: line 68: Step 2
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+CONSOLE MESSAGE: line 75: Step 3
+main frame - didHandleOnloadEventsForFrame
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame1-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishDocumentLoadForFrame
+CONSOLE MESSAGE: line 82: Step 4
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame2-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didFinishDocumentLoadForFrame
+CONSOLE MESSAGE: line 89: Step 5
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame3-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame2-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame3-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+CONSOLE MESSAGE: line 96: Step 6
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame4-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame4-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame4-->-->" - didFinishDocumentLoadForFrame
+CONSOLE MESSAGE: line 103: Step 7
+frame "<!--framePath //<!--frame5-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame4-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame4-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame5-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame5-->-->" - didFinishDocumentLoadForFrame
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Should receive no cookies.
+Did not receive cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie:
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+Setting partitioned, third-party cookie.
+
+
+--------
+Frame: '<!--framePath //<!--frame2-->-->'
+--------
+Should only receive partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+Client-side document.cookie: thirdPartyCookie=value
+
+--------
+Frame: '<!--framePath //<!--frame3-->-->'
+--------
+After first user interaction, should only receive un-partitioned cookie.
+Received cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie: firstPartyCookie=value
+
+--------
+Frame: '<!--framePath //<!--frame4-->-->'
+--------
+Should only receive partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+Client-side document.cookie: thirdPartyCookie=value
+
+--------
+Frame: '<!--framePath //<!--frame5-->-->'
+--------
+After second user interaction, should only receive un-partitioned cookie.
+Received cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie: firstPartyCookie=value
Copied: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html (from rev 215780, trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html) (0 => 215782)
--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html 2017-04-26 01:22:55 UTC (rev 215782)
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Test for Partitioned and Unpartitioned Cookie With User Interaction</title>
+ <script src=""
+</head>
+<body>
+<script>
+ const partitionHost = "127.0.0.1:8000";
+ const thirdPartyOrigin = "http://localhost:8000";
+ const thirdPartyBaseUrl = thirdPartyOrigin + "/loading/resourceLoadStatistics/resources";
+ const firstPartyCookieName = "firstPartyCookie";
+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
+ const thirdPartyCookieName = "thirdPartyCookie";
+ const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value";
+ const fragmentWithReturnUrl = "http://" + partitionHost + "/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html";
+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName;
+
+ function setEnableFeature(enable) {
+ if (!enable) {
+ testRunner.statisticsResetToConsistentState();
+ }
+ internals.setResourceLoadStatisticsEnabled(enable);
+ testRunner.setCookieStoragePartitioningEnabled(enable);
+ }
+
+ function finishTest() {
+ setEnableFeature(false);
+ testRunner.notifyDone();
+ }
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ function fireShouldPartitionCookiesHandlerAndContinue() {
+ testRunner.statisticsFireShouldPartitionCookiesHandler();
+ runTest();
+ }
+
+ function setShortCookiePartitioningTimeOutPlusFireShouldPartitionCookiesHandlerAndContinue() {
+ testRunner.setStatisticsTimeToLiveCookiePartitionFree(1);
+ setTimeout(fireShouldPartitionCookiesHandlerAndContinue, 2000);
+ }
+
+ function setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue() {
+ testRunner.setStatisticsTimeToLiveCookiePartitionFree(86400);
+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true);
+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+ testFailed("Third party did not get logged for user interaction.");
+ runTest();
+ }
+
+ function runTest() {
+ switch (document.location.hash) {
+ case "#step1":
+ console.log("Step 1");
+ // Set first-party cookie for http://localhost:8000
+ document.location.href = "" + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2";
+ break;
+ case "#step2":
+ console.log("Step 2");
+ // Check that the first-party cookie is not sent in partition 127.0.0.1:8000
+ document.location.hash = "step3";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.",
+ runTest);
+ break;
+ case "#step3":
+ console.log("Step 3");
+ // Set third-party cookie for http://localhost:8000 in partition 127.0.0.1:8000
+ document.location.hash = "step4";
+ openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third-party cookie.",
+ runTest);
+ break;
+ case "#step4":
+ console.log("Step 4");
+ // Check that only partitioned cookie get sent in partition 127.0.0.1:8000
+ document.location.hash = "step5";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third-party cookie.",
+ setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue);
+ break;
+ case "#step5":
+ console.log("Step 5");
+ // http://localhost:8000 now has user interaction, check that un-partitioned cookie is sent for third-party
+ document.location.hash = "step6";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After first user interaction, should only receive un-partitioned cookie.",
+ setShortCookiePartitioningTimeOutPlusFireShouldPartitionCookiesHandlerAndContinue);
+ break;
+ case "#step6":
+ console.log("Step 6");
+ // Cookie partitioning should be applied again
+ document.location.hash = "step7";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third-party cookie.",
+ setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue);
+ break;
+ case "#step7":
+ console.log("Step 7");
+ // http://localhost:8000 now has fresh user interaction, check that un-partitioned cookie is sent for third-party
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After second user interaction, should only receive un-partitioned cookie.",
+ finishTest);
+ break;
+ }
+ }
+
+ if (document.location.hash === "" && window.testRunner && window.internals) {
+ setEnableFeature(true);
+
+ testRunner.setStatisticsPrevalentResource("http://localhost", true);
+ if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
+ testFailed("Host did not get set as prevalent resource.");
+
+ testRunner.statisticsFireShouldPartitionCookiesHandler();
+
+ testRunner.waitUntilDone();
+ testRunner.dumpChildFramesAsText();
+ document.location.hash = "step1";
+ }
+
+ runTest();
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html (215781 => 215782)
--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html 2017-04-26 01:22:55 UTC (rev 215782)
@@ -72,7 +72,7 @@
if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) {
setEnableFeature(true);
- testRunner.statisticsFireShouldPartitionCookiesHandler("localhost", true);
+ testRunner.statisticsFireShouldPartitionCookiesHandlerForOneDomain("localhost", true);
testRunner.waitUntilDone();
testRunner.dumpChildFramesAsText();
Modified: trunk/Source/WebCore/ChangeLog (215781 => 215782)
--- trunk/Source/WebCore/ChangeLog 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebCore/ChangeLog 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1,3 +1,37 @@
+2017-04-25 John Wilander <wilan...@apple.com>
+
+ 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.
+
+ 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:
+
2017-04-25 Saam Barati <sbar...@apple.com>
JSArray::isArrayPrototypeIteratorProtocolFastAndNonObservable is wrong because it does not do the necessary checks on the base object
Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (215781 => 215782)
--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -48,8 +48,8 @@
namespace WebCore {
-// One day in seconds.
-static auto timestampResolution = 86400;
+// One hour in seconds.
+static auto timestampResolution = 3600;
ResourceLoadObserver& ResourceLoadObserver::sharedObserver()
{
@@ -301,7 +301,7 @@
m_store->fireDataModificationHandler();
}
-static double reduceTimeResolutionToOneDay(double seconds)
+static double reduceTimeResolution(double seconds)
{
return std::floor(seconds / timestampResolution) * timestampResolution;
}
@@ -320,7 +320,7 @@
auto primaryDomainStr = primaryDomain(url);
auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomainStr);
- double newTimestamp = reduceTimeResolutionToOneDay(WTF::currentTime());
+ double newTimestamp = reduceTimeResolution(WTF::currentTime());
if (newTimestamp == statistics.mostRecentUserInteraction)
return;
@@ -427,11 +427,21 @@
m_store->setTimeToLiveUserInteraction(seconds);
}
+void ResourceLoadObserver::setTimeToLiveCookiePartitionFree(double seconds)
+{
+ m_store->setTimeToLiveCookiePartitionFree(seconds);
+}
+
void ResourceLoadObserver::fireDataModificationHandler()
{
m_store->fireDataModificationHandler();
}
+void ResourceLoadObserver::fireShouldPartitionCookiesHandler()
+{
+ m_store->fireShouldPartitionCookiesHandler();
+}
+
void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
{
m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (215781 => 215782)
--- trunk/Source/WebCore/loader/ResourceLoadObserver.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -63,9 +63,11 @@
WEBCORE_EXPORT void setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo);
WEBCORE_EXPORT void setTimeToLiveUserInteraction(double seconds);
+ WEBCORE_EXPORT void setTimeToLiveCookiePartitionFree(double seconds);
WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
WEBCORE_EXPORT void fireDataModificationHandler();
+ WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
WEBCORE_EXPORT void setStatisticsStore(Ref<ResourceLoadStatisticsStore>&&);
Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (215781 => 215782)
--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -41,6 +41,8 @@
static const auto statisticsModelVersion = 3;
// 30 days in seconds
static auto timeToLiveUserInteraction = 2592000;
+// 1 day in seconds
+static auto timeToLiveCookiePartitionFree = 86400;
Ref<ResourceLoadStatisticsStore> ResourceLoadStatisticsStore::create()
{
@@ -179,23 +181,33 @@
m_dataAddedHandler();
}
-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(bool clearFirst)
+static inline bool shouldPartitionCookies(const ResourceLoadStatistics& statistic)
{
+ return statistic.isPrevalentResource
+ && (!statistic.hadUserInteraction || currentTime() > statistic.mostRecentUserInteraction + timeToLiveCookiePartitionFree);
+}
+
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
+{
Vector<String> domainsToRemove;
Vector<String> domainsToAdd;
for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
- bool recentUserInteraction = hasHadRecentUserInteraction(resourceStatistic);
- if (resourceStatistic.isMarkedForCookiePartitioning && recentUserInteraction) {
+ bool shouldPartition = shouldPartitionCookies(resourceStatistic);
+ if (resourceStatistic.isMarkedForCookiePartitioning && !shouldPartition) {
resourceStatistic.isMarkedForCookiePartitioning = false;
domainsToRemove.append(resourceStatistic.highLevelDomain);
- } else if (!resourceStatistic.isMarkedForCookiePartitioning && !recentUserInteraction && resourceStatistic.isPrevalentResource) {
+ } else if (!resourceStatistic.isMarkedForCookiePartitioning && shouldPartition) {
resourceStatistic.isMarkedForCookiePartitioning = true;
domainsToAdd.append(resourceStatistic.highLevelDomain);
}
}
- fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
+ if (domainsToRemove.isEmpty() && domainsToAdd.isEmpty())
+ return;
+
+ if (m_shouldPartitionCookiesForDomainsHandler)
+ m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd, false);
}
void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
@@ -205,6 +217,17 @@
if (m_shouldPartitionCookiesForDomainsHandler)
m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd, clearFirst);
+
+ if (clearFirst) {
+ for (auto& resourceStatistic : m_resourceStatisticsMap.values())
+ resourceStatistic.isMarkedForCookiePartitioning = false;
+ } else {
+ for (auto& domain : domainsToRemove)
+ ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookiePartitioning = false;
+ }
+
+ for (auto& domain : domainsToAdd)
+ ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookiePartitioning = true;
}
void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(double seconds)
@@ -213,6 +236,12 @@
timeToLiveUserInteraction = seconds;
}
+void ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree(double seconds)
+{
+ if (seconds >= 0)
+ timeToLiveCookiePartitionFree = seconds;
+}
+
void ResourceLoadStatisticsStore::processStatistics(std::function<void(ResourceLoadStatistics&)>&& processFunction)
{
for (auto& resourceStatistic : m_resourceStatisticsMap.values())
Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h (215781 => 215782)
--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -63,7 +63,8 @@
void fireDataModificationHandler();
void setTimeToLiveUserInteraction(double seconds);
- WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(bool clearFirst);
+ void setTimeToLiveCookiePartitionFree(double seconds);
+ WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
WEBCORE_EXPORT void processStatistics(std::function<void(ResourceLoadStatistics&)>&&);
Modified: trunk/Source/WebKit2/ChangeLog (215781 => 215782)
--- trunk/Source/WebKit2/ChangeLog 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1,3 +1,29 @@
+2017-04-25 John Wilander <wilan...@apple.com>
+
+ 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.
+
+ * 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().
+
2017-04-25 Simon Fraser <simon.fra...@apple.com>
REGRESSION (r213719): WebGL content on cubeslam.com is 1/4 expected size
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp (215781 => 215782)
--- trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -76,16 +76,26 @@
WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction(seconds);
}
+void WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree(double seconds)
+{
+ WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree(seconds);
+}
+
void WKResourceLoadStatisticsManagerFireDataModificationHandler()
{
WebResourceLoadStatisticsManager::fireDataModificationHandler();
}
-void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value)
+void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler()
{
- WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(toWTFString(hostName), value);
+ WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler();
}
+void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain(WKStringRef hostName, bool value)
+{
+ WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain(toWTFString(hostName), value);
+}
+
void WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(bool value)
{
WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(value);
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h (215781 => 215782)
--- trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -41,8 +41,10 @@
WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName);
WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo);
WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds);
+ WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree(double seconds);
WK_EXPORT void WKResourceLoadStatisticsManagerFireDataModificationHandler();
- WK_EXPORT void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value);
+ WK_EXPORT void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler();
+ WK_EXPORT void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain(WKStringRef hostName, bool value);
WK_EXPORT void WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(bool value);
WK_EXPORT void WKResourceLoadStatisticsManagerSetShouldClassifyResourcesBeforeDataRecordsRemoval(bool value);
WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds);
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp (215781 => 215782)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -81,13 +81,23 @@
WebCore::ResourceLoadObserver::sharedObserver().setTimeToLiveUserInteraction(seconds);
}
+void WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree(double seconds)
+{
+ WebCore::ResourceLoadObserver::sharedObserver().setTimeToLiveCookiePartitionFree(seconds);
+}
+
void WebResourceLoadStatisticsManager::fireDataModificationHandler()
{
WebCore::ResourceLoadObserver::sharedObserver().fireDataModificationHandler();
}
-void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
+void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler()
{
+ WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler();
+}
+
+void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain(const String& hostName, bool value)
+{
if (value)
WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName}, false);
else
@@ -117,6 +127,7 @@
void WebResourceLoadStatisticsManager::resetToConsistentState()
{
WebCore::ResourceLoadObserver::sharedObserver().setTimeToLiveUserInteraction(2592000);
+ WebCore::ResourceLoadObserver::sharedObserver().setTimeToLiveCookiePartitionFree(86400);
WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned(false);
WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval(true);
WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval(60);
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h (215781 => 215782)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -46,9 +46,11 @@
static void setSubresourceUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName);
static void setSubresourceUniqueRedirectTo(const String& hostName, const String& hostNameRedirectedTo);
static void setTimeToLiveUserInteraction(double seconds);
+ static void setTimeToLiveCookiePartitionFree(double seconds);
static void setReducedTimestampResolution(double seconds);
static void fireDataModificationHandler();
- static void fireShouldPartitionCookiesHandler(const String& hostName, bool value);
+ static void fireShouldPartitionCookiesHandler();
+ static void fireShouldPartitionCookiesHandlerForOneDomain(const String& hostName, bool value);
static void setNotifyPagesWhenDataRecordsWereScanned(bool);
static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value);
static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds);
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (215781 => 215782)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -152,7 +152,7 @@
coreStore().mergeStatistics(origins);
// Fire before processing statistics to propagate user
// interaction as fast as possible to the network process.
- coreStore().fireShouldPartitionCookiesHandler(false);
+ coreStore().fireShouldPartitionCookiesHandler();
processStatisticsAndDataRecords();
}
Modified: trunk/Tools/ChangeLog (215781 => 215782)
--- trunk/Tools/ChangeLog 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/ChangeLog 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1,3 +1,25 @@
+2017-04-25 John Wilander <wilan...@apple.com>
+
+ 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.
+
+ * 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):
+
2017-04-25 Tim Horton <timothy_hor...@apple.com>
Try to fix the WKTR build after r215758
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2017-04-26 01:22:55 UTC (rev 215782)
@@ -258,8 +258,10 @@
void setStatisticsSubresourceUnderTopFrameOrigin(DOMString hostName, DOMString topFrameHostName);
void setStatisticsSubresourceUniqueRedirectTo(DOMString hostName, DOMString hostNameRedirectedTo);
void setStatisticsTimeToLiveUserInteraction(double seconds);
+ void setStatisticsTimeToLiveCookiePartitionFree(double seconds);
void statisticsFireDataModificationHandler();
- void statisticsFireShouldPartitionCookiesHandler(DOMString hostName, boolean value);
+ void statisticsFireShouldPartitionCookiesHandler();
+ void statisticsFireShouldPartitionCookiesHandlerForOneDomain(DOMString hostName, boolean value);
void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value);
void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value);
void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1325,6 +1325,13 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
}
+void TestRunner::setStatisticsTimeToLiveCookiePartitionFree(double seconds)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsTimeToLiveCookiePartitionFree"));
+ WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
void TestRunner::installStatisticsDidModifyDataRecordsCallback(JSValueRef callback)
{
cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback);
@@ -1341,8 +1348,14 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
}
-void TestRunner::statisticsFireShouldPartitionCookiesHandler(JSStringRef hostName, bool value)
+void TestRunner::statisticsFireShouldPartitionCookiesHandler()
{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireShouldPartitionCookiesHandler"));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
+}
+
+void TestRunner::statisticsFireShouldPartitionCookiesHandlerForOneDomain(JSStringRef hostName, bool value)
+{
Vector<WKRetainPtr<WKStringRef>> keys;
Vector<WKRetainPtr<WKTypeRef>> values;
@@ -1360,7 +1373,7 @@
rawValues[i] = values[i].get();
}
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireShouldPartitionCookiesHandler"));
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireShouldPartitionCookiesHandlerForOneDomain"));
WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -350,7 +350,8 @@
void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback);
void statisticsDidModifyDataRecordsCallback();
void statisticsFireDataModificationHandler();
- void statisticsFireShouldPartitionCookiesHandler(JSStringRef hostName, bool value);
+ void statisticsFireShouldPartitionCookiesHandler();
+ void statisticsFireShouldPartitionCookiesHandlerForOneDomain(JSStringRef hostName, bool value);
void setStatisticsPrevalentResource(JSStringRef hostName, bool value);
bool isStatisticsPrevalentResource(JSStringRef hostName);
void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value);
@@ -359,6 +360,7 @@
void setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName);
void setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo);
void setStatisticsTimeToLiveUserInteraction(double seconds);
+ void setStatisticsTimeToLiveCookiePartitionFree(double seconds);
void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -2249,16 +2249,26 @@
WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(seconds);
}
+void TestController::setStatisticsTimeToLiveCookiePartitionFree(double seconds)
+{
+ WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree(seconds);
+}
+
void TestController::statisticsFireDataModificationHandler()
{
WKResourceLoadStatisticsManagerFireDataModificationHandler();
}
-void TestController::statisticsFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value)
+void TestController::statisticsFireShouldPartitionCookiesHandler()
{
- WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(hostName, value);
+ WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler();
}
+void TestController::statisticsFireShouldPartitionCookiesHandlerForOneDomain(WKStringRef hostName, bool value)
+{
+ WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain(hostName, value);
+}
+
void TestController::setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool value)
{
WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(value);
Modified: trunk/Tools/WebKitTestRunner/TestController.h (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/TestController.h 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2017-04-26 01:22:55 UTC (rev 215782)
@@ -157,8 +157,10 @@
void setStatisticsSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName);
void setStatisticsSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo);
void setStatisticsTimeToLiveUserInteraction(double seconds);
+ void setStatisticsTimeToLiveCookiePartitionFree(double seconds);
void statisticsFireDataModificationHandler();
- void statisticsFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value);
+ void statisticsFireShouldPartitionCookiesHandler();
+ void statisticsFireShouldPartitionCookiesHandlerForOneDomain(WKStringRef hostName, bool value);
void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double);
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (215781 => 215782)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-04-26 01:11:56 UTC (rev 215781)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-04-26 01:22:55 UTC (rev 215782)
@@ -1002,6 +1002,13 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsTimeToLiveCookiePartitionFree")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID());
+ WKDoubleRef seconds = static_cast<WKDoubleRef>(messageBody);
+ TestController::singleton().setStatisticsTimeToLiveCookiePartitionFree(WKDoubleGetValue(seconds));
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "StatisticsFireDataModificationHandler")) {
TestController::singleton().statisticsFireDataModificationHandler();
return nullptr;
@@ -1008,6 +1015,11 @@
}
if (WKStringIsEqualToUTF8CString(messageName, "StatisticsFireShouldPartitionCookiesHandler")) {
+ TestController::singleton().statisticsFireShouldPartitionCookiesHandler();
+ return nullptr;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "StatisticsFireShouldPartitionCookiesHandlerForOneDomain")) {
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
@@ -1017,7 +1029,7 @@
WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get()));
WKBooleanRef value = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, valueKey.get()));
- TestController::singleton().statisticsFireShouldPartitionCookiesHandler(hostName, WKBooleanGetValue(value));
+ TestController::singleton().statisticsFireShouldPartitionCookiesHandlerForOneDomain(hostName, WKBooleanGetValue(value));
return nullptr;
}