Title: [256090] trunk/Source/WebKit
- Revision
- 256090
- Author
- [email protected]
- Date
- 2020-02-08 07:48:54 -0800 (Sat, 08 Feb 2020)
Log Message
Resource Load Statistics: Hold off non-cookie website data deletion until an hour after user interaction
https://bugs.webkit.org/show_bug.cgi?id=207418
<rdar://problem/58550164>
Reviewed by Chris Dumez.
This change makes sure there is at least a one-hour or older timestamp
for user interaction for some website before activating deletion of
non-cookie website data for sites the user has not interacted with.
This ensures that a fresh start such as after a reset or on a new
device doesn't interpret the lack of data as lack of user interaction.
No new tests. Existing tests make sure we don't regress the functionality.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (256089 => 256090)
--- trunk/Source/WebKit/ChangeLog 2020-02-08 14:10:25 UTC (rev 256089)
+++ trunk/Source/WebKit/ChangeLog 2020-02-08 15:48:54 UTC (rev 256090)
@@ -1,3 +1,24 @@
+2020-02-08 John Wilander <[email protected]>
+
+ Resource Load Statistics: Hold off non-cookie website data deletion until an hour after user interaction
+ https://bugs.webkit.org/show_bug.cgi?id=207418
+ <rdar://problem/58550164>
+
+ Reviewed by Chris Dumez.
+
+ This change makes sure there is at least a one-hour or older timestamp
+ for user interaction for some website before activating deletion of
+ non-cookie website data for sites the user has not interacted with.
+ This ensures that a fresh start such as after a reset or on a new
+ device doesn't interpret the lack of data as lack of user interaction.
+
+ No new tests. Existing tests make sure we don't regress the functionality.
+
+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+ (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
+ * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+ (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
+
2020-02-07 Jon Lee <[email protected]>
Web Inspector: Revert slim toolbar
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (256089 => 256090)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2020-02-08 14:10:25 UTC (rev 256089)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2020-02-08 15:48:54 UTC (rev 256090)
@@ -2266,12 +2266,15 @@
clearEndOfGrandfatheringTimeStamp();
clearExpiredUserInteractions();
-
+
+ auto now = WallTime::now();
+ auto oldestUserInteraction = now;
Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> domainsToRemoveWebsiteDataFor;
Vector<DomainData> domains = this->domains();
Vector<unsigned> domainIDsToClearGrandfathering;
for (auto& statistic : domains) {
+ oldestUserInteraction = std::min(oldestUserInteraction, statistic.mostRecentUserInteractionTime);
if (shouldRemoveAllWebsiteDataFor(statistic, shouldCheckForGrandfathering))
domainsToRemoveWebsiteDataFor.append(std::make_pair(statistic.registrableDomain, WebsiteDataToRemove::All));
else if (shouldRemoveAllButCookiesFor(statistic, shouldCheckForGrandfathering)) {
@@ -2282,6 +2285,13 @@
domainIDsToClearGrandfathering.append(statistic.domainID);
}
+ // Give the user enough time to interact with websites until we remove non-cookie website data.
+ if (!parameters().isRunningTest && now - oldestUserInteraction > parameters().minimumTimeBetweenDataRecordsRemoval) {
+ domainsToRemoveWebsiteDataFor.removeAllMatching([&] (auto& pair) {
+ return pair.second == WebsiteDataToRemove::AllButCookies;
+ });
+ }
+
clearGrandfathering(WTFMove(domainIDsToClearGrandfathering));
return domainsToRemoveWebsiteDataFor;
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (256089 => 256090)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2020-02-08 14:10:25 UTC (rev 256089)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2020-02-08 15:48:54 UTC (rev 256090)
@@ -924,8 +924,11 @@
if (shouldClearGrandfathering)
clearEndOfGrandfatheringTimeStamp();
+ auto now = WallTime::now();
+ auto oldestUserInteraction = now;
Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> domainsToRemoveWebsiteDataFor;
for (auto& statistic : m_resourceStatisticsMap.values()) {
+ oldestUserInteraction = std::min(oldestUserInteraction, statistic.mostRecentUserInteractionTime);
if (shouldRemoveAllWebsiteDataFor(statistic, shouldCheckForGrandfathering))
domainsToRemoveWebsiteDataFor.append(std::make_pair(statistic.registrableDomain, WebsiteDataToRemove::All));
else if (shouldRemoveAllButCookiesFor(statistic, shouldCheckForGrandfathering)) {
@@ -937,6 +940,13 @@
statistic.grandfathered = false;
}
+ // Give the user enough time to interact with websites until we remove non-cookie website data.
+ if (!parameters().isRunningTest && now - oldestUserInteraction > parameters().minimumTimeBetweenDataRecordsRemoval) {
+ domainsToRemoveWebsiteDataFor.removeAllMatching([&] (auto& pair) {
+ return pair.second == WebsiteDataToRemove::AllButCookies;
+ });
+ }
+
return domainsToRemoveWebsiteDataFor;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes