Age out unconverted Ad Click Attributions after one week.
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 21:28:42 +0000 (21:28 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 21:28:42 +0000 (21:28 +0000)
commitcd336ce3b7d05f68087432685fcad461adb37272
tree0e7d2a0bde49c08326594ae3d2798d76028e62bd
parenta652a5ab44677b73e366b7fb1b08a3babd5ac22d
Age out unconverted Ad Click Attributions after one week.
https://bugs.webkit.org/show_bug.cgi?id=197238
<rdar://problem/50177349>

Reviewed by Chris Dumez.

Source/WebCore:

This patch adds the two functions AdClickAttribution::markAsExpired()
and AdClickAttribution::hasExpired() which make use of the existing
m_timeOfAdClick member.

Test: http/tests/adClickAttribution/expired-attributions-removed.html

* loader/AdClickAttribution.cpp:
(WebCore::AdClickAttribution::markAsExpired):
(WebCore::AdClickAttribution::hasExpired const):
* loader/AdClickAttribution.h:

Source/WebKit:

AdClickAttributionManager::storeUnconverted() and
AdClickAttributionManager::convert() now start by calling the new
AdClickAttributionManager::clearExpired() function to remove any
expired, unconverted attributions before continuing.

The rest of the patch is infrastructure to allow tests to expire
all unconverted attributions early.

* NetworkProcess/AdClickAttributionManager.cpp:
(WebKit::AdClickAttributionManager::storeUnconverted):
(WebKit::AdClickAttributionManager::convert):
(WebKit::AdClickAttributionManager::clearExpired):
(WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
* NetworkProcess/AdClickAttributionManager.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
* NetworkProcess/NetworkSession.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetAdClickAttributionConversionURLForTesting):
(WKPageMarkAdClickAttributionsAsExpiredForTesting):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
* UIProcess/WebPageProxy.h:

Tools:

This patch adds infrastructure to allow tests to expire all unconverted
attributions early.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::markAdClickAttributionsAsExpiredForTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::markAdClickAttributionsAsExpiredForTesting):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/adClickAttribution/expired-attributions-removed-expected.txt: Added.
* http/tests/adClickAttribution/expired-attributions-removed.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/adClickAttribution/expired-attributions-removed-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/adClickAttribution/expired-attributions-removed.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/AdClickAttribution.cpp
Source/WebCore/loader/AdClickAttribution.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp
Source/WebKit/NetworkProcess/AdClickAttributionManager.h
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkSession.cpp
Source/WebKit/NetworkProcess/NetworkSession.h
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/C/WKPagePrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp