Changeset 251391 in webkit
- Timestamp:
- Oct 21, 2019 3:33:47 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251389 r251391 1 2019-10-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Update cookie blocking in NetworkStorageSession after first user interaction 4 https://bugs.webkit.org/show_bug.cgi?id=203195 5 <rdar://problem/56464567> 6 7 Reviewed by Alex Christensen and Chris Dumez. 8 9 This patch removes the explicit calls to testRunner.statisticsUpdateCookieBlocking() since 10 they are no longer needed. This makes sure the changed code is tested. 11 12 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html: 13 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html: 14 1 15 2019-10-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 16 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html
r251213 r251391 47 47 // Produce user interaction for the first-party to allow third-party cookie access. 48 48 testRunner.setStatisticsHasHadUserInteraction(partitionOrigin, true, function() { 49 testRunner.statisticsUpdateCookieBlocking(function() { 50 // Check that the cookie is no longer blocked for localhost under 127.0.0.1. 51 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive first-party cookie.", runTest); 52 }); 49 // Check that the cookie is no longer blocked for localhost under 127.0.0.1. 50 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive first-party cookie.", runTest); 53 51 }); 54 52 break; -
trunk/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html
r251213 r251391 47 47 // Produce user interaction for the first-party to allow third-party cookie access. 48 48 testRunner.setStatisticsHasHadUserInteraction(partitionOrigin, true, function() { 49 testRunner.statisticsUpdateCookieBlocking(function() { 50 // Check that the cookie is no longer blocked for localhost under 127.0.0.1. 51 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive first-party cookie.", runTest); 52 }); 49 // Check that the cookie is no longer blocked for localhost under 127.0.0.1. 50 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive first-party cookie.", runTest); 53 51 }); 54 52 break; -
trunk/Source/WebKit/ChangeLog
r251390 r251391 1 2019-10-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Update cookie blocking in NetworkStorageSession after first user interaction 4 https://bugs.webkit.org/show_bug.cgi?id=203195 5 <rdar://problem/56464567> 6 7 Reviewed by Alex Christensen and Chris Dumez. 8 9 This change makes sure that the state of cookie blocking in 10 WebCore:: NetworkStorageSession is immediately updated if the logged 11 user interaction was new for this domain. It adds a completion 12 handler to WebResourceLoadStatisticsStore::logUserInteraction() so 13 that the call properly waits for everything to be updated. 14 15 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 16 (WebKit::CompletionHandler<void): 17 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 18 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 19 (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction): 20 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 21 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 22 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 23 (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): 24 1 25 2019-10-21 Dean Jackson <dino@apple.com> 2 26 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r251213 r251391 1351 1351 } 1352 1352 1353 void ResourceLoadStatisticsDatabaseStore::logUserInteraction(const TopFrameDomain& domain) 1354 { 1355 ASSERT(!RunLoop::isMain()); 1356 1353 void ResourceLoadStatisticsDatabaseStore::logUserInteraction(const TopFrameDomain& domain, CompletionHandler<void()>&& completionHandler) 1354 { 1355 ASSERT(!RunLoop::isMain()); 1356 1357 bool didHavePreviousUserInteraction = hasHadUserInteraction(domain, OperatingDatesWindow::Long); 1357 1358 ensureResourceStatisticsForRegistrableDomain(domain); 1358 1359 setUserInteraction(domain, true, WallTime::now()); 1360 if (didHavePreviousUserInteraction) { 1361 completionHandler(); 1362 return; 1363 } 1364 updateCookieBlocking(WTFMove(completionHandler)); 1359 1365 } 1360 1366 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r251213 r251391 124 124 125 125 void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; 126 void logUserInteraction(const TopFrameDomain& ) override;126 void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) override; 127 127 void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override; 128 128 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r251213 r251391 404 404 } 405 405 406 void ResourceLoadStatisticsMemoryStore::logUserInteraction(const TopFrameDomain& domain )406 void ResourceLoadStatisticsMemoryStore::logUserInteraction(const TopFrameDomain& domain, CompletionHandler<void()>&& completionHandler) 407 407 { 408 408 ASSERT(!RunLoop::isMain()); 409 409 410 410 auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain); 411 bool didHavePreviousUserInteraction = statistics.hadUserInteraction; 411 412 statistics.hadUserInteraction = true; 412 413 statistics.mostRecentUserInteractionTime = WallTime::now(); 414 if (didHavePreviousUserInteraction) { 415 completionHandler(); 416 return; 417 } 418 updateCookieBlocking(WTFMove(completionHandler)); 413 419 } 414 420 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
r250621 r251391 103 103 104 104 void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; 105 void logUserInteraction(const TopFrameDomain& ) override;105 void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) override; 106 106 void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override; 107 107 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
r250621 r251391 167 167 168 168 virtual void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) = 0; 169 virtual void logUserInteraction(const TopFrameDomain& ) = 0;169 virtual void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) = 0; 170 170 virtual void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) = 0; 171 171 -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r251213 r251391 548 548 549 549 postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { 550 if (m_statisticsStore) 551 m_statisticsStore->logUserInteraction(domain); 552 postTaskReply(WTFMove(completionHandler)); 550 auto innerCompletionHandler = [completionHandler = WTFMove(completionHandler)]() mutable { 551 postTaskReply(WTFMove(completionHandler)); 552 }; 553 if (m_statisticsStore) { 554 m_statisticsStore->logUserInteraction(domain, WTFMove(innerCompletionHandler)); 555 return; 556 } 557 innerCompletionHandler(); 553 558 }); 554 559 }
Note: See TracChangeset
for help on using the changeset viewer.