Changeset 263258 in webkit
- Timestamp:
- Jun 19, 2020, 12:49:23 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkProcess.cpp (modified) (1 diff)
-
Source/WebKit/Shared/WebsiteData/WebsiteData.cpp (modified) (3 diffs)
-
Source/WebKit/Shared/WebsiteData/WebsiteData.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h (modified) (4 diffs)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r263251 r263258 1 2020-06-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Add support for fetching registrable domains with resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=213291 5 6 Reviewed by Adrian Perez de Castro and Youenn Fablet. 7 8 WebsiteDataStore::fetchData() doesn't return anything for resource load statistics because 9 NetworkProcess::fetchWebsiteData() doesn't handle WebsiteDataType::ResourceLoadStatistics. 10 11 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 12 (WebKit::ResourceLoadStatisticsDatabaseStore::allDomains const): Query all registrable domains from database. 13 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 14 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 15 (WebKit::ResourceLoadStatisticsMemoryStore::allDomains const): Return all registrable domains in memory map. 16 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 17 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 18 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 19 (WebKit::WebResourceLoadStatisticsStore::registrableDomains): Get the list of registrable domains. 20 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 21 * NetworkProcess/NetworkProcess.cpp: 22 (WebKit::NetworkProcess::fetchWebsiteData): Handle WebsiteDataType::ResourceLoadStatistics. 23 * Shared/WebsiteData/WebsiteData.cpp: 24 (WebKit::WebsiteData::encode const): Encode registrableDomainsWithResourceLoadStatistics. 25 (WebKit::WebsiteData::decode): Decode registrableDomainsWithResourceLoadStatistics. 26 * Shared/WebsiteData/WebsiteData.h: 27 * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: 28 (WKWebsiteDataStoreRemoveITPDataForDomain): Use WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain() 29 instead of the display name. 30 * UIProcess/WebsiteData/WebsiteDataRecord.cpp: 31 (WebKit::WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain): Add the given registrable domain to the list. 32 * UIProcess/WebsiteData/WebsiteDataRecord.h: 33 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 34 (WebKit::WebsiteDataStore::fetchDataAndApply): Handle registrable domains with resource load statistics. 35 (WebKit::WebsiteDataStore::removeData): Use resourceLoadStatisticsRegistrableDomains instead of the display name. 36 1 37 2020-06-18 David Kilzer <ddkilzer@apple.com> 2 38 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r262752 r263258 2262 2262 } 2263 2263 2264 Vector<RegistrableDomain> ResourceLoadStatisticsDatabaseStore::allDomains() const 2265 { 2266 ASSERT(!RunLoop::isMain()); 2267 2268 auto scopedStatement = this->scopedStatement(m_getAllDomainsStatement, getAllDomainsQuery, "allDomains"_s); 2269 if (!scopedStatement) 2270 return { }; 2271 2272 Vector<RegistrableDomain> domains; 2273 while (scopedStatement->step() == SQLITE_ROW) 2274 domains.append(RegistrableDomain::uncheckedCreateFromRegistrableDomainString(scopedStatement->getColumnText(0))); 2275 return domains; 2276 } 2277 2264 2278 void ResourceLoadStatisticsDatabaseStore::clear(CompletionHandler<void()>&& completionHandler) 2265 2279 { -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r262659 r263258 145 145 void setIsNewResourceLoadStatisticsDatabaseFile(bool isNewResourceLoadStatisticsDatabaseFile) { m_isNewResourceLoadStatisticsDatabaseFile = isNewResourceLoadStatisticsDatabaseFile; } 146 146 void removeDataForDomain(const RegistrableDomain&) override; 147 Vector<RegistrableDomain> allDomains() const final; 147 148 bool domainIDExistsInDatabase(int); 148 149 Optional<Vector<String>> checkForMissingTablesInSchema(); -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r262265 r263258 1071 1071 } 1072 1072 1073 Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::allDomains() const 1074 { 1075 ASSERT(!RunLoop::isMain()); 1076 1077 return copyToVector(m_resourceStatisticsMap.keys()); 1078 } 1079 1073 1080 void ResourceLoadStatisticsMemoryStore::setPrevalentResource(const RegistrableDomain& domain) 1074 1081 { -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
r262265 r263258 114 114 void setLastSeen(const RegistrableDomain&, Seconds) override; 115 115 void removeDataForDomain(const RegistrableDomain&) override; 116 Vector<RegistrableDomain> allDomains() const final; 116 117 void insertExpiredStatisticForTesting(const RegistrableDomain&, bool hasUserInteraction, bool isScheduledForAllButCookieDataRemoval, bool isPrevalent) override; 117 118 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
r262024 r263258 193 193 194 194 virtual void removeDataForDomain(const RegistrableDomain&) = 0; 195 195 196 virtual Vector<RegistrableDomain> allDomains() const = 0; 197 196 198 void didCreateNetworkProcess(); 197 199 -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r262846 r263258 1362 1362 } 1363 1363 1364 void WebResourceLoadStatisticsStore::registrableDomains(CompletionHandler<void(Vector<RegistrableDomain>&&)>&& completionHandler) 1365 { 1366 ASSERT(RunLoop::isMain()); 1367 postTask([this, completionHandler = WTFMove(completionHandler)]() mutable { 1368 auto domains = m_statisticsStore ? m_statisticsStore->allDomains() : Vector<RegistrableDomain>(); 1369 postTaskReply([domains = crossThreadCopy(WTFMove(domains)), completionHandler = WTFMove(completionHandler)]() mutable { 1370 completionHandler(WTFMove(domains)); 1371 }); 1372 }); 1373 } 1374 1364 1375 void WebResourceLoadStatisticsStore::deleteAndRestrictWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType> dataTypes, RegistrableDomainsToDeleteOrRestrictWebsiteDataFor&& domainsToDeleteAndRestrictWebsiteDataFor, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler) 1365 1376 { -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r262024 r263258 220 220 void removeDataForDomain(const RegistrableDomain, CompletionHandler<void()>&&); 221 221 void deleteAndRestrictWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, RegistrableDomainsToDeleteOrRestrictWebsiteDataFor&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&); 222 void registrableDomains(CompletionHandler<void(Vector<RegistrableDomain>&&)>&&); 222 223 void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&); 223 224 StorageAccessWasGranted grantStorageAccessInStorageSession(const SubFrameDomain&, const TopFrameDomain&, Optional<WebCore::FrameIdentifier>, WebCore::PageIdentifier, StorageAccessScope); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r263038 r263258 1579 1579 } 1580 1580 #endif 1581 1582 #if ENABLE(RESOURCE_LOAD_STATISTICS) 1583 if (websiteDataTypes.contains(WebsiteDataType::ResourceLoadStatistics)) { 1584 if (auto* session = networkSession(sessionID)) { 1585 if (auto* resourceLoadStatistics = session->resourceLoadStatistics()) { 1586 resourceLoadStatistics->registrableDomains([callbackAggregator = callbackAggregator.copyRef()](auto&& domains) mutable { 1587 while (!domains.isEmpty()) 1588 callbackAggregator->m_websiteData.registrableDomainsWithResourceLoadStatistics.add(domains.takeLast()); 1589 }); 1590 } 1591 } 1592 } 1593 #endif 1581 1594 } 1582 1595 -
trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp
r262994 r263258 29 29 #include "ArgumentCoders.h" 30 30 #include "WebsiteDataType.h" 31 #include <WebCore/RegistrableDomain.h> 31 32 #include <WebCore/SecurityOriginData.h> 32 33 #include <wtf/text/StringHash.h> … … 68 69 #endif 69 70 encoder << hostNamesWithHSTSCache; 71 #if ENABLE(RESOURCE_LOAD_STATISTICS) 72 encoder << registrableDomainsWithResourceLoadStatistics; 73 #endif 70 74 } 71 75 … … 82 86 if (!decoder.decode(result.hostNamesWithHSTSCache)) 83 87 return false; 88 #if ENABLE(RESOURCE_LOAD_STATISTICS) 89 if (!decoder.decode(result.registrableDomainsWithResourceLoadStatistics)) 90 return false; 91 #endif 84 92 return true; 85 93 } -
trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.h
r263208 r263258 26 26 #pragma once 27 27 28 #include <WebCore/RegistrableDomain.h> 28 29 #include <WebCore/SecurityOriginData.h> 29 30 #include <wtf/HashMap.h> … … 60 61 #endif 61 62 HashSet<String> hostNamesWithHSTSCache; 63 #if ENABLE(RESOURCE_LOAD_STATISTICS) 64 HashSet<WebCore::RegistrableDomain> registrableDomainsWithResourceLoadStatistics; 65 #endif 62 66 63 67 void encode(IPC::Encoder&) const; -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
r262971 r263258 73 73 WebKit::WebsiteDataRecord dataRecord; 74 74 dataRecord.types.add(WebKit::WebsiteDataType::ResourceLoadStatistics); 75 dataRecord. displayName = WebKit::toImpl(host)->string();75 dataRecord.addResourceLoadStatisticsRegistrableDomain(WebCore::RegistrableDomain::uncheckedCreateFromHost(WebKit::toImpl(host)->string())); 76 76 Vector<WebKit::WebsiteDataRecord> dataRecords = { WTFMove(dataRecord) }; 77 77 -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.cpp
r257785 r263258 29 29 #include <WebCore/LocalizedStrings.h> 30 30 #include <WebCore/PublicSuffix.h> 31 #include <WebCore/RegistrableDomain.h>32 31 #include <WebCore/SecurityOrigin.h> 33 32 … … 115 114 } 116 115 116 #if ENABLE(RESOURCE_LOAD_STATISTICS) 117 void WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain(const WebCore::RegistrableDomain& domain) 118 { 119 types.add(WebsiteDataType::ResourceLoadStatistics); 120 resourceLoadStatisticsRegistrableDomains.add(domain); 121 } 122 #endif 123 117 124 static inline bool hostIsInDomain(StringView host, StringView domain) 118 125 { -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.h
r257785 r263258 27 27 28 28 #include "WebsiteDataType.h" 29 #include <WebCore/RegistrableDomain.h> 29 30 #include <WebCore/SecurityOriginData.h> 30 31 #include <WebCore/SecurityOriginHash.h> … … 37 38 38 39 namespace WebCore { 39 class RegistrableDomain;40 40 class SecurityOrigin; 41 41 } … … 56 56 void addHSTSCacheHostname(const String& hostName); 57 57 void addAlternativeServicesHostname(const String& hostName); 58 #if ENABLE(RESOURCE_LOAD_STATISTICS) 59 void addResourceLoadStatisticsRegistrableDomain(const WebCore::RegistrableDomain&); 60 #endif 58 61 59 62 String displayName; … … 73 76 HashSet<String> HSTSCacheHostNames; 74 77 HashSet<String> alternativeServicesHostNames; 78 #if ENABLE(RESOURCE_LOAD_STATISTICS) 79 HashSet<WebCore::RegistrableDomain> resourceLoadStatisticsRegistrableDomains; 80 #endif 75 81 76 82 bool matches(const WebCore::RegistrableDomain&) const; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r262971 r263258 367 367 } 368 368 369 #if ENABLE(RESOURCE_LOAD_STATISTICS) 370 for (const auto& domain : websiteData.registrableDomainsWithResourceLoadStatistics) { 371 auto displayName = WebsiteDataRecord::displayNameForHostName(domain.string()); 372 if (!displayName) 373 continue; 374 375 auto& record = m_websiteDataRecords.add(displayName, WebsiteDataRecord { }).iterator->value; 376 if (!record.displayName) 377 record.displayName = WTFMove(displayName); 378 379 record.addResourceLoadStatisticsRegistrableDomain(domain); 380 } 381 #endif 382 369 383 callIfNeeded(); 370 384 } … … 997 1011 for (auto& hostName : dataRecord.HSTSCacheHostNames) 998 1012 HSTSCacheHostNames.append(hostName); 999 registrableDomains.append(WebCore::RegistrableDomain::uncheckedCreateFromHost(dataRecord.displayName)); 1013 for (auto& registrableDomain : dataRecord.resourceLoadStatisticsRegistrableDomains) 1014 registrableDomains.append(registrableDomain); 1000 1015 } 1001 1016 -
trunk/Tools/ChangeLog
r263257 r263258 1 2020-06-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Add support for fetching registrable domains with resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=213291 5 6 Reviewed by Adrian Perez de Castro. 7 8 Update GLib ITP unit test to check also fetch and remove. 9 10 * TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp: 11 (testWebsiteDataITP): 12 1 13 2020-06-19 Tomoki Imai <Tomoki.Imai@sony.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp
r263204 r263258 671 671 672 672 g_assert_false(webkit_website_data_manager_get_itp_enabled(test->m_manager)); 673 test->loadURI(kServer->getURIForPath("/ ").data());673 test->loadURI(kServer->getURIForPath("/empty").data()); 674 674 test->waitUntilLoadFinished(); 675 675 … … 679 679 g_assert_false(g_file_test(itpLogFile.get(), G_FILE_TEST_IS_REGULAR)); 680 680 681 test->loadURI(kServer->getURIForPath("/ ").data());681 test->loadURI(kServer->getURIForPath("/empty").data()); 682 682 test->waitUntilLoadFinished(); 683 683 684 684 test->waitUntilFileChanged(itpLogFile.get(), G_FILE_MONITOR_EVENT_CREATED); 685 686 685 g_assert_true(g_file_test(itpDirectory, G_FILE_TEST_IS_DIR)); 687 686 g_assert_true(g_file_test(itpLogFile.get(), G_FILE_TEST_IS_REGULAR)); 687 688 GList* dataList = test->fetch(WEBKIT_WEBSITE_DATA_ITP); 689 g_assert_nonnull(dataList); 690 g_assert_cmpuint(g_list_length(dataList), ==, 1); 691 auto* data = static_cast<WebKitWebsiteData*>(dataList->data); 692 g_assert_nonnull(data); 693 WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(kServer->getURIForPath("/").data()); 694 g_assert_cmpstr(webkit_website_data_get_name(data), ==, webkit_security_origin_get_host(origin)); 695 webkit_security_origin_unref(origin); 696 697 // Remove the registration. 698 GList removeList = { data, nullptr, nullptr }; 699 test->remove(WEBKIT_WEBSITE_DATA_ITP, &removeList); 700 dataList = test->fetch(WEBKIT_WEBSITE_DATA_ITP); 701 g_assert_null(dataList); 688 702 689 703 // Clear all.
Note:
See TracChangeset
for help on using the changeset viewer.