Modified: trunk/Source/WebKit/ChangeLog (229426 => 229427)
--- trunk/Source/WebKit/ChangeLog 2018-03-08 20:43:34 UTC (rev 229426)
+++ trunk/Source/WebKit/ChangeLog 2018-03-08 21:11:50 UTC (rev 229427)
@@ -1,3 +1,31 @@
+2018-03-08 John Wilander <wilan...@apple.com>
+
+ Resource Load Statistics: Make debug mode always partition prevalent resources
+ https://bugs.webkit.org/show_bug.cgi?id=183468
+ <rdar://problem/38269437>
+
+ Reviewed by Brent Fulgham.
+
+ After some testing we decided that a 30 second timeout in ITP debug mode just makes
+ it confusing. We should instead always partition prevalent resources in debug mode
+ to make it easy to understand. The partitioned state is what developers want to test
+ anyway.
+
+ * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
+ (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
+ Minor change to include 0 as valid setting.
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
+ Now just stores the setting of debug mode instead of changing the timeout.
+ (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
+ Now does not disable partitioning under debug mode.
+ (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
+ Now returns true for prevalent resources with user interaction under debug mode.
+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
+ Removed duplicate debug logging statement.
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ Added member m_debugModeEnabled.
+
2018-03-08 Brent Fulgham <bfulg...@apple.com>
Remove WebCookieManager and messaging from WebContent process.
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm (229426 => 229427)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm 2018-03-08 20:43:34 UTC (rev 229426)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm 2018-03-08 21:11:50 UTC (rev 229427)
@@ -38,15 +38,15 @@
setTimeToLiveUserInteraction(timeToLiveUserInteraction);
Seconds timeToLiveCookiePartitionFree([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveCookiePartitionFree"]);
- if (timeToLiveCookiePartitionFree > 0_s && timeToLiveCookiePartitionFree <= 24_h)
+ if (timeToLiveCookiePartitionFree >= 0_s && timeToLiveCookiePartitionFree <= 24_h)
setTimeToLiveCookiePartitionFree(timeToLiveCookiePartitionFree);
Seconds minimumTimeBetweenDataRecordsRemoval([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval"]);
- if (minimumTimeBetweenDataRecordsRemoval > 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
+ if (minimumTimeBetweenDataRecordsRemoval >= 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
setMinimumTimeBetweenDataRecordsRemoval(minimumTimeBetweenDataRecordsRemoval);
Seconds grandfatheringTime([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsGrandfatheringTime"]);
- if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7)
+ if (grandfatheringTime >= 0_s && grandfatheringTime <= 24_h * 7)
setGrandfatheringTime(grandfatheringTime);
setDebugLogggingEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ResourceLoadStatisticsDebugLoggingEnabled"]);
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (229426 => 229427)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-03-08 20:43:34 UTC (rev 229426)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-03-08 21:11:50 UTC (rev 229427)
@@ -443,10 +443,10 @@
void WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode(bool enable)
{
- if (enable)
- setTimeToLiveCookiePartitionFree(30_s);
- else
- resetParametersToDefaultValues();
+ m_debugModeEnabled = enable;
+#if !RELEASE_LOG_DISABLED
+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "ITP Debug Mode %{public}s.", (m_debugModeEnabled ? "enabled" : "disabled"));
+#endif
}
void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url)
@@ -459,8 +459,12 @@
statistics.hadUserInteraction = true;
statistics.mostRecentUserInteractionTime = WallTime::now();
- if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking)
- updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { });
+ if (m_debugModeEnabled) {
+ if (statistics.isMarkedForCookieBlocking)
+ updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { });
+ } else
+ if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking)
+ updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { });
});
}
@@ -955,6 +959,9 @@
bool WebResourceLoadStatisticsStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) const
{
+ if (m_debugModeEnabled)
+ return statistic.isPrevalentResource && statistic.hadUserInteraction;
+
return statistic.isPrevalentResource && statistic.hadUserInteraction && WallTime::now() > statistic.mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree;
}
@@ -1003,7 +1010,6 @@
isFirstDomain = false;
}
RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %{public}s.", domainsToPartitionBuilder.toString().utf8().data());
- RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %s.", domainsToPartitionBuilder.toString().utf8().data());
}
if (!domainsToBlock.isEmpty()) {
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (229426 => 229427)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-03-08 20:43:34 UTC (rev 229426)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-03-08 21:11:50 UTC (rev 229427)
@@ -224,6 +224,7 @@
#endif
bool m_dataRecordsBeingRemoved { false };
+ bool m_debugModeEnabled { false };
bool m_debugLoggingEnabled { false };
Function<void (const String&)> m_statisticsTestingCallback;