Changeset 243181 in webkit
- Timestamp:
- Mar 19, 2019, 5:22:09 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 34 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt (added)
-
LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/RuntimeEnabledFeatures.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (modified) (7 diffs)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (modified) (6 diffs)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp (modified) (9 diffs)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkProcess.cpp (modified) (10 diffs)
-
Source/WebKit/NetworkProcess/NetworkProcess.h (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/NetworkProcess.messages.in (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkSession.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkSession.h (modified) (1 diff)
-
Source/WebKit/Shared/WebPreferences.yaml (modified) (1 diff)
-
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (2 diffs)
-
Tools/WebKitTestRunner/TestController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestInvocation.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243175 r243181 1 2019-03-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource 4 https://bugs.webkit.org/show_bug.cgi?id=195923 5 <rdar://problem/49001272> 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt: Added. 10 * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html: Added. 11 1 12 2019-03-19 Ryosuke Niwa <rniwa@webkit.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r243175 r243181 1 2019-03-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource 4 https://bugs.webkit.org/show_bug.cgi?id=195923 5 <rdar://problem/49001272> 6 7 Reviewed by Alex Christensen. 8 9 Adds a new experimental feature. 10 11 Test: http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html 12 13 * page/RuntimeEnabledFeatures.h: 14 (WebCore::RuntimeEnabledFeatures::setIsITPFirstPartyWebsiteDataRemovalEnabled): 15 (WebCore::RuntimeEnabledFeatures::isITPFirstPartyWebsiteDataRemovalEnabled const): 16 1 17 2019-03-19 Ryosuke Niwa <rniwa@webkit.org> 2 18 -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r242738 r243181 151 151 void setIsITPDatabaseEnabled(bool isEnabled) { m_isITPDatabaseEnabled = isEnabled; } 152 152 bool isITPDatabaseEnabled() const { return m_isITPDatabaseEnabled; } 153 154 void setIsITPFirstPartyWebsiteDataRemovalEnabled(bool isEnabled) { m_isITPFirstPartyWebsiteDataRemovalEnabled = isEnabled; } 155 bool isITPFirstPartyWebsiteDataRemovalEnabled() const { return m_isITPFirstPartyWebsiteDataRemovalEnabled; } 153 156 154 157 void setRestrictedHTTPResponseAccess(bool isEnabled) { m_isRestrictedHTTPResponseAccess = isEnabled; } … … 538 541 539 542 bool m_isITPDatabaseEnabled { false }; 543 bool m_isITPFirstPartyWebsiteDataRemovalEnabled { false }; 540 544 541 545 bool m_referrerPolicyAttributeEnabled { false }; -
trunk/Source/WebKit/ChangeLog
r243178 r243181 1 2019-03-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource 4 https://bugs.webkit.org/show_bug.cgi?id=195923 5 <rdar://problem/49001272> 6 7 Reviewed by Alex Christensen. 8 9 Cross-site trackers abuse link query parameters to transport user identifiers and then store 10 them in first-party storage space. To address this, we've done three things: 11 - r236448 capped all persistent client-side cookies to seven days of storage. 12 - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources. 13 - r242603 added logging of navigations with link decoration from prevalent resources. 14 15 This patch introduces an experimental feature that removes non-cookie website data for sites 16 that have been navigated to, with link decoration, by a prevalent resource. 17 18 To achieve this, resource domains to remove website data for are now marked with an enum called 19 WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are 20 iterated, they are marked for either of these values and the new function 21 ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with 22 WebsiteDataToRemove::AllButCookies. 23 24 Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes 25 website data accordingly. 26 27 The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of 28 script writable cookies, and this patch takes care of all other script writable storage. 29 30 The infrastructure to handle user interaction expiration is now parameterized so that multiple 31 expiries can be applied. In this particular case, seven days of browser use. 32 33 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 34 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): 35 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): 36 (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction): 37 (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const): 38 (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const): 39 (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor): 40 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 41 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 42 (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction): 43 (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const): 44 (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const): 45 (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const): 46 (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): 47 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 48 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: 49 (WebKit::domainsToString): 50 (WebKit::ResourceLoadStatisticsStore::removeDataRecords): 51 (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const): 52 (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates): 53 (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary): 54 (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): 55 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 56 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 57 (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): 58 (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains): 59 (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted. 60 Renamed to reflect that it actually takes a parameter for which types of data to remove. 61 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 62 * NetworkProcess/NetworkProcess.cpp: 63 (WebKit::NetworkProcess::initializeNetworkProcess): 64 (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting): 65 (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): 66 (WebKit::NetworkProcess::deleteCookiesForTesting): 67 (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted. 68 Renamed to reflect that it actually takes a parameter for which types of data to remove. 69 * NetworkProcess/NetworkProcess.h: 70 * NetworkProcess/NetworkProcess.messages.in: 71 * NetworkProcess/NetworkProcessCreationParameters.cpp: 72 (WebKit::NetworkProcessCreationParameters::encode const): 73 (WebKit::NetworkProcessCreationParameters::decode): 74 * NetworkProcess/NetworkProcessCreationParameters.h: 75 * NetworkProcess/NetworkSession.cpp: 76 (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains): 77 (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted. 78 Renamed to reflect that it actually takes a parameter for which types of data to remove. 79 * NetworkProcess/NetworkSession.h: 80 * Shared/WebPreferences.yaml: 81 * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: 82 (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration): 83 (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction): 84 (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords): 85 * UIProcess/API/C/WKWebsiteDataStoreRef.h: 86 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 87 (WebKit::WebProcessPool::platformInitializeNetworkProcess): 88 * UIProcess/Network/NetworkProcessProxy.cpp: 89 (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting): 90 * UIProcess/Network/NetworkProcessProxy.h: 91 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 92 (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting): 93 * UIProcess/WebsiteData/WebsiteDataStore.h: 94 1 95 2019-03-19 Chris Dumez <cdumez@apple.com> 2 96 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r242764 r243181 820 820 auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 821 821 ASSERT(subFrameStatus.first == AddedRecord::No); 822 ASSERT(hasHadUserInteraction(subFrameDomain ));822 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 823 823 insertDomainRelationship(m_storageAccessUnderTopFrameDomainsStatement, subFrameStatus.second, topFrameDomain); 824 824 } … … 840 840 auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 841 841 ASSERT(subFrameStatus.first == AddedRecord::No); 842 ASSERT(hasHadUserInteraction(subFrameDomain ));842 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 843 843 ASSERT(hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain)); 844 844 #endif … … 1034 1034 } 1035 1035 1036 bool ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction(const RegistrableDomain& domain )1036 bool ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction(const RegistrableDomain& domain, OperatingDatesWindow operatingDatesWindow) 1037 1037 { 1038 1038 ASSERT(!RunLoop::isMain()); … … 1051 1051 WallTime mostRecentUserInteractionTime = WallTime::fromRawSeconds(m_hadUserInteractionStatement.getColumnDouble(1)); 1052 1052 1053 if (hasStatisticsExpired(mostRecentUserInteractionTime )) {1053 if (hasStatisticsExpired(mostRecentUserInteractionTime, operatingDatesWindow)) { 1054 1054 // Drop privacy sensitive data because we no longer need it. 1055 1055 // Set timestamp to 0 so that statistics merge will know … … 1493 1493 } 1494 1494 1495 Vector<RegistrableDomain> ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor() 1495 bool ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor(const PrevalentDomainData& resourceStatistic, bool shouldCheckForGrandfathering) const 1496 { 1497 return !resourceStatistic.hadUserInteraction && (!shouldCheckForGrandfathering || !resourceStatistic.grandfathered); 1498 } 1499 1500 bool ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor(const PrevalentDomainData& resourceStatistic, bool shouldCheckForGrandfathering) const 1501 { 1502 UNUSED_PARAM(resourceStatistic); 1503 UNUSED_PARAM(shouldCheckForGrandfathering); 1504 return false; 1505 } 1506 1507 HashMap<RegistrableDomain, WebsiteDataToRemove> ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor() 1496 1508 { 1497 1509 ASSERT(!RunLoop::isMain()); … … 1505 1517 clearExpiredUserInteractions(); 1506 1518 1507 Vector<RegistrableDomain> prevalentResources;1519 HashMap<RegistrableDomain, WebsiteDataToRemove> domainsToRemoveWebsiteDataFor; 1508 1520 1509 1521 Vector<PrevalentDomainData> prevalentDomains = this->prevalentDomains(); 1510 1522 Vector<unsigned> domainIDsToClearGrandfathering; 1511 1523 for (auto& statistic : prevalentDomains) { 1512 if (!statistic.hadUserInteraction && (!shouldCheckForGrandfathering || !statistic.grandfathered)) 1513 prevalentResources.append(statistic.registerableDomain); 1524 if (shouldRemoveAllWebsiteDataFor(statistic, shouldCheckForGrandfathering)) 1525 domainsToRemoveWebsiteDataFor.add(statistic.registerableDomain, WebsiteDataToRemove::All); 1526 else if (shouldRemoveAllButCookiesFor(statistic, shouldCheckForGrandfathering)) 1527 domainsToRemoveWebsiteDataFor.add(statistic.registerableDomain, WebsiteDataToRemove::AllButCookies); 1514 1528 1515 1529 if (shouldClearGrandfathering && statistic.grandfathered) … … 1519 1533 clearGrandfathering(WTFMove(domainIDsToClearGrandfathering)); 1520 1534 1521 return prevalentResources;1535 return domainsToRemoveWebsiteDataFor; 1522 1536 } 1523 1537 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r242738 r243181 102 102 103 103 void clearUserInteraction(const RegistrableDomain&) override; 104 bool hasHadUserInteraction(const RegistrableDomain& ) override;104 bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) override; 105 105 106 106 void setLastSeen(const RegistrableDomain&, Seconds) override; … … 159 159 enum class AddedRecord { No, Yes }; 160 160 std::pair<AddedRecord, unsigned> ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain&); 161 Vector<RegistrableDomain> registrableDomainsToRemoveWebsiteDataFor() override; 161 bool shouldRemoveAllWebsiteDataFor(const PrevalentDomainData&, bool shouldCheckForGrandfathering) const; 162 bool shouldRemoveAllButCookiesFor(const PrevalentDomainData&, bool shouldCheckForGrandfathering) const; 163 HashMap<RegistrableDomain, WebsiteDataToRemove> registrableDomainsToRemoveWebsiteDataFor() override; 162 164 bool isDatabaseStore() const final { return true; } 163 165 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r242764 r243181 41 41 #include <WebCore/NetworkStorageSession.h> 42 42 #include <WebCore/ResourceLoadStatistics.h> 43 #include <WebCore/RuntimeEnabledFeatures.h> 43 44 #include <wtf/CallbackAggregator.h> 44 45 #include <wtf/DateMath.h> … … 445 446 } 446 447 447 bool ResourceLoadStatisticsMemoryStore::hasHadUserInteraction(const RegistrableDomain& domain )448 bool ResourceLoadStatisticsMemoryStore::hasHadUserInteraction(const RegistrableDomain& domain, OperatingDatesWindow operatingDatesWindow) 448 449 { 449 450 ASSERT(!RunLoop::isMain()); 450 451 451 452 auto mapEntry = m_resourceStatisticsMap.find(domain); 452 return mapEntry == m_resourceStatisticsMap.end() ? false: hasHadUnexpiredRecentUserInteraction(mapEntry->value );453 return mapEntry == m_resourceStatisticsMap.end() ? false: hasHadUnexpiredRecentUserInteraction(mapEntry->value, operatingDatesWindow); 453 454 } 454 455 … … 786 787 } 787 788 788 bool ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics& resourceStatistic ) const789 { 790 ASSERT(!RunLoop::isMain()); 791 792 if (resourceStatistic.hadUserInteraction && hasStatisticsExpired(resourceStatistic )) {789 bool ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics& resourceStatistic, OperatingDatesWindow operatingDatesWindow) const 790 { 791 ASSERT(!RunLoop::isMain()); 792 793 if (resourceStatistic.hadUserInteraction && hasStatisticsExpired(resourceStatistic, operatingDatesWindow)) { 793 794 // Drop privacy sensitive data because we no longer need it. 794 795 // Set timestamp to 0 so that statistics merge will know … … 802 803 } 803 804 804 Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor() 805 bool ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor(ResourceLoadStatistics& resourceStatistic, bool shouldCheckForGrandfathering) const 806 { 807 return resourceStatistic.isPrevalentResource && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Long) && (!shouldCheckForGrandfathering || !resourceStatistic.grandfathered); 808 } 809 810 bool ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor(ResourceLoadStatistics& resourceStatistic, bool shouldCheckForGrandfathering) const 811 { 812 return RuntimeEnabledFeatures::sharedFeatures().isITPFirstPartyWebsiteDataRemovalEnabled() && resourceStatistic.gotLinkDecorationFromPrevalentResource && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Short) && (!shouldCheckForGrandfathering || !resourceStatistic.grandfathered); 813 } 814 815 HashMap<RegistrableDomain, WebsiteDataToRemove> ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor() 805 816 { 806 817 ASSERT(!RunLoop::isMain()); … … 812 823 clearEndOfGrandfatheringTimeStamp(); 813 824 814 Vector<RegistrableDomain> prevalentResources;825 HashMap<RegistrableDomain, WebsiteDataToRemove> domainsToRemoveWebsiteDataFor; 815 826 for (auto& statistic : m_resourceStatisticsMap.values()) { 816 if (statistic.isPrevalentResource && !hasHadUnexpiredRecentUserInteraction(statistic) && (!shouldCheckForGrandfathering || !statistic.grandfathered)) 817 prevalentResources.append(statistic.registrableDomain); 827 if (shouldRemoveAllWebsiteDataFor(statistic, shouldCheckForGrandfathering)) 828 domainsToRemoveWebsiteDataFor.add(statistic.registrableDomain, WebsiteDataToRemove::All); 829 else if (shouldRemoveAllButCookiesFor(statistic, shouldCheckForGrandfathering)) { 830 domainsToRemoveWebsiteDataFor.add(statistic.registrableDomain, WebsiteDataToRemove::AllButCookies); 831 statistic.gotLinkDecorationFromPrevalentResource = false; 832 } 818 833 819 834 if (shouldClearGrandfathering && statistic.grandfathered) … … 821 836 } 822 837 823 return prevalentResources;838 return domainsToRemoveWebsiteDataFor; 824 839 } 825 840 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
r242738 r243181 107 107 108 108 void clearUserInteraction(const RegistrableDomain&) override; 109 bool hasHadUserInteraction(const RegistrableDomain& ) override;109 bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) override; 110 110 111 111 void setLastSeen(const RegistrableDomain&, Seconds) override; … … 115 115 static bool shouldBlockAndPurgeCookies(const ResourceLoadStatistics&); 116 116 static bool hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&); 117 bool hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics&) const; 117 bool hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics&, OperatingDatesWindow) const; 118 bool shouldRemoveAllWebsiteDataFor(ResourceLoadStatistics&, bool shouldCheckForGrandfathering) const; 119 bool shouldRemoveAllButCookiesFor(ResourceLoadStatistics&, bool shouldCheckForGrandfathering) const; 118 120 bool wasAccessedAsFirstPartyDueToUserInteraction(const ResourceLoadStatistics& current, const ResourceLoadStatistics& updated) const; 119 121 void incrementRecordsDeletedCountForDomains(HashSet<RegistrableDomain>&&) override; … … 127 129 void pruneStatisticsIfNeeded() override; 128 130 ResourceLoadStatistics& ensureResourceStatisticsForRegistrableDomain(const RegistrableDomain&); 129 Vector<RegistrableDomain> registrableDomainsToRemoveWebsiteDataFor() override;131 HashMap<RegistrableDomain, WebsiteDataToRemove> registrableDomainsToRemoveWebsiteDataFor() override; 130 132 bool isMemoryStore() const final { return true; } 131 132 133 133 134 WeakPtr<ResourceLoadStatisticsPersistentStorage> m_persistentStorage; -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp
r242712 r243181 51 51 52 52 constexpr Seconds minimumStatisticsProcessingInterval { 5_s }; 53 constexpr unsigned operatingDatesWindow { 30 }; 53 constexpr unsigned operatingDatesWindowLong { 30 }; 54 constexpr unsigned operatingDatesWindowShort { 7 }; 54 55 55 56 #if !RELEASE_LOG_DISABLED … … 61 62 builder.appendLiteral(", "); 62 63 builder.append(domain.string()); 64 } 65 return builder.toString(); 66 } 67 68 static String domainsToString(const HashMap<RegistrableDomain, WebsiteDataToRemove>& domainsToRemoveWebsiteDataFor) 69 { 70 StringBuilder builder; 71 for (auto& domain : domainsToRemoveWebsiteDataFor.keys()) { 72 if (!builder.isEmpty()) 73 builder.appendLiteral(", "); 74 builder.append(domain.string()); 75 switch (domainsToRemoveWebsiteDataFor.get(domain)) { 76 case WebsiteDataToRemove::All: 77 builder.appendLiteral("(all data)"); 78 break; 79 case WebsiteDataToRemove::AllButHttpOnlyCookies: 80 builder.appendLiteral("(all but HttpOnly cookies)"); 81 break; 82 case WebsiteDataToRemove::AllButCookies: 83 builder.appendLiteral("(all but cookies)"); 84 break; 85 } 63 86 } 64 87 return builder.toString(); … … 158 181 } 159 182 160 void ResourceLoadStatisticsStore::removeDataRecords(CompletionHandler<void()>&& c allback)183 void ResourceLoadStatisticsStore::removeDataRecords(CompletionHandler<void()>&& completionHandler) 161 184 { 162 185 ASSERT(!RunLoop::isMain()); 163 186 164 187 if (!shouldRemoveDataRecords()) { 165 c allback();188 completionHandler(); 166 189 return; 167 190 } … … 173 196 #endif 174 197 175 auto prevalentResourceDomains= registrableDomainsToRemoveWebsiteDataFor();176 if ( prevalentResourceDomains.isEmpty()) {177 c allback();198 auto domainsToRemoveWebsiteDataFor = registrableDomainsToRemoveWebsiteDataFor(); 199 if (domainsToRemoveWebsiteDataFor.isEmpty()) { 200 completionHandler(); 178 201 return; 179 202 } 180 203 181 204 #if !RELEASE_LOG_DISABLED 182 RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "About to remove data records for %{public}s.", domainsToString( prevalentResourceDomains).utf8().data());205 RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "About to remove data records for %{public}s.", domainsToString(domainsToRemoveWebsiteDataFor).utf8().data()); 183 206 #endif 184 207 185 208 setDataRecordsBeingRemoved(true); 186 209 187 RunLoop::main().dispatch([ prevalentResourceDomains = crossThreadCopy(prevalentResourceDomains), callback = WTFMove(callback), weakThis = makeWeakPtr(*this), shouldNotifyPagesWhenDataRecordsWereScanned = m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, workQueue = m_workQueue.copyRef()] () mutable {210 RunLoop::main().dispatch([domainsToRemoveWebsiteDataFor = crossThreadCopy(domainsToRemoveWebsiteDataFor), completionHandler = WTFMove(completionHandler), weakThis = makeWeakPtr(*this), shouldNotifyPagesWhenDataRecordsWereScanned = m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, workQueue = m_workQueue.copyRef()] () mutable { 188 211 if (!weakThis) { 189 c allback();212 completionHandler(); 190 213 return; 191 214 } 192 215 193 weakThis->m_store.deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(WebResourceLoadStatisticsStore::monitoredDataTypes(), WTFMove(prevalentResourceDomains), shouldNotifyPagesWhenDataRecordsWereScanned, IncludeHttpOnlyCookies::Yes, [callback = WTFMove(callback), weakThis = WTFMove(weakThis), workQueue = workQueue.copyRef()](const HashSet<RegistrableDomain>& domainsWithDeletedWebsiteData) mutable {194 workQueue->dispatch([domainsWithDeletedWebsiteData = crossThreadCopy(domainsWithDeletedWebsiteData), c allback = WTFMove(callback), weakThis = WTFMove(weakThis)] () mutable {216 weakThis->m_store.deleteWebsiteDataForRegistrableDomains(WebResourceLoadStatisticsStore::monitoredDataTypes(), WTFMove(domainsToRemoveWebsiteDataFor), shouldNotifyPagesWhenDataRecordsWereScanned, [completionHandler = WTFMove(completionHandler), weakThis = WTFMove(weakThis), workQueue = workQueue.copyRef()](const HashSet<RegistrableDomain>& domainsWithDeletedWebsiteData) mutable { 217 workQueue->dispatch([domainsWithDeletedWebsiteData = crossThreadCopy(domainsWithDeletedWebsiteData), completionHandler = WTFMove(completionHandler), weakThis = WTFMove(weakThis)] () mutable { 195 218 if (!weakThis) { 196 c allback();219 completionHandler(); 197 220 return; 198 221 } 199 222 weakThis->incrementRecordsDeletedCountForDomains(WTFMove(domainsWithDeletedWebsiteData)); 200 223 weakThis->setDataRecordsBeingRemoved(false); 201 c allback();224 completionHandler(); 202 225 #if !RELEASE_LOG_DISABLED 203 226 RELEASE_LOG_INFO_IF(weakThis->m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done removing data records."); … … 431 454 return WallTime::now().secondsSinceEpoch() - m_parameters.timeToLiveUserInteraction.value(); 432 455 433 if (m_operatingDates.size() >= operatingDatesWindow )456 if (m_operatingDates.size() >= operatingDatesWindowLong) 434 457 return m_operatingDates.first().secondsSinceEpoch(); 435 458 … … 449 472 removeRepeatedElements(mergedDates); 450 473 451 // Drop old dates until the Vector size reaches operatingDatesWindow .452 while (mergedDates.size() > operatingDatesWindow )474 // Drop old dates until the Vector size reaches operatingDatesWindowLong. 475 while (mergedDates.size() > operatingDatesWindowLong) 453 476 mergedDates.remove(0); 454 477 … … 469 492 return; 470 493 471 while (m_operatingDates.size() >= operatingDatesWindow )494 while (m_operatingDates.size() >= operatingDatesWindowLong) 472 495 m_operatingDates.remove(0); 473 496 … … 475 498 } 476 499 477 bool ResourceLoadStatisticsStore::hasStatisticsExpired(WallTime mostRecentUserInteractionTime) const 478 { 479 ASSERT(!RunLoop::isMain()); 480 481 if (m_operatingDates.size() >= operatingDatesWindow) { 500 bool ResourceLoadStatisticsStore::hasStatisticsExpired(WallTime mostRecentUserInteractionTime, OperatingDatesWindow operatingDatesWindow) const 501 { 502 ASSERT(!RunLoop::isMain()); 503 504 unsigned operatingDatesWindowInDays = (operatingDatesWindow == OperatingDatesWindow::Long ? operatingDatesWindowLong : operatingDatesWindowShort); 505 if (m_operatingDates.size() >= operatingDatesWindowInDays) { 482 506 if (OperatingDate::fromWallTime(mostRecentUserInteractionTime) < m_operatingDates.first()) 483 507 return true; … … 493 517 } 494 518 495 bool ResourceLoadStatisticsStore::hasStatisticsExpired(const ResourceLoadStatistics& resourceStatistic ) const496 { 497 return hasStatisticsExpired(resourceStatistic.mostRecentUserInteractionTime );519 bool ResourceLoadStatisticsStore::hasStatisticsExpired(const ResourceLoadStatistics& resourceStatistic, OperatingDatesWindow operatingDatesWindow) const 520 { 521 return hasStatisticsExpired(resourceStatistic.mostRecentUserInteractionTime, operatingDatesWindow); 498 522 } 499 523 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
r242764 r243181 72 72 }; 73 73 74 enum class OperatingDatesWindow : bool { Long, Short }; 75 74 76 // This is always constructed / used / destroyed on the WebResourceLoadStatisticsStore's statistics queue. 75 77 class ResourceLoadStatisticsStore : public CanMakeWeakPtr<ResourceLoadStatisticsStore> { … … 169 171 170 172 virtual void clearUserInteraction(const RegistrableDomain&) = 0; 171 virtual bool hasHadUserInteraction(const RegistrableDomain& ) = 0;173 virtual bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) = 0; 172 174 173 175 virtual void setLastSeen(const RegistrableDomain& primaryDomain, Seconds) = 0; … … 189 191 ResourceLoadStatisticsStore(WebResourceLoadStatisticsStore&, WorkQueue&, ShouldIncludeLocalhost); 190 192 191 bool hasStatisticsExpired(const ResourceLoadStatistics& ) const;192 bool hasStatisticsExpired(WallTime mostRecentUserInteractionTime ) const;193 bool hasStatisticsExpired(const ResourceLoadStatistics&, OperatingDatesWindow) const; 194 bool hasStatisticsExpired(WallTime mostRecentUserInteractionTime, OperatingDatesWindow) const; 193 195 void scheduleStatisticsProcessingRequestIfNecessary(); 194 196 void mergeOperatingDates(Vector<OperatingDate>&&); 195 197 virtual Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode() = 0; 196 virtual Vector<RegistrableDomain> registrableDomainsToRemoveWebsiteDataFor() = 0;198 virtual HashMap<RegistrableDomain, WebsiteDataToRemove> registrableDomainsToRemoveWebsiteDataFor() = 0; 197 199 virtual void pruneStatisticsIfNeeded() = 0; 198 200 -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r242738 r243181 581 581 { 582 582 postTask([this, domain, completionHandler = WTFMove(completionHandler)]() mutable { 583 bool hadUserInteraction = m_statisticsStore ? m_statisticsStore->hasHadUserInteraction(domain ) : false;583 bool hadUserInteraction = m_statisticsStore ? m_statisticsStore->hasHadUserInteraction(domain, OperatingDatesWindow::Long) : false; 584 584 postTaskReply([hadUserInteraction, completionHandler = WTFMove(completionHandler)]() mutable { 585 585 completionHandler(hadUserInteraction); … … 1013 1013 } 1014 1014 1015 void WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, IncludeHttpOnlyCookies includeHttpOnlyCookies, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler)1015 void WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType> dataTypes, HashMap<RegistrableDomain, WebsiteDataToRemove>&& domainsToRemoveWebsiteDataFor, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler) 1016 1016 { 1017 1017 ASSERT(RunLoop::isMain()); 1018 1018 1019 1019 if (m_networkSession) { 1020 m_networkSession->deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(dataTypes, WTFMove(domains), shouldNotifyPage, includeHttpOnlyCookies, WTFMove(completionHandler));1020 m_networkSession->deleteWebsiteDataForRegistrableDomains(dataTypes, WTFMove(domainsToRemoveWebsiteDataFor), shouldNotifyPage, WTFMove(completionHandler)); 1021 1021 return; 1022 1022 } -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r242764 r243181 61 61 enum class ShouldIncludeLocalhost : bool { No, Yes }; 62 62 enum class EnableResourceLoadStatisticsDebugMode : bool { No, Yes }; 63 enum class WebsiteDataToRemove : uint8_t { 64 All, 65 AllButHttpOnlyCookies, 66 AllButCookies 67 }; 63 68 64 69 class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver { … … 108 113 void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&, CompletionHandler<void()>&&); 109 114 void clearUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&); 110 void deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<RegistrableDomain>&&, bool shouldNotifyPage, WebCore::IncludeHttpOnlyCookies, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&);115 void deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, HashMap<RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&); 111 116 void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&); 112 117 bool grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r243110 r243181 314 314 315 315 WebCore::RuntimeEnabledFeatures::sharedFeatures().setIsITPDatabaseEnabled(parameters.shouldEnableITPDatabase); 316 WebCore::RuntimeEnabledFeatures::sharedFeatures().setIsITPFirstPartyWebsiteDataRemovalEnabled(parameters.isITPFirstPartyWebsiteDataRemovalEnabled); 316 317 317 318 SandboxExtension::consumePermanently(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle); … … 1210 1211 ASSERT_NOT_REACHED(); 1211 1212 1213 if (auto* networkSession = this->networkSession(sessionID)) { 1214 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) 1215 resourceLoadStatistics->logCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, WTFMove(completionHandler)); 1216 else 1217 completionHandler(); 1218 } else { 1219 ASSERT_NOT_REACHED(); 1220 completionHandler(); 1221 } 1222 } 1223 1224 void NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&& completionHandler) 1225 { 1212 1226 if (auto* networkSession = this->networkSession(sessionID)) { 1213 1227 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) … … 1511 1525 } 1512 1526 1513 void NetworkProcess::deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, IncludeHttpOnlyCookies includeHttpOnlyCookies, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler)1527 void NetworkProcess::deleteWebsiteDataForRegistrableDomains(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, HashMap<RegistrableDomain, WebsiteDataToRemove>&& domains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler) 1514 1528 { 1515 1529 OptionSet<WebsiteDataFetchOption> fetchOptions = WebsiteDataFetchOption::DoNotCreateProcesses; … … 1553 1567 auto& websiteDataStore = callbackAggregator->m_websiteData; 1554 1568 1569 Vector<RegistrableDomain> domainsToDeleteCookiesFor; 1570 Vector<RegistrableDomain> domainsToDeleteAllButHttpOnlyCookiesFor; 1571 Vector<RegistrableDomain> domainsToDeleteAllButCookiesFor; 1555 1572 Vector<String> hostnamesWithCookiesToDelete; 1556 1573 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { 1574 for (auto& domain : domains.keys()) { 1575 domainsToDeleteAllButCookiesFor.append(domain); 1576 switch (domains.get(domain)) { 1577 case WebsiteDataToRemove::All: 1578 domainsToDeleteCookiesFor.append(domain); 1579 break; 1580 case WebsiteDataToRemove::AllButHttpOnlyCookies: 1581 domainsToDeleteAllButHttpOnlyCookiesFor.append(domain); 1582 break; 1583 case WebsiteDataToRemove::AllButCookies: 1584 // Already added. 1585 break; 1586 } 1587 } 1557 1588 if (auto* networkStorageSession = storageSession(sessionID)) { 1558 1589 networkStorageSession->getHostnamesWithCookies(websiteDataStore.hostNamesWithCookies); 1559 hostnamesWithCookiesToDelete = filterForRegistrableDomains(domains, websiteDataStore.hostNamesWithCookies); 1560 networkStorageSession->deleteCookiesForHostnames(hostnamesWithCookiesToDelete, includeHttpOnlyCookies); 1590 1591 hostnamesWithCookiesToDelete = filterForRegistrableDomains(domainsToDeleteCookiesFor, websiteDataStore.hostNamesWithCookies); 1592 networkStorageSession->deleteCookiesForHostnames(hostnamesWithCookiesToDelete, WebCore::IncludeHttpOnlyCookies::Yes); 1593 1594 hostnamesWithCookiesToDelete = filterForRegistrableDomains(domainsToDeleteAllButHttpOnlyCookiesFor, websiteDataStore.hostNamesWithCookies); 1595 networkStorageSession->deleteCookiesForHostnames(hostnamesWithCookiesToDelete, WebCore::IncludeHttpOnlyCookies::No); 1561 1596 } 1597 } else { 1598 for (auto& domain : domains.keys()) 1599 domainsToDeleteAllButCookiesFor.append(domain); 1562 1600 } 1563 1601 … … 1567 1605 if (auto* networkStorageSession = storageSession(sessionID)) { 1568 1606 getHostNamesWithHSTSCache(*networkStorageSession, websiteDataStore.hostNamesWithHSTSCache); 1569 hostnamesWithHSTSToDelete = filterForRegistrableDomains(domains , websiteDataStore.hostNamesWithHSTSCache);1607 hostnamesWithHSTSToDelete = filterForRegistrableDomains(domainsToDeleteAllButCookiesFor, websiteDataStore.hostNamesWithHSTSCache); 1570 1608 deleteHSTSCacheForHostNames(*networkStorageSession, hostnamesWithHSTSToDelete); 1571 1609 } … … 1582 1620 1583 1621 if (websiteDataTypes.contains(WebsiteDataType::DOMCache)) { 1584 CacheStorage::Engine::fetchEntries(*this, sessionID, fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes), [this, domains , sessionID, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {1622 CacheStorage::Engine::fetchEntries(*this, sessionID, fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes), [this, domainsToDeleteAllButCookiesFor, sessionID, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable { 1585 1623 1586 auto entriesToDelete = filterForRegistrableDomains(domains , entries);1624 auto entriesToDelete = filterForRegistrableDomains(domainsToDeleteAllButCookiesFor, entries); 1587 1625 1588 1626 callbackAggregator->m_websiteData.entries.appendVector(entriesToDelete); … … 1597 1635 if (!path.isEmpty() && websiteDataTypes.contains(WebsiteDataType::IndexedDBDatabases)) { 1598 1636 // FIXME: Pick the right database store based on the session ID. 1599 postStorageTask(CrossThreadTask([this, sessionID, callbackAggregator = callbackAggregator.copyRef(), path = WTFMove(path), domains ]() mutable {1600 RunLoop::main().dispatch([this, sessionID, domains = crossThreadCopy(domains), callbackAggregator = callbackAggregator.copyRef(), securityOrigins = indexedDatabaseOrigins(path)] {1637 postStorageTask(CrossThreadTask([this, sessionID, callbackAggregator = callbackAggregator.copyRef(), path = WTFMove(path), domainsToDeleteAllButCookiesFor]() mutable { 1638 RunLoop::main().dispatch([this, sessionID, domainsToDeleteAllButCookiesFor = crossThreadCopy(domainsToDeleteAllButCookiesFor), callbackAggregator = callbackAggregator.copyRef(), securityOrigins = indexedDatabaseOrigins(path)] { 1601 1639 Vector<SecurityOriginData> entriesToDelete; 1602 1640 for (const auto& securityOrigin : securityOrigins) { 1603 if (!domains .contains(RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host)))1641 if (!domainsToDeleteAllButCookiesFor.contains(RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host))) 1604 1642 continue; 1605 1643 … … 1617 1655 path = m_swDatabasePaths.get(sessionID); 1618 1656 if (!path.isEmpty() && websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) { 1619 swServerForSession(sessionID).getOriginsWithRegistrations([this, sessionID, domains , callbackAggregator = callbackAggregator.copyRef()](const HashSet<SecurityOriginData>& securityOrigins) mutable {1657 swServerForSession(sessionID).getOriginsWithRegistrations([this, sessionID, domainsToDeleteAllButCookiesFor, callbackAggregator = callbackAggregator.copyRef()](const HashSet<SecurityOriginData>& securityOrigins) mutable { 1620 1658 for (auto& securityOrigin : securityOrigins) { 1621 if (!domains .contains(RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host)))1659 if (!domainsToDeleteAllButCookiesFor.contains(RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host))) 1622 1660 continue; 1623 1661 callbackAggregator->m_websiteData.entries.append({ securityOrigin, WebsiteDataType::ServiceWorkerRegistrations, 0 }); … … 1629 1667 1630 1668 if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) { 1631 fetchDiskCacheEntries(cache(), sessionID, fetchOptions, [this, domains , callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable {1669 fetchDiskCacheEntries(cache(), sessionID, fetchOptions, [this, domainsToDeleteAllButCookiesFor, callbackAggregator = callbackAggregator.copyRef()](auto entries) mutable { 1632 1670 1633 1671 Vector<SecurityOriginData> entriesToDelete; 1634 1672 for (auto& entry : entries) { 1635 if (!domains .contains(RegistrableDomain::uncheckedCreateFromHost(entry.origin.host)))1673 if (!domainsToDeleteAllButCookiesFor.contains(RegistrableDomain::uncheckedCreateFromHost(entry.origin.host))) 1636 1674 continue; 1637 1675 entriesToDelete.append(entry.origin); … … 1646 1684 { 1647 1685 OptionSet<WebsiteDataType> cookieType = WebsiteDataType::Cookies; 1648 1649 deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores(sessionID, cookieType, { domain }, true, includeHttpOnlyCookies ? IncludeHttpOnlyCookies::Yes : IncludeHttpOnlyCookies::No, [completionHandler = WTFMove(completionHandler)] (const HashSet<RegistrableDomain>& domainsDeletedFor) mutable { 1686 HashMap<RegistrableDomain, WebsiteDataToRemove> toDeleteFor; 1687 toDeleteFor.add(domain, includeHttpOnlyCookies ? WebsiteDataToRemove::All : WebsiteDataToRemove::AllButHttpOnlyCookies); 1688 deleteWebsiteDataForRegistrableDomains(sessionID, cookieType, WTFMove(toDeleteFor), true, [completionHandler = WTFMove(completionHandler)] (const HashSet<RegistrableDomain>& domainsDeletedFor) mutable { 1650 1689 UNUSED_PARAM(domainsDeletedFor); 1651 1690 completionHandler(); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r243110 r243181 33 33 #include "NetworkHTTPSUpgradeChecker.h" 34 34 #include "SandboxExtension.h" 35 #include "WebResourceLoadStatisticsStore.h" 35 36 #include <WebCore/AdClickAttribution.h> 36 37 #include <WebCore/ClientOrigin.h> … … 206 207 void clearPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); 207 208 void clearUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); 208 void deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(PAL::SessionID, OptionSet<WebsiteDataType>, Vector<RegistrableDomain>&&, bool shouldNotifyPage, WebCore::IncludeHttpOnlyCookies, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&);209 void deleteWebsiteDataForRegistrableDomains(PAL::SessionID, OptionSet<WebsiteDataType>, HashMap<RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&); 209 210 void deleteCookiesForTesting(PAL::SessionID, RegistrableDomain, bool includeHttpOnlyCookies, CompletionHandler<void()>&&); 210 211 void dumpResourceLoadStatistics(PAL::SessionID, CompletionHandler<void(String)>&&); … … 259 260 void registrableDomainsWithWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&); 260 261 void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID, CompletionHandler<void()>&&); 262 void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&&); 261 263 void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&); 262 264 #endif -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r243110 r243181 137 137 ResetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID) -> () Async 138 138 CommittedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain, uint64_t pageID) -> () Async 139 SetCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain) -> () Async 139 140 ResetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID) -> () Async 140 141 DeleteCookiesForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain domain, bool includeHttpOnlyCookies) -> () Async -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
r243143 r243181 95 95 encoder << shouldEnableITPDatabase; 96 96 encoder << downloadMonitorSpeedMultiplier; 97 encoder << isITPFirstPartyWebsiteDataRemovalEnabled; 97 98 } 98 99 … … 225 226 return false; 226 227 result.downloadMonitorSpeedMultiplier = *downloadMonitorSpeedMultiplier; 227 228 229 if (!decoder.decode(result.isITPFirstPartyWebsiteDataRemovalEnabled)) 230 return false; 231 228 232 return true; 229 233 } -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
r243143 r243181 112 112 #endif 113 113 bool shouldEnableITPDatabase { false }; 114 bool isITPFirstPartyWebsiteDataRemovalEnabled { true }; 114 115 uint32_t downloadMonitorSpeedMultiplier { 1 }; 115 116 }; -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r242891 r243181 126 126 } 127 127 128 void NetworkSession::deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<RegistrableDomain>&& domains, bool shouldNotifyPage, IncludeHttpOnlyCookies includeHttpOnlyCookies, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler)128 void NetworkSession::deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType> dataTypes, HashMap<RegistrableDomain, WebsiteDataToRemove>&& domains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler) 129 129 { 130 m_networkProcess->deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(m_sessionID, dataTypes, WTFMove(domains), shouldNotifyPage, includeHttpOnlyCookies, WTFMove(completionHandler));130 m_networkProcess->deleteWebsiteDataForRegistrableDomains(m_sessionID, dataTypes, WTFMove(domains), shouldNotifyPage, WTFMove(completionHandler)); 131 131 } 132 132 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r242764 r243181 75 75 void setResourceLoadStatisticsEnabled(bool); 76 76 void notifyResourceLoadStatisticsProcessed(); 77 void deleteWebsiteDataForRegistrableDomains InAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<WebCore::RegistrableDomain>&&, bool shouldNotifyPage, WebCore::IncludeHttpOnlyCookies, CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&)>&&);77 void deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, HashMap<WebCore::RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&)>&&); 78 78 void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<WebCore::RegistrableDomain>&&)>&&); 79 79 void logDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned significantFigures, WebCore::ShouldSample); -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r243046 r243181 1382 1382 category: experimental 1383 1383 1384 IsITPFirstPartyWebsiteDataRemovalEnabled: 1385 type: bool 1386 defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED 1387 humanReadableName: "ITP First Party Website Data Removal" 1388 humanReadableDescription: "Enable Intelligent Tracking Prevention First Party Website Data Removal" 1389 webcoreBinding: RuntimeEnabledFeatures 1390 category: experimental 1391 1384 1392 # For internal features: 1385 1393 # The type should be boolean. -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
r242712 r243181 298 298 } 299 299 300 void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStoreRef dataStoreRef, double seconds) 301 { 302 #if ENABLE(RESOURCE_LOAD_STATISTICS) 303 WebKit::toImpl(dataStoreRef)->websiteDataStore().setTimeToLiveUserInteraction(Seconds { seconds }, [] { }); 304 #endif 305 } 306 307 void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef) 308 { 309 #if ENABLE(RESOURCE_LOAD_STATISTICS) 310 WebKit::toImpl(dataStoreRef)->websiteDataStore().scheduleStatisticsAndDataRecordsProcessing([] { }); 300 void WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration(WKWebsiteDataStoreRef dataStoreRef, WKStringRef fromHost, WKStringRef toHost, void* context, WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecorationFunction callback) 301 { 302 #if ENABLE(RESOURCE_LOAD_STATISTICS) 303 WebKit::toImpl(dataStoreRef)->websiteDataStore().setCrossSiteLoadWithLinkDecorationForTesting(URL(URL(), WebKit::toImpl(fromHost)->string()), URL(URL(), WebKit::toImpl(toHost)->string()), [context, callback] { 304 callback(context); 305 }); 306 #else 307 callback(context); 308 #endif 309 } 310 311 void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStoreRef dataStoreRef, double seconds, void* context, WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteractionFunction callback) 312 { 313 #if ENABLE(RESOURCE_LOAD_STATISTICS) 314 WebKit::toImpl(dataStoreRef)->websiteDataStore().setTimeToLiveUserInteraction(Seconds { seconds }, [context, callback] { 315 callback(context); 316 }); 317 #else 318 callback(context); 319 #endif 320 } 321 322 void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecordsFunction callback) 323 { 324 #if ENABLE(RESOURCE_LOAD_STATISTICS) 325 WebKit::toImpl(dataStoreRef)->websiteDataStore().scheduleStatisticsAndDataRecordsProcessing([context, callback] { 326 callback(context); 327 }); 328 #else 329 callback(context); 311 330 #endif 312 331 } -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
r242712 r243181 74 74 WK_EXPORT void WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, WKStringRef hostRedirectedTo); 75 75 WK_EXPORT void WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, WKStringRef hostRedirectedFrom); 76 WK_EXPORT void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStoreRef dataStoreRef, double seconds); 77 WK_EXPORT void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef); 76 typedef void (*WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecorationFunction)(void* functionContext); 77 WK_EXPORT void WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration(WKWebsiteDataStoreRef dataStoreRef, WKStringRef fromHost, WKStringRef toHost, void* context, WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecorationFunction callback); 78 typedef void (*WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteractionFunction)(void* functionContext); 79 WK_EXPORT void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStoreRef dataStoreRef, double seconds, void* context, WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteractionFunction callback); 80 typedef void (*WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecordsFunction)(void* functionContext); 81 WK_EXPORT void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecordsFunction callback); 78 82 typedef void (*WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction)(void* functionContext); 79 83 WK_EXPORT void WKWebsiteDataStoreStatisticsUpdateCookieBlocking(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction completionHandler); -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r243143 r243181 308 308 parameters.shouldEnableITPDatabase = [defaults boolForKey:[NSString stringWithFormat:@"InternalDebug%@", WebPreferencesKey::isITPDatabaseEnabledKey().createCFString().get()]]; 309 309 parameters.downloadMonitorSpeedMultiplier = m_configuration->downloadMonitorSpeedMultiplier(); 310 311 // Check if the feature has been turned off explicitly. This avoids interpreting 312 // a non-existing default as a false value. 313 auto isITPFirstPartyWebsiteDataRemovalEnabledStr = [defaults stringForKey:[NSString stringWithFormat:@"Experimental%@", WebPreferencesKey::isITPFirstPartyWebsiteDataRemovalEnabledKey().createCFString().get()]]; 314 if ([isITPFirstPartyWebsiteDataRemovalEnabledStr isEqual:@"0"]) 315 parameters.isITPFirstPartyWebsiteDataRemovalEnabled = false; 310 316 } 311 317 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r243110 r243181 963 963 } 964 964 965 void NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&& completionHandler) 966 { 967 if (!canSendMessage()) { 968 completionHandler(); 969 return; 970 } 971 972 sendWithAsyncReply(Messages::NetworkProcess::SetCrossSiteLoadWithLinkDecorationForTesting(sessionID, fromDomain, toDomain), WTFMove(completionHandler)); 973 } 974 965 975 void NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) 966 976 { -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r243110 r243181 147 147 void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&); 148 148 void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const NavigatedFromDomain&, const NavigatedToDomain&, PageID, CompletionHandler<void()>&&); 149 void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const NavigatedFromDomain&, const NavigatedToDomain&, CompletionHandler<void()>&&); 149 150 void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&); 150 151 void deleteCookiesForTesting(PAL::SessionID, const RegistrableDomain&, bool includeHttpOnlyCookies, CompletionHandler<void()>&&); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r242738 r243181 1765 1765 } 1766 1766 1767 void WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting(const URL& fromURL, const URL& toURL, CompletionHandler<void()>&& completionHandler) 1768 { 1769 ASSERT(RunLoop::isMain()); 1770 1771 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1772 1773 for (auto& processPool : processPools()) { 1774 if (auto* process = processPool->networkProcess()) 1775 process->setCrossSiteLoadWithLinkDecorationForTesting(m_sessionID, RegistrableDomain { fromURL }, RegistrableDomain { toURL }, [processPool, callbackAggregator = callbackAggregator.copyRef()] { }); 1776 } 1777 } 1778 1767 1779 void WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&& completionHandler) 1768 1780 { -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r242738 r243181 169 169 void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&); 170 170 void setSubframeUnderTopFrameDomain(const URL& subframe, const URL& topFrame); 171 void setCrossSiteLoadWithLinkDecorationForTesting(const URL& fromURL, const URL& toURL, CompletionHandler<void()>&&); 171 172 void resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&&); 172 173 void deleteCookiesForTesting(const URL&, bool includeHttpOnlyCookies, CompletionHandler<void()>&&); -
trunk/Tools/ChangeLog
r243179 r243181 1 2019-03-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource 4 https://bugs.webkit.org/show_bug.cgi?id=195923 5 <rdar://problem/49001272> 6 7 Reviewed by Alex Christensen. 8 9 This patch does the following to the TestRunner: 10 - Adds setStatisticsCrossSiteLoadWithLinkDecoration(). 11 - Makes setStatisticsTimeToLiveUserInteraction() wait for completion. 12 - Makes statisticsProcessStatisticsAndDataRecords() wait for completion. 13 14 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 15 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 16 (WTR::TestRunner::setStatisticsCrossSiteLoadWithLinkDecoration): 17 * WebKitTestRunner/InjectedBundle/TestRunner.h: 18 * WebKitTestRunner/TestController.cpp: 19 (WTR::TestController::setStatisticsCrossSiteLoadWithLinkDecoration): 20 (WTR::TestController::setStatisticsTimeToLiveUserInteraction): 21 (WTR::TestController::statisticsProcessStatisticsAndDataRecords): 22 * WebKitTestRunner/TestController.h: 23 * WebKitTestRunner/TestInvocation.cpp: 24 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 25 1 26 2019-03-19 Christopher Reid <chris.reid@sony.com> 2 27 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r242727 r243181 304 304 void setStatisticsTopFrameUniqueRedirectTo(DOMString hostName, DOMString hostNameRedirectedTo); 305 305 void setStatisticsTopFrameUniqueRedirectFrom(DOMString hostName, DOMString hostNameRedirectedTo); 306 void setStatisticsCrossSiteLoadWithLinkDecoration(DOMString fromHost, DOMString toHost); 306 307 void setStatisticsTimeToLiveUserInteraction(double seconds); 307 308 void statisticsNotifyObserver(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r242727 r243181 1852 1852 } 1853 1853 1854 void TestRunner::setStatisticsCrossSiteLoadWithLinkDecoration(JSStringRef fromHost, JSStringRef toHost) 1855 { 1856 Vector<WKRetainPtr<WKStringRef>> keys; 1857 Vector<WKRetainPtr<WKTypeRef>> values; 1858 1859 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("FromHost") }); 1860 values.append({ AdoptWK, WKStringCreateWithJSString(fromHost) }); 1861 1862 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ToHost") }); 1863 values.append({ AdoptWK, WKStringCreateWithJSString(toHost) }); 1864 1865 Vector<WKStringRef> rawKeys(keys.size()); 1866 Vector<WKTypeRef> rawValues(values.size()); 1867 1868 for (size_t i = 0; i < keys.size(); ++i) { 1869 rawKeys[i] = keys[i].get(); 1870 rawValues[i] = values[i].get(); 1871 } 1872 1873 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsCrossSiteLoadWithLinkDecoration")); 1874 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1875 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1876 } 1854 1877 1855 1878 void TestRunner::setStatisticsTimeToLiveUserInteraction(double seconds) -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r242727 r243181 417 417 void setStatisticsTopFrameUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo); 418 418 void setStatisticsTopFrameUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom); 419 void setStatisticsCrossSiteLoadWithLinkDecoration(JSStringRef fromHost, JSStringRef toHost); 419 420 void setStatisticsTimeToLiveUserInteraction(double seconds); 420 421 void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r242727 r243181 3256 3256 } 3257 3257 3258 void TestController::setStatisticsCrossSiteLoadWithLinkDecoration(WKStringRef fromHost, WKStringRef toHost) 3259 { 3260 auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); 3261 ResourceStatisticsCallbackContext context(*this); 3262 WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration(dataStore, fromHost, toHost, &context, resourceStatisticsVoidResultCallback); 3263 runUntil(context.done, noTimeout); 3264 } 3265 3258 3266 void TestController::setStatisticsTimeToLiveUserInteraction(double seconds) 3259 3267 { 3260 3268 auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); 3261 WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(dataStore, seconds); 3269 ResourceStatisticsCallbackContext context(*this); 3270 WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(dataStore, seconds, &context, resourceStatisticsVoidResultCallback); 3271 runUntil(context.done, noTimeout); 3262 3272 } 3263 3273 … … 3265 3275 { 3266 3276 auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); 3267 WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(dataStore); 3277 ResourceStatisticsCallbackContext context(*this); 3278 WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(dataStore, &context, resourceStatisticsVoidResultCallback); 3279 runUntil(context.done, noTimeout); 3268 3280 } 3269 3281 -
trunk/Tools/WebKitTestRunner/TestController.h
r242727 r243181 226 226 void setStatisticsTopFrameUniqueRedirectTo(WKStringRef host, WKStringRef hostRedirectedTo); 227 227 void setStatisticsTopFrameUniqueRedirectFrom(WKStringRef host, WKStringRef hostRedirectedFrom); 228 void setStatisticsCrossSiteLoadWithLinkDecoration(WKStringRef fromHost, WKStringRef toHost); 228 229 void setStatisticsTimeToLiveUserInteraction(double seconds); 229 230 void statisticsProcessStatisticsAndDataRecords(); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r242727 r243181 1305 1305 } 1306 1306 1307 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsCrossSiteLoadWithLinkDecoration")) { 1308 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); 1309 1310 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); 1311 auto fromHostKey = adoptWK(WKStringCreateWithUTF8CString("FromHost")); 1312 auto toHostKey = adoptWK(WKStringCreateWithUTF8CString("ToHost")); 1313 1314 WKStringRef fromHost = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, fromHostKey.get())); 1315 WKStringRef toHost = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, toHostKey.get())); 1316 1317 TestController::singleton().setStatisticsCrossSiteLoadWithLinkDecoration(fromHost, toHost); 1318 return nullptr; 1319 } 1320 1307 1321 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsTimeToLiveUserInteraction")) { 1308 1322 ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID());
Note:
See TracChangeset
for help on using the changeset viewer.