Changeset 252641 in webkit
- Timestamp:
- Nov 19, 2019 12:35:21 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 18 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252633 r252641 1 2019-11-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Count third-party script loads under top frame 4 https://bugs.webkit.org/show_bug.cgi?id=204262 5 <rdar://problem/57244945> 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database-expected.txt: Added. 10 * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html: Added. 11 * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt: Added. 12 * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html: Added. 13 * http/tests/resourceLoadStatistics/count-third-party-script-loads-database-expected.txt: Added. 14 * http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html: Added. 15 * http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt: Added. 16 * http/tests/resourceLoadStatistics/count-third-party-script-loads.html: Added. 17 * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database-expected.txt: Added. 18 * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html: Added. 19 * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt: Added. 20 * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html: Added. 21 * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt: 22 Removed the lastSeen output since it may differ between test runs. 23 * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt: 24 Removed the lastSeen output since it may differ between test runs. 25 * http/tests/resourceLoadStatistics/resources/dummy.js: Added. 26 * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database-expected.txt: 27 Removed the lastSeen output since it may differ between test runs. 28 * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt: 29 Removed the lastSeen output since it may differ between test runs. 30 1 31 2019-11-19 Sihui Liu <sihui_liu@apple.com> 2 32 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database-expected.txt
r252640 r252641 1 Test logging of link decorated cross-site navigations from a prevalent resource. 1 PASS successfullyParsed is true 2 3 TEST COMPLETE 2 4 3 5 Resource load statistics: 4 6 5 Registrable domain: localhost 6 lastSeen: 0 7 Registrable domain: 127.0.0.1 7 8 hadUserInteraction: No 8 9 mostRecentUserInteraction: -1 9 10 grandfathered: No 10 topFrameLinkDecorationsFrom: 11 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: Yes isPrevalentResource: No 11 TopFrameLoadedThirdPartyScripts: 12 localhost 13 IsScheduledForAllButCookieDataRemoval: No 14 isPrevalentResource: No 13 15 isVeryPrevalentResource: No 14 16 dataRecordsRemoved: 0 15 Registrable domain: 127.0.0.1 16 lastSeen: 0 17 Registrable domain: localhost 17 18 hadUserInteraction: No 18 19 mostRecentUserInteraction: -1 19 20 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 21 IsScheduledForAllButCookieDataRemoval: No 22 SubresourceUnderTopFrameDomains: 23 127.0.0.1 24 isPrevalentResource: No 21 25 isVeryPrevalentResource: No 22 26 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt
r252640 r252641 1 Test logging of link decorated cross-site navigations from a prevalent resource. 1 PASS successfullyParsed is true 2 3 TEST COMPLETE 2 4 3 5 Resource load statistics: 4 6 5 7 Registrable domain: localhost 6 lastSeen: 07 8 hadUserInteraction: No 8 9 mostRecentUserInteraction: -1 9 10 grandfathered: No 10 topFrameLinkDecorationsFrom: 11 gotLinkDecorationFromPrevalentResource: No 12 subresourceUnderTopFrameDomains: 11 13 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: YesisPrevalentResource: No14 isPrevalentResource: No 13 15 isVeryPrevalentResource: No 14 16 dataRecordsRemoved: 0 15 17 Registrable domain: 127.0.0.1 16 lastSeen: 017 18 hadUserInteraction: No 18 19 mostRecentUserInteraction: -1 19 20 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 21 gotLinkDecorationFromPrevalentResource: No 22 topFrameLoadedThirdPartyScripts: 23 localhost 24 isPrevalentResource: No 21 25 isVeryPrevalentResource: No 22 26 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database-expected.txt
r252640 r252641 1 Test logging of link decorated cross-site navigations from a prevalent resource. 1 PASS successfullyParsed is true 2 3 TEST COMPLETE 2 4 3 5 Resource load statistics: 4 6 5 Registrable domain: localhost 6 lastSeen: 0 7 Registrable domain: 127.0.0.1 7 8 hadUserInteraction: No 8 9 mostRecentUserInteraction: -1 9 10 grandfathered: No 10 topFrameLinkDecorationsFrom: 11 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: Yes isPrevalentResource: No 11 TopFrameLoadedThirdPartyScripts: 12 localhost 13 IsScheduledForAllButCookieDataRemoval: No 14 isPrevalentResource: No 13 15 isVeryPrevalentResource: No 14 16 dataRecordsRemoved: 0 15 Registrable domain: 127.0.0.1 16 lastSeen: 0 17 Registrable domain: localhost 17 18 hadUserInteraction: No 18 19 mostRecentUserInteraction: -1 19 20 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 21 IsScheduledForAllButCookieDataRemoval: No 22 SubresourceUnderTopFrameDomains: 23 127.0.0.1 24 isPrevalentResource: No 21 25 isVeryPrevalentResource: No 22 26 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt
r252640 r252641 1 Test logging of link decorated cross-site navigations from a prevalent resource. 1 PASS successfullyParsed is true 2 3 TEST COMPLETE 2 4 3 5 Resource load statistics: 4 6 5 7 Registrable domain: localhost 6 lastSeen: 07 8 hadUserInteraction: No 8 9 mostRecentUserInteraction: -1 9 10 grandfathered: No 10 topFrameLinkDecorationsFrom: 11 gotLinkDecorationFromPrevalentResource: No 12 subresourceUnderTopFrameDomains: 11 13 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: YesisPrevalentResource: No14 isPrevalentResource: No 13 15 isVeryPrevalentResource: No 14 16 dataRecordsRemoved: 0 15 17 Registrable domain: 127.0.0.1 16 lastSeen: 017 18 hadUserInteraction: No 18 19 mostRecentUserInteraction: -1 19 20 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 21 gotLinkDecorationFromPrevalentResource: No 22 topFrameLoadedThirdPartyScripts: 23 localhost 24 isPrevalentResource: No 21 25 isVeryPrevalentResource: No 22 26 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database-expected.txt
r252640 r252641 1 Test logging of link decorated cross-site navigations from a prevalent resource. 1 PASS successfullyParsed is true 2 3 TEST COMPLETE 2 4 3 5 Resource load statistics: 4 6 5 Registrable domain: localhost 6 lastSeen: 0 7 Registrable domain: 127.0.0.1 7 8 hadUserInteraction: No 8 9 mostRecentUserInteraction: -1 9 10 grandfathered: No 10 topFrameLinkDecorationsFrom: 11 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: Yes isPrevalentResource: No 11 IsScheduledForAllButCookieDataRemoval: No 12 isPrevalentResource: No 13 13 isVeryPrevalentResource: No 14 14 dataRecordsRemoved: 0 15 Registrable domain: 127.0.0.1 16 lastSeen: 0 15 Registrable domain: localhost 17 16 hadUserInteraction: No 18 17 mostRecentUserInteraction: -1 19 18 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 19 IsScheduledForAllButCookieDataRemoval: No 20 SubresourceUnderTopFrameDomains: 21 127.0.0.1 22 isPrevalentResource: No 21 23 isVeryPrevalentResource: No 22 24 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt
r251501 r252641 4 4 5 5 Registrable domain: 127.0.0.1 6 lastSeen: 07 6 hadUserInteraction: No 8 7 mostRecentUserInteraction: -1 9 8 grandfathered: No 10 IsScheduledForAllButCookieDataRemoval: No isPrevalentResource: Yes 9 IsScheduledForAllButCookieDataRemoval: No 10 isPrevalentResource: Yes 11 11 isVeryPrevalentResource: No 12 12 dataRecordsRemoved: 0 13 13 Registrable domain: 127.0.0.2 14 lastSeen: 015 14 hadUserInteraction: No 16 15 mostRecentUserInteraction: -1 17 16 grandfathered: No 18 IsScheduledForAllButCookieDataRemoval: No isPrevalentResource: No 17 IsScheduledForAllButCookieDataRemoval: No 18 isPrevalentResource: No 19 19 isVeryPrevalentResource: No 20 20 dataRecordsRemoved: 0 21 21 Registrable domain: localhost 22 lastSeen: 023 22 hadUserInteraction: No 24 23 mostRecentUserInteraction: -1 … … 27 26 127.0.0.1 28 27 127.0.0.2 29 IsScheduledForAllButCookieDataRemoval: Yes isPrevalentResource: No 28 IsScheduledForAllButCookieDataRemoval: Yes 29 isPrevalentResource: No 30 30 isVeryPrevalentResource: No 31 31 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt
r242603 r252641 4 4 5 5 Registrable domain: localhost 6 lastSeen: 07 6 hadUserInteraction: No 8 7 mostRecentUserInteraction: -1 … … 10 9 topFrameLinkDecorationsFrom: 11 10 127.0.0.1 12 gotLinkDecorationFromPrevalentResource: Yes isPrevalentResource: No 11 gotLinkDecorationFromPrevalentResource: Yes 12 isPrevalentResource: No 13 13 isVeryPrevalentResource: No 14 14 dataRecordsRemoved: 0 15 15 Registrable domain: 127.0.0.1 16 lastSeen: 017 16 hadUserInteraction: No 18 17 mostRecentUserInteraction: -1 19 18 grandfathered: No 20 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 19 gotLinkDecorationFromPrevalentResource: No 20 isPrevalentResource: Yes 21 21 isVeryPrevalentResource: No 22 22 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database-expected.txt
r251501 r252641 17 17 18 18 Registrable domain: 127.0.0.1 19 lastSeen: 020 19 hadUserInteraction: No 21 20 mostRecentUserInteraction: -1 … … 23 22 TopFrameLinkDecorationsFrom: 24 23 localhost 25 IsScheduledForAllButCookieDataRemoval: No isPrevalentResource: No 24 IsScheduledForAllButCookieDataRemoval: No 25 isPrevalentResource: No 26 26 isVeryPrevalentResource: No 27 27 dataRecordsRemoved: 1 28 28 Registrable domain: localhost 29 lastSeen: 030 29 hadUserInteraction: No 31 30 mostRecentUserInteraction: -1 32 31 grandfathered: No 33 IsScheduledForAllButCookieDataRemoval: No isPrevalentResource: Yes 32 IsScheduledForAllButCookieDataRemoval: No 33 isPrevalentResource: Yes 34 34 isVeryPrevalentResource: No 35 35 dataRecordsRemoved: 0 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt
r243632 r252641 17 17 18 18 Registrable domain: localhost 19 lastSeen: 020 19 hadUserInteraction: No 21 20 mostRecentUserInteraction: -1 22 21 grandfathered: No 23 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: Yes 22 gotLinkDecorationFromPrevalentResource: No 23 isPrevalentResource: Yes 24 24 isVeryPrevalentResource: No 25 25 dataRecordsRemoved: 0 26 26 Registrable domain: 127.0.0.1 27 lastSeen: 028 27 hadUserInteraction: No 29 28 mostRecentUserInteraction: -1 … … 31 30 topFrameLinkDecorationsFrom: 32 31 localhost 33 gotLinkDecorationFromPrevalentResource: No isPrevalentResource: No 32 gotLinkDecorationFromPrevalentResource: No 33 isPrevalentResource: No 34 34 isVeryPrevalentResource: No 35 35 dataRecordsRemoved: 1 -
trunk/Source/WebCore/ChangeLog
r252640 r252641 1 2019-11-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Count third-party script loads under top frame 4 https://bugs.webkit.org/show_bug.cgi?id=204262 5 <rdar://problem/57244945> 6 7 Reviewed by Alex Christensen. 8 9 Third-party scripts running in the first-party context are a significant privacy 10 and security risk. This change captures the number of such script loads which will 11 allow ITP to take action. 12 13 Tests: http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html 14 http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html 15 http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html 16 http/tests/resourceLoadStatistics/count-third-party-script-loads.html 17 18 * loader/FrameLoader.cpp: 19 (WebCore::FrameLoader::loadResourceSynchronously): 20 Now sends the ResourceLoadObserver::FetchDestinationIsScriptLike parameter to 21 ResourceLoadObserver::logSubresourceLoading(). 22 * loader/ResourceLoadObserver.h: 23 (WebCore::ResourceLoadObserver::logSubresourceLoading): 24 Now takes a FetchDestinationIsScriptLike parameter. 25 * loader/ResourceLoadStatistics.cpp: 26 (WebCore::ResourceLoadStatistics::encode const): 27 (WebCore::ResourceLoadStatistics::decode): 28 (WebCore::ResourceLoadStatistics::toString const): 29 Output of the new topFrameLoadedThirdPartyScripts category. 30 Removed the lastSeen output since it may differ between test runs. 31 (WebCore::ResourceLoadStatistics::merge): 32 Handling of the new topFrameLoadedThirdPartyScripts category. 33 * loader/ResourceLoadStatistics.h: 34 Added the new topFrameLoadedThirdPartyScripts category. 35 * loader/SubresourceLoader.cpp: 36 (WebCore::SubresourceLoader::willSendRequestInternal): 37 Now sends the ResourceLoadObserver::FetchDestinationIsScriptLike parameter to 38 ResourceLoadObserver::logSubresourceLoading(). 39 1 40 2019-11-19 Zalan Bujtas <zalan@apple.com> 2 41 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r252077 r252641 3151 3151 data = SharedBuffer::create(WTFMove(buffer)); 3152 3152 documentLoader()->applicationCacheHost().maybeLoadFallbackSynchronously(newRequest, error, response, data); 3153 ResourceLoadObserver::shared().logSubresourceLoading(&m_frame, newRequest, response); 3153 ResourceLoadObserver::shared().logSubresourceLoading(&m_frame, newRequest, response, 3154 (isScriptLikeDestination(options.destination) ? ResourceLoadObserver::FetchDestinationIsScriptLike::Yes : ResourceLoadObserver::FetchDestinationIsScriptLike::No)); 3154 3155 } 3155 3156 } -
trunk/Source/WebCore/loader/ResourceLoadObserver.h
r252014 r252641 39 39 WTF_MAKE_FAST_ALLOCATED; 40 40 public: 41 // https://fetch.spec.whatwg.org/#request-destination-script-like 42 enum class FetchDestinationIsScriptLike : bool { Yes, No }; 43 41 44 WEBCORE_EXPORT static ResourceLoadObserver& shared(); 42 45 WEBCORE_EXPORT static ResourceLoadObserver* sharedIfExists(); … … 45 48 virtual ~ResourceLoadObserver() { } 46 49 47 virtual void logSubresourceLoading(const Frame*, const ResourceRequest& /* newRequest */, const ResourceResponse& /* redirectResponse */ ) { }50 virtual void logSubresourceLoading(const Frame*, const ResourceRequest& /* newRequest */, const ResourceResponse& /* redirectResponse */, FetchDestinationIsScriptLike) { } 48 51 virtual void logWebSocketLoading(const URL& /* targetURL */, const URL& /* mainFrameURL */) { } 49 52 virtual void logUserInteractionWithReducedTimeResolution(const Document&) { } -
trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp
r242713 r252641 96 96 encodeHashSet(encoder, "topFrameLinkDecorationsFrom"_s, "domain", topFrameLinkDecorationsFrom); 97 97 encoder.encodeBool("gotLinkDecorationFromPrevalentResource"_s, gotLinkDecorationFromPrevalentResource); 98 encodeHashSet(encoder, "topFrameLoadedThirdPartyScripts"_s, "domain", topFrameLoadedThirdPartyScripts); 98 99 99 100 // Subframe stats … … 224 225 if (!decoder.decodeBool("gotLinkDecorationFromPrevalentResource", gotLinkDecorationFromPrevalentResource)) 225 226 return false; 227 } 228 229 if (modelVersion >= 17) { 230 HashCountedSet<RegistrableDomain> topFrameLoadedThirdPartyScriptsCounted; 231 decodeHashCountedSet(decoder, "topFrameLoadedThirdPartyScripts", topFrameLoadedThirdPartyScriptsCounted); 232 for (auto& domain : topFrameLoadedThirdPartyScriptsCounted.values()) 233 topFrameLoadedThirdPartyScripts.add(domain); 226 234 } 227 235 … … 412 420 builder.append(registrableDomain.string()); 413 421 builder.append('\n'); 414 builder.appendLiteral(" lastSeen: "); 415 builder.appendFixedPrecisionNumber(lastSeen.secondsSinceEpoch().value()); 416 builder.append('\n'); 417 422 418 423 // User interaction 419 424 appendBoolean(builder, "hadUserInteraction", hadUserInteraction); … … 433 438 appendHashSet(builder, "topFrameLinkDecorationsFrom", topFrameLinkDecorationsFrom); 434 439 appendBoolean(builder, "gotLinkDecorationFromPrevalentResource", gotLinkDecorationFromPrevalentResource); 440 builder.append('\n'); 441 appendHashSet(builder, "topFrameLoadedThirdPartyScripts", topFrameLoadedThirdPartyScripts); 435 442 436 443 // Subframe stats … … 509 516 mergeHashSet(topFrameLinkDecorationsFrom, other.topFrameLinkDecorationsFrom); 510 517 gotLinkDecorationFromPrevalentResource |= other.gotLinkDecorationFromPrevalentResource; 518 mergeHashSet(topFrameLoadedThirdPartyScripts, other.topFrameLoadedThirdPartyScripts); 511 519 512 520 // Subframe stats -
trunk/Source/WebCore/loader/ResourceLoadStatistics.h
r242603 r252641 81 81 HashSet<RegistrableDomain> topFrameLinkDecorationsFrom; 82 82 bool gotLinkDecorationFromPrevalentResource { false }; 83 HashSet<RegistrableDomain> topFrameLoadedThirdPartyScripts; 83 84 84 85 // Subframe stats -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r252348 r252641 196 196 if (newRequest.requester() != ResourceRequestBase::Requester::Main) { 197 197 tracePoint(SubresourceLoadWillStart); 198 ResourceLoadObserver::shared().logSubresourceLoading(m_frame.get(), newRequest, redirectResponse); 198 ResourceLoadObserver::shared().logSubresourceLoading(m_frame.get(), newRequest, redirectResponse, 199 (isScriptLikeDestination(options().destination) ? ResourceLoadObserver::FetchDestinationIsScriptLike::Yes : ResourceLoadObserver::FetchDestinationIsScriptLike::No)); 199 200 } 200 201 -
trunk/Source/WebKit/ChangeLog
r252637 r252641 1 2019-11-19 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Count third-party script loads under top frame 4 https://bugs.webkit.org/show_bug.cgi?id=204262 5 <rdar://problem/57244945> 6 7 Reviewed by Alex Christensen. 8 9 Third-party scripts running in the first-party context are a significant privacy 10 and security risk. This change captures the number of such script loads which will 11 allow ITP to take action. 12 13 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 14 (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): 15 (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): 16 (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): 17 (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): 18 (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships): 19 (WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement): 20 Addition of the new category TopFrameLoadedThirdPartyScripts. 21 (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString): 22 Removed the lastSeen output since it may differ between test runs. 23 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 24 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 25 Bumped statisticsModelVersion to 17. 26 * Shared/WebCoreArgumentCoders.cpp: 27 (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): 28 (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): 29 Encoding and decoding of the new category topFrameLoadedThirdPartyScripts. 30 * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: 31 (WebKit::WebResourceLoadObserver::logSubresourceLoading): 32 Now takes an additional enum parameter FetchDestinationIsScriptLike which 33 is used to detect third-party script-like loads (script, worker, or 34 service worker) from third-parties. If one is detected, it is stored 35 in the new topFrameLoadedThirdPartyScripts category. 36 * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: 37 1 38 2019-11-19 Brian Burg <bburg@apple.com> 2 39 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r252030 r252641 84 84 constexpr auto topFrameUniqueRedirectsFromQuery = "INSERT OR IGNORE INTO TopFrameUniqueRedirectsFrom (targetDomainID, fromDomainID) SELECT ?, domainID FROM ObservedDomains WHERE registrableDomain in ( "_s; 85 85 constexpr auto topFrameLinkDecorationsFromQuery = "INSERT OR IGNORE INTO TopFrameLinkDecorationsFrom (toDomainID, fromDomainID) SELECT ?, domainID FROM ObservedDomains WHERE registrableDomain in ( "_s; 86 constexpr auto topFrameLoadedThirdPartyScriptsQuery = "INSERT OR IGNORE into TopFrameLoadedThirdPartyScripts (topFrameDomainID, subresourceDomainID) SELECT ?, domainID FROM ObservedDomains where registrableDomain in ( "_s; 86 87 constexpr auto subresourceUnderTopFrameDomainsQuery = "INSERT OR IGNORE INTO SubresourceUnderTopFrameDomains (subresourceDomainID, topFrameDomainID) SELECT ?, domainID FROM ObservedDomains WHERE registrableDomain in ( "_s; 87 88 constexpr auto subresourceUniqueRedirectsToQuery = "INSERT OR IGNORE INTO SubresourceUniqueRedirectsTo (subresourceDomainID, toDomainID) SELECT ?, domainID FROM ObservedDomains WHERE registrableDomain in ( "_s; … … 96 97 "AND toDomainID = (SELECT domainID FROM ObservedDomains WHERE registrableDomain = ?))"_s; 97 98 constexpr auto topFrameLinkDecorationsFromExistsQuery = "SELECT EXISTS (SELECT 1 FROM TopFrameLinkDecorationsFrom WHERE toDomainID = ? " 98 "AND fromDomainID = (SELECT domainID FROM ObservedDomains WHERE registrableDomain = ?))"_s; 99 "AND fromDomainID = (SELECT domainID FROM ObservedDomains WHERE registrableDomain = ?))"_s; 100 constexpr auto topFrameLoadedThirdPartyScriptsExistsQuery = "SELECT EXISTS (SELECT 1 FROM TopFrameLoadedThirdPartyScripts WHERE topFrameDomainID = ? " 101 "AND subresourceDomainID = (SELECT domainID FROM ObservedDomains WHERE registrableDomain = ?))"_s; 99 102 100 103 // UPDATE Queries … … 167 170 "FOREIGN KEY(fromDomainID) REFERENCES TopLevelDomains(topLevelDomainID) ON DELETE CASCADE);"_s; 168 171 172 constexpr auto createTopFrameLoadedThirdPartyScripts = "CREATE TABLE TopFrameLoadedThirdPartyScripts (" 173 "topFrameDomainID INTEGER NOT NULL, subresourceDomainID INTEGER NOT NULL, " 174 "FOREIGN KEY(topFrameDomainID) REFERENCES ObservedDomains(domainID) ON DELETE CASCADE, " 175 "FOREIGN KEY(subresourceDomainID) REFERENCES ObservedDomains(domainID) ON DELETE CASCADE);"_s; 176 169 177 constexpr auto createSubframeUnderTopFrameDomains = "CREATE TABLE SubframeUnderTopFrameDomains (" 170 178 "subFrameDomainID INTEGER NOT NULL, topFrameDomainID INTEGER NOT NULL, " … … 192 200 constexpr auto createUniqueIndexTopFrameUniqueRedirectsFrom = "CREATE UNIQUE INDEX IF NOT EXISTS TopFrameUniqueRedirectsFrom_targetDomainID_fromDomainID on TopFrameUniqueRedirectsFrom ( targetDomainID, fromDomainID );"_s; 193 201 constexpr auto createUniqueIndexTopFrameLinkDecorationsFrom = "CREATE UNIQUE INDEX IF NOT EXISTS TopFrameLinkDecorationsFrom_toDomainID_fromDomainID on TopFrameLinkDecorationsFrom ( toDomainID, fromDomainID );"_s; 202 constexpr auto createUniqueIndexTopFrameLoadedThirdPartyScripts = "CREATE UNIQUE INDEX IF NOT EXISTS TopFrameLoadedThirdPartyScripts_topFrameDomainID_subresourceDomainID on TopFrameLoadedThirdPartyScripts ( topFrameDomainID, subresourceDomainID );"_s; 194 203 constexpr auto createUniqueIndexSubframeUnderTopFrameDomains = "CREATE UNIQUE INDEX IF NOT EXISTS SubframeUnderTopFrameDomains_subFrameDomainID_topFrameDomainID on SubframeUnderTopFrameDomains ( subFrameDomainID, topFrameDomainID );"_s; 195 204 constexpr auto createUniqueIndexSubresourceUnderTopFrameDomains = "CREATE UNIQUE INDEX IF NOT EXISTS SubresourceUnderTopFrameDomains_subresourceDomainID_topFrameDomainID on SubresourceUnderTopFrameDomains ( subresourceDomainID, topFrameDomainID );"_s; … … 217 226 , m_domainIDFromStringStatement(m_database, domainIDFromStringQuery) 218 227 , m_topFrameLinkDecorationsFromExists(m_database, topFrameLinkDecorationsFromExistsQuery) 228 , m_topFrameLoadedThirdPartyScriptsExists(m_database, topFrameLoadedThirdPartyScriptsExistsQuery) 219 229 , m_subframeUnderTopFrameDomainExists(m_database, subframeUnderTopFrameDomainExistsQuery) 220 230 , m_subresourceUnderTopFrameDomainExists(m_database, subresourceUnderTopFrameDomainExistsQuery) … … 341 351 || !m_database.executeCommand(createUniqueIndexTopFrameUniqueRedirectsFrom) 342 352 || !m_database.executeCommand(createUniqueIndexTopFrameLinkDecorationsFrom) 353 || !m_database.executeCommand(createUniqueIndexTopFrameLoadedThirdPartyScripts) 343 354 || !m_database.executeCommand(createUniqueIndexSubframeUnderTopFrameDomains) 344 355 || !m_database.executeCommand(createUniqueIndexSubresourceUnderTopFrameDomains) … … 382 393 if (!m_database.executeCommand(createTopFrameLinkDecorationsFrom)) { 383 394 LOG_ERROR("Could not create TopFrameLinkDecorationsFrom table in database (%i) - %s", m_database.lastError(), m_database.lastErrorMsg()); 395 return false; 396 } 397 398 if (!m_database.executeCommand(createTopFrameLoadedThirdPartyScripts)) { 399 LOG_ERROR("Could not create TopFrameLoadedThirdPartyScripts table in database (%i) - %s", m_database.lastError(), m_database.lastErrorMsg()); 384 400 return false; 385 401 } … … 436 452 || m_findExpiredUserInteractionStatement.prepare() != SQLITE_OK 437 453 || m_topFrameLinkDecorationsFromExists.prepare() != SQLITE_OK 454 || m_topFrameLoadedThirdPartyScriptsExists.prepare() != SQLITE_OK 438 455 || m_countPrevalentResourcesStatement.prepare() != SQLITE_OK 439 456 || m_countPrevalentResourcesWithUserInteractionStatement.prepare() != SQLITE_OK … … 601 618 insertDomainRelationshipList(subresourceUniqueRedirectsFromQuery, loadStatistics.subresourceUniqueRedirectsFrom, registrableDomainID.value()); 602 619 insertDomainRelationshipList(topFrameLinkDecorationsFromQuery, loadStatistics.topFrameLinkDecorationsFrom, registrableDomainID.value()); 620 insertDomainRelationshipList(topFrameLoadedThirdPartyScriptsQuery, loadStatistics.topFrameLoadedThirdPartyScripts, registrableDomainID.value()); 603 621 } 604 622 … … 2228 2246 if (tableName == "TopFrameLinkDecorationsFrom") 2229 2247 return "SELECT fromDomainID from TopFrameLinkDecorationsFrom WHERE toDomainID = ?"; 2248 if (tableName == "TopFrameLoadedThirdPartyScripts") 2249 return "SELECT subresourceDomainID from TopFrameLoadedThirdPartyScripts WHERE topFrameDomainID = ?"; 2230 2250 if (tableName == "SubframeUnderTopFrameDomains") 2231 2251 return "SELECT topFrameDomainID from SubframeUnderTopFrameDomains WHERE subFrameDomainID = ?"; … … 2284 2304 builder.append(domain); 2285 2305 builder.append('\n'); 2286 builder.appendLiteral(" lastSeen: ");2287 builder.appendFixedPrecisionNumber(m_getResourceDataByDomainNameStatement.getColumnDouble(LastSeenIndex));2288 builder.append('\n');2289 2306 2290 2307 // User interaction … … 2304 2321 appendSubStatisticList(builder, "TopFrameUniqueRedirectsFrom", domain); 2305 2322 appendSubStatisticList(builder, "TopFrameLinkDecorationsFrom", domain); 2323 appendSubStatisticList(builder, "TopFrameLoadedThirdPartyScripts", domain); 2306 2324 2307 2325 appendBoolean(builder, "IsScheduledForAllButCookieDataRemoval", m_getResourceDataByDomainNameStatement.getColumnInt(IsScheduledForAllButCookieDataRemovalIndex)); 2326 builder.append('\n'); 2308 2327 2309 2328 // Subframe stats … … 2327 2346 } 2328 2347 2329 2330 2348 } // namespace WebKit 2331 2349 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r251663 r252641 224 224 mutable WebCore::SQLiteStatement m_domainIDFromStringStatement; 225 225 mutable WebCore::SQLiteStatement m_topFrameLinkDecorationsFromExists; 226 mutable WebCore::SQLiteStatement m_topFrameLoadedThirdPartyScriptsExists; 226 227 mutable WebCore::SQLiteStatement m_subframeUnderTopFrameDomainExists; 227 228 mutable WebCore::SQLiteStatement m_subresourceUnderTopFrameDomainExists; -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r251663 r252641 52 52 using namespace WebCore; 53 53 54 constexpr unsigned statisticsModelVersion { 1 6};54 constexpr unsigned statisticsModelVersion { 17 }; 55 55 56 56 struct StatisticsLastSeen { -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r251361 r252641 2685 2685 encoder << statistics.topFrameUniqueRedirectsTo; 2686 2686 encoder << statistics.topFrameUniqueRedirectsFrom; 2687 encoder << statistics.topFrameLoadedThirdPartyScripts; 2687 2688 2688 2689 // Subframe stats … … 2756 2757 return WTF::nullopt; 2757 2758 statistics.topFrameUniqueRedirectsFrom = WTFMove(*topFrameUniqueRedirectsFrom); 2759 2760 Optional<HashSet<RegistrableDomain>> topFrameLoadedThirdPartyScripts; 2761 decoder >> topFrameLoadedThirdPartyScripts; 2762 if (!topFrameLoadedThirdPartyScripts) 2763 return WTF::nullopt; 2764 statistics.topFrameLoadedThirdPartyScripts = WTFMove(*topFrameLoadedThirdPartyScripts); 2758 2765 2759 2766 // Subframe stats -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp
r252014 r252641 236 236 } 237 237 238 void WebResourceLoadObserver::logSubresourceLoading(const Frame* frame, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse )238 void WebResourceLoadObserver::logSubresourceLoading(const Frame* frame, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse, FetchDestinationIsScriptLike isScriptLike) 239 239 { 240 240 ASSERT(frame->page()); … … 270 270 targetStatistics.lastSeen = lastSeen; 271 271 targetStatistics.subresourceUnderTopFrameDomains.add(topFrameDomain); 272 273 scheduleNotificationIfNeeded(); 274 } 275 276 if (frame->isMainFrame() && isScriptLike == FetchDestinationIsScriptLike::Yes) { 277 auto& topFrameStatistics = ensureResourceStatisticsForRegistrableDomain(topFrameDomain); 278 topFrameStatistics.topFrameLoadedThirdPartyScripts.add(targetDomain); 272 279 273 280 scheduleNotificationIfNeeded(); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h
r252014 r252641 40 40 ~WebResourceLoadObserver(); 41 41 42 void logSubresourceLoading(const WebCore::Frame*, const WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse ) final;42 void logSubresourceLoading(const WebCore::Frame*, const WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse, FetchDestinationIsScriptLike) final; 43 43 void logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL) final; 44 44 void logUserInteractionWithReducedTimeResolution(const WebCore::Document&) final;
Note: See TracChangeset
for help on using the changeset viewer.