<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[244572] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/244572">244572</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2019-04-23 17:13:00 -0700 (Tue, 23 Apr 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove Ad Click Attribution data when removing website data
https://bugs.webkit.org/show_bug.cgi?id=197215
<rdar://problem/47668988>

Reviewed by Chris Dumez.

Source/WebKit:

This patch adds a new WebsiteDataType called AdClickAttributions and flags
it as owned by the network process.

The new website data type is added to the Cocoa API layer for
website data records management.

When either of the two WebsiteDataStore::removeData() functions calls
NetworkProcess::deleteWebsiteData() or
NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
process now calls into AdClickAttributionManager::clear() and
AdClickAttributionManager::clearForRegistrableDomain() respectively,
if the website datatypes include WebsiteDataType::AdClickAttributions.

The patch removes a couple of completion handlers in NetworkSession function
calls are because those are not asynchronous.

* NetworkProcess/AdClickAttributionManager.cpp:
(WebKit::AdClickAttributionManager::clear):
(WebKit::AdClickAttributionManager::clearForRegistrableDomain):
(WebKit::AdClickAttributionManager::toString const):
* NetworkProcess/AdClickAttributionManager.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::clearAdClickAttribution):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::clearAdClickAttribution):
(WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
* NetworkProcess/NetworkSession.h:
* Shared/WebsiteData/WebsiteData.cpp:
(WebKit::WebsiteData::ownerProcess):
* Shared/WebsiteData/WebsiteDataType.h:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
(dataTypesToString):
* UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
(WebKit::toWebsiteDataType):
(WebKit::toWKWebsiteDataTypes):
* UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):

Tools:

This patch adds test infrastructure to delete Ad Click Attribution data
through WebsiteDataStore::removeData().

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

LayoutTests:

* http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt: Added.
* http/tests/adClickAttribution/clear-through-website-data-removal.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessAdClickAttributionManagercpp">trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessAdClickAttributionManagerh">trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessioncpp">trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionh">trunk/Source/WebKit/NetworkProcess/NetworkSession.h</a></li>
<li><a href="#trunkSourceWebKitSharedWebsiteDataWebsiteDatacpp">trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebsiteDataWebsiteDataTypeh">trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataType.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp">trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefh">trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordmm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordInternalh">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordPrivateh">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsadClickAttributionclearthroughwebsitedataremovalexpectedtxt">trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsadClickAttributionclearthroughwebsitedataremovalhtml">trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/LayoutTests/ChangeLog 2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2019-04-23  John Wilander  <wilander@apple.com>
+
+        Remove Ad Click Attribution data when removing website data
+        https://bugs.webkit.org/show_bug.cgi?id=197215
+        <rdar://problem/47668988>
+
+        Reviewed by Chris Dumez.
+
+        * http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt: Added.
+        * http/tests/adClickAttribution/clear-through-website-data-removal.html: Added.
+
</ins><span class="cx"> 2019-04-23  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         ContentSecurityPolicy::logToConsole should include line/column number and source location
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsadClickAttributionclearthroughwebsitedataremovalexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt (0 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt                          (rev 0)
+++ trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal-expected.txt     2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Tests that both unconverted and converted attributions are cleared on website data removal.
+
+
+
+No stored Ad Click Attribution data.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsadClickAttributionclearthroughwebsitedataremovalhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal.html (0 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal.html                          (rev 0)
+++ trunk/LayoutTests/http/tests/adClickAttribution/clear-through-website-data-removal.html     2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true internal:AdClickAttributionEnabled=true ] -->
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <script src="/js-test-resources/ui-helper.js"></script>
+    <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout(runTest, 0)">
+<div id="description">Tests that both unconverted and converted attributions are cleared on website data removal.</div>
+<a id="targetLink">Link</a><br>
+<div id="output"></div>
+<script>
+    const path = "/adClickAttribution/clear-through-website-data-removal.html";
+    const configuration = [
+        {
+            href: "http://localhost:8000" + path + "?stepTwo",
+            adcampaignid: "3",
+            addestination: "http://localhost:8000"
+        },
+        {
+            href: "http://127.0.0.1:8000" + path + "?stepThree",
+            adcampaignid: "4",
+            addestination: "http://127.0.0.1:8000"
+        }
+    ];
+
+    prepareTest();
+
+    function configureLink(index) {
+        let linkElement = document.getElementById("targetLink");
+        linkElement.setAttribute("href", configuration[index].href);
+        linkElement.setAttribute("adcampaignid", configuration[index].adcampaignid);
+        linkElement.setAttribute("addestination", configuration[index].addestination);
+    }
+
+    function activateElement(elementID) {
+        var element = document.getElementById(elementID);
+        var centerX = element.offsetLeft + element.offsetWidth / 2;
+        var centerY = element.offsetTop + element.offsetHeight / 2;
+        UIHelper.activateAt(centerX, centerY).then(
+            function () {
+            },
+            function () {
+                document.getElementById("output").innerText = "FAIL Promise rejected.";
+                tearDownAndFinish();
+            }
+        );
+    }
+
+    function runTest() {
+        if (window.testRunner) {
+            if (window.location.search === "") {
+                // First ad click 127.0.0.1 –> localhost.
+                configureLink(0);
+                activateElement("targetLink");
+            } else if (window.location.search === "?stepTwo") {
+                // Convert the first ad click with priority 4, then do a reverse ad click.
+                let imageElement = document.createElement("img");
+                imageElement.src = "https://127.0.0.1:8443/adClickAttribution/resources/redirectToConversion.php?conversionData=12&priority=04";
+                imageElement.id = "pixel";
+                imageElement.onerror = function(e) {
+                    // Second ad click localhost –> 127.0.0.1.
+                    configureLink(1);
+                    activateElement("targetLink");
+                };
+                document.body.appendChild(imageElement);
+            } else if (window.location.search === "?stepThree") {
+                testRunner.clearAdClickAttributionsThroughWebsiteDataRemoval();
+                testRunner.dumpAdClickAttribution();
+                document.body.removeChild(document.getElementById("targetLink"));
+                tearDownAndFinish();
+            } else {
+                document.getElementById("output").innerText = "FAIL Unknown window.location.search == " + window.location.search + ".";
+                tearDownAndFinish();
+            }
+        } else {
+            document.getElementById("output").innerText = "FAIL No testRunner.";
+        }
+    }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/ChangeLog       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2019-04-23  John Wilander  <wilander@apple.com>
+
+        Remove Ad Click Attribution data when removing website data
+        https://bugs.webkit.org/show_bug.cgi?id=197215
+        <rdar://problem/47668988>
+
+        Reviewed by Chris Dumez.
+
+        This patch adds a new WebsiteDataType called AdClickAttributions and flags
+        it as owned by the network process.
+
+        The new website data type is added to the Cocoa API layer for
+        website data records management.
+
+        When either of the two WebsiteDataStore::removeData() functions calls
+        NetworkProcess::deleteWebsiteData() or
+        NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
+        process now calls into AdClickAttributionManager::clear() and
+        AdClickAttributionManager::clearForRegistrableDomain() respectively,
+        if the website datatypes include WebsiteDataType::AdClickAttributions.
+
+        The patch removes a couple of completion handlers in NetworkSession function
+        calls are because those are not asynchronous.
+
+        * NetworkProcess/AdClickAttributionManager.cpp:
+        (WebKit::AdClickAttributionManager::clear):
+        (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
+        (WebKit::AdClickAttributionManager::toString const):
+        * NetworkProcess/AdClickAttributionManager.h:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::deleteWebsiteData):
+        (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
+        (WebKit::NetworkProcess::clearAdClickAttribution):
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::clearAdClickAttribution):
+        (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
+        * NetworkProcess/NetworkSession.h:
+        * Shared/WebsiteData/WebsiteData.cpp:
+        (WebKit::WebsiteData::ownerProcess):
+        * Shared/WebsiteData/WebsiteDataType.h:
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
+        (dataTypesToString):
+        * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
+        (WebKit::toWebsiteDataType):
+        (WebKit::toWKWebsiteDataTypes):
+        * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
+
</ins><span class="cx"> 2019-04-23  Tim Horton  <timothy_horton@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Return annotated text checking strings via UIWKDocumentContext
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessAdClickAttributionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp 2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp    2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -169,14 +169,24 @@
</span><span class="cx">         startTimer(nextTimeToFire);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AdClickAttributionManager::clear(CompletionHandler<void()>&& completionHandler)
</del><ins>+void AdClickAttributionManager::clear()
</ins><span class="cx"> {
</span><span class="cx">     m_firePendingConversionRequestsTimer.stop();
</span><span class="cx">     m_unconvertedAdClickAttributionMap.clear();
</span><span class="cx">     m_convertedAdClickAttributionMap.clear();
</span><del>-    completionHandler();
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AdClickAttributionManager::clearForRegistrableDomain(const RegistrableDomain& domain)
+{
+    m_unconvertedAdClickAttributionMap.removeIf([&domain](auto& keyAndValue) {
+        return keyAndValue.key.first.registrableDomain == domain || keyAndValue.key.second.registrableDomain == domain;
+    });
+
+    m_convertedAdClickAttributionMap.removeIf([&domain](auto& keyAndValue) {
+        return keyAndValue.key.first.registrableDomain == domain || keyAndValue.key.second.registrableDomain == domain;
+    });
+}
+
</ins><span class="cx"> void AdClickAttributionManager::toString(CompletionHandler<void(String)>&& completionHandler) const
</span><span class="cx"> {
</span><span class="cx">     if (m_unconvertedAdClickAttributionMap.isEmpty() && m_convertedAdClickAttributionMap.isEmpty())
</span><span class="lines">@@ -197,6 +207,8 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned convertedAttributionNumber = 0;
</span><span class="cx">     for (auto& attribution : m_convertedAdClickAttributionMap.values()) {
</span><ins>+        if (unconvertedAttributionNumber)
+            builder.append('\n');
</ins><span class="cx">         if (!convertedAttributionNumber)
</span><span class="cx">             builder.appendLiteral("Converted Ad Click Attributions:\n");
</span><span class="cx">         else
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessAdClickAttributionManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.h   2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/NetworkProcess/AdClickAttributionManager.h      2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -57,7 +57,8 @@
</span><span class="cx"> 
</span><span class="cx">     void storeUnconverted(AdClickAttribution&&);
</span><span class="cx">     void convert(const Source&, const Destination&, Conversion&&);
</span><del>-    void clear(CompletionHandler<void()>&&);
</del><ins>+    void clear();
+    void clearForRegistrableDomain(const RegistrableDomain&);
</ins><span class="cx">     void toString(CompletionHandler<void(String)>&&) const;
</span><span class="cx">     void setPingLoadFunction(Function<void(NetworkResourceLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&, const WebCore::ResourceResponse&)>&&)>&& pingLoadFunction) { m_pingLoadFunction = WTFMove(pingLoadFunction); }
</span><span class="cx">     void setOverrideTimerForTesting(bool value) { m_isRunningTest = value; }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -1425,6 +1425,11 @@
</span><span class="cx"> 
</span><span class="cx">     if (websiteDataTypes.contains(WebsiteDataType::IndexedDBDatabases) || websiteDataTypes.contains(WebsiteDataType::DOMCache))
</span><span class="cx">         clearStorageQuota(sessionID);
</span><ins>+
+    if (websiteDataTypes.contains(WebsiteDataType::AdClickAttributions)) {
+        if (auto* networkSession = this->networkSession(sessionID))
+            networkSession->clearAdClickAttribution();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void clearDiskCacheEntries(NetworkCache::Cache* cache, const Vector<SecurityOriginData>& origins, CompletionHandler<void()>&& completionHandler)
</span><span class="lines">@@ -1465,6 +1470,13 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    if (websiteDataTypes.contains(WebsiteDataType::AdClickAttributions)) {
+        if (auto* networkSession = this->networkSession(sessionID)) {
+            for (auto& originData : originDatas)
+                networkSession->clearAdClickAttributionForRegistrableDomain(RegistrableDomain::uncheckedCreateFromHost(originData.host));
+        }
+    }
+    
</ins><span class="cx">     auto clearTasksHandler = WTF::CallbackAggregator::create([this, callbackID] {
</span><span class="cx">         parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteDataForOrigins(callbackID), 0);
</span><span class="cx">     });
</span><span class="lines">@@ -2515,7 +2527,7 @@
</span><span class="cx"> void NetworkProcess::clearAdClickAttribution(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     if (auto* session = networkSession(sessionID))
</span><del>-        return session->clearAdClickAttribution(WTFMove(completionHandler));
</del><ins>+        session->clearAdClickAttribution();
</ins><span class="cx">     
</span><span class="cx">     completionHandler();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -158,11 +158,16 @@
</span><span class="cx">     m_adClickAttribution->toString(WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkSession::clearAdClickAttribution(CompletionHandler<void()>&& completionHandler)
</del><ins>+void NetworkSession::clearAdClickAttribution()
</ins><span class="cx"> {
</span><del>-    m_adClickAttribution->clear(WTFMove(completionHandler));
</del><ins>+    m_adClickAttribution->clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkSession::clearAdClickAttributionForRegistrableDomain(WebCore::RegistrableDomain&& domain)
+{
+    m_adClickAttribution->clearForRegistrableDomain(WTFMove(domain));
+}
+
</ins><span class="cx"> void NetworkSession::setAdClickAttributionOverrideTimerForTesting(bool value)
</span><span class="cx"> {
</span><span class="cx">     m_adClickAttribution->setOverrideTimerForTesting(value);
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h      2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -82,7 +82,8 @@
</span><span class="cx">     void storeAdClickAttribution(WebCore::AdClickAttribution&&);
</span><span class="cx">     void convertAdClickAttribution(const WebCore::AdClickAttribution::Source&, const WebCore::AdClickAttribution::Destination&, WebCore::AdClickAttribution::Conversion&&);
</span><span class="cx">     void dumpAdClickAttribution(CompletionHandler<void(String)>&&);
</span><del>-    void clearAdClickAttribution(CompletionHandler<void()>&&);
</del><ins>+    void clearAdClickAttribution();
+    void clearAdClickAttributionForRegistrableDomain(WebCore::RegistrableDomain&&);
</ins><span class="cx">     void setAdClickAttributionOverrideTimerForTesting(bool value);
</span><span class="cx">     void setAdClickAttributionConversionURLForTesting(URL&&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebsiteDataWebsiteDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp   2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/Shared/WebsiteData/WebsiteData.cpp      2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -128,6 +128,8 @@
</span><span class="cx">         return WebsiteDataProcessType::Network;
</span><span class="cx">     case WebsiteDataType::DeviceIdHashSalt:
</span><span class="cx">         return WebsiteDataProcessType::UI;
</span><ins>+    case WebsiteDataType::AdClickAttributions:
+        return WebsiteDataProcessType::Network;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebsiteDataWebsiteDataTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataType.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataType.h 2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataType.h    2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     DOMCache = 1 << 15,
</span><span class="cx">     DeviceIdHashSalt = 1 << 16,
</span><ins>+    AdClickAttributions = 1 << 17,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -658,3 +658,12 @@
</span><span class="cx">     WebKit::toImpl(dataStoreRef)->websiteDataStore().setMockWebAuthenticationConfiguration(WTFMove(configuration));
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+
+void WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction callback)
+{
+    OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::AdClickAttributions;
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, WallTime::fromRawSeconds(0), [context, callback] {
+        callback(context);
+    });
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h      2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -131,6 +131,9 @@
</span><span class="cx"> 
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreClearAllDeviceOrientationPermissions(WKWebsiteDataStoreRef dataStoreRef);
</span><span class="cx"> 
</span><ins>+typedef void (*WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction callback);
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm   2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm      2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> NSString * const _WKWebsiteDataTypeSearchFieldRecentSearches = @"_WKWebsiteDataTypeSearchFieldRecentSearches";
</span><span class="cx"> NSString * const _WKWebsiteDataTypeResourceLoadStatistics = @"_WKWebsiteDataTypeResourceLoadStatistics";
</span><span class="cx"> NSString * const _WKWebsiteDataTypeCredentials = @"_WKWebsiteDataTypeCredentials";
</span><ins>+NSString * const _WKWebsiteDataTypeAdClickAttributions = @"_WKWebsiteDataTypeAdClickAttributions";
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> NSString * const _WKWebsiteDataTypePlugInData = @"_WKWebsiteDataTypePlugInData";
</span><span class="lines">@@ -100,6 +101,8 @@
</span><span class="cx">         [array addObject:@"Resource Load Statistics"];
</span><span class="cx">     if ([dataTypes containsObject:_WKWebsiteDataTypeCredentials])
</span><span class="cx">         [array addObject:@"Credentials"];
</span><ins>+    if ([dataTypes containsObject:_WKWebsiteDataTypeAdClickAttributions])
+        [array addObject:@"Ad Click Attributions"];
</ins><span class="cx"> 
</span><span class="cx">     return [array componentsJoinedByString:@", "];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -74,6 +74,8 @@
</span><span class="cx">         return WebsiteDataType::ResourceLoadStatistics;
</span><span class="cx">     if ([websiteDataType isEqualToString:_WKWebsiteDataTypeCredentials])
</span><span class="cx">         return WebsiteDataType::Credentials;
</span><ins>+    if ([websiteDataType isEqualToString:_WKWebsiteDataTypeAdClickAttributions])
+        return WebsiteDataType::AdClickAttributions;
</ins><span class="cx">     return WTF::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -129,6 +131,8 @@
</span><span class="cx">         [wkWebsiteDataTypes addObject:_WKWebsiteDataTypeResourceLoadStatistics];
</span><span class="cx">     if (websiteDataTypes.contains(WebsiteDataType::Credentials))
</span><span class="cx">         [wkWebsiteDataTypes addObject:_WKWebsiteDataTypeCredentials];
</span><ins>+    if (websiteDataTypes.contains(WebsiteDataType::AdClickAttributions))
+        [wkWebsiteDataTypes addObject:_WKWebsiteDataTypeAdClickAttributions];
</ins><span class="cx"> 
</span><span class="cx">     return wkWebsiteDataTypes;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataRecordPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h     2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h        2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> WK_EXTERN NSString * const _WKWebsiteDataTypeSearchFieldRecentSearches WK_API_AVAILABLE(macos(10.12), ios(10.0));
</span><span class="cx"> WK_EXTERN NSString * const _WKWebsiteDataTypeResourceLoadStatistics WK_API_AVAILABLE(macos(10.12), ios(10.0));
</span><span class="cx"> WK_EXTERN NSString * const _WKWebsiteDataTypeCredentials WK_API_AVAILABLE(macos(10.13), ios(11.0));
</span><ins>+WK_EXTERN NSString * const _WKWebsiteDataTypeAdClickAttributions WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">     static dispatch_once_t onceToken;
</span><span class="cx">     static NSSet *allWebsiteDataTypes;
</span><span class="cx">     dispatch_once(&onceToken, ^ {
</span><del>-        auto *privateTypes = @[_WKWebsiteDataTypeHSTSCache, _WKWebsiteDataTypeMediaKeys, _WKWebsiteDataTypeSearchFieldRecentSearches, _WKWebsiteDataTypeResourceLoadStatistics, _WKWebsiteDataTypeCredentials
</del><ins>+        auto *privateTypes = @[_WKWebsiteDataTypeHSTSCache, _WKWebsiteDataTypeMediaKeys, _WKWebsiteDataTypeSearchFieldRecentSearches, _WKWebsiteDataTypeResourceLoadStatistics, _WKWebsiteDataTypeCredentials, _WKWebsiteDataTypeAdClickAttributions
</ins><span class="cx"> #if !TARGET_OS_IPHONE
</span><span class="cx">         , _WKWebsiteDataTypePlugInData
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/ChangeLog       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2019-04-23  John Wilander  <wilander@apple.com>
+
+        Remove Ad Click Attribution data when removing website data
+        https://bugs.webkit.org/show_bug.cgi?id=197215
+        <rdar://problem/47668988>
+
+        Reviewed by Chris Dumez.
+
+        This patch adds test infrastructure to delete Ad Click Attribution data
+        through WebsiteDataStore::removeData().
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::clearAdClickAttribution):
+        (WTR::TestRunner::clearAdClickAttributionsThroughWebsiteDataRemoval):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::clearAdClickAttributionsThroughWebsiteDataRemoval):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
</ins><span class="cx"> 2019-04-23  Jonathan Bedard  <jbedard@apple.com>
</span><span class="cx"> 
</span><span class="cx">         webkitpy: Kill unresponsive worker processes
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl      2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -386,6 +386,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Ad Click Attribution
</span><span class="cx">     void clearAdClickAttribution();
</span><ins>+    void clearAdClickAttributionsThroughWebsiteDataRemoval();
</ins><span class="cx">     void setAdClickAttributionOverrideTimerForTesting(boolean value);
</span><span class="cx">     void setAdClickAttributionConversionURLForTesting(DOMString url);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp       2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp  2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -2876,6 +2876,12 @@
</span><span class="cx">     WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), nullptr, nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::clearAdClickAttributionsThroughWebsiteDataRemoval()
+{
+    auto messageName = adoptWK(WKStringCreateWithUTF8CString("ClearAdClickAttributionsThroughWebsiteDataRemoval"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+}
+
</ins><span class="cx"> void TestRunner::setAdClickAttributionOverrideTimerForTesting(bool value)
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetAdClickAttributionOverrideTimerForTesting"));
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h    2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -500,6 +500,7 @@
</span><span class="cx">     // Ad Click Attribution.
</span><span class="cx">     void dumpAdClickAttribution();
</span><span class="cx">     void clearAdClickAttribution();
</span><ins>+    void clearAdClickAttributionsThroughWebsiteDataRemoval();
</ins><span class="cx">     void setAdClickAttributionOverrideTimerForTesting(bool value);
</span><span class="cx">     void setAdClickAttributionConversionURLForTesting(JSStringRef);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp  2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp     2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -3605,6 +3605,14 @@
</span><span class="cx">     runUntil(callbackContext.done, noTimeout);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestController::clearAdClickAttributionsThroughWebsiteDataRemoval()
+{
+    auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
+    AdClickAttributionVoidCallbackContext callbackContext(*this);
+    WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(dataStore, &callbackContext, adClickAttributionVoidCallback);
+    runUntil(callbackContext.done, noTimeout);
+}
+
</ins><span class="cx"> void TestController::setAdClickAttributionOverrideTimerForTesting(bool value)
</span><span class="cx"> {
</span><span class="cx">     AdClickAttributionVoidCallbackContext callbackContext(*this);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h    2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/TestController.h       2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -314,6 +314,7 @@
</span><span class="cx"> 
</span><span class="cx">     String dumpAdClickAttribution();
</span><span class="cx">     void clearAdClickAttribution();
</span><ins>+    void clearAdClickAttributionsThroughWebsiteDataRemoval();
</ins><span class="cx">     void setAdClickAttributionOverrideTimerForTesting(bool value);
</span><span class="cx">     void setAdClickAttributionConversionURLForTesting(WKURLRef);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (244571 => 244572)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp  2019-04-23 23:52:43 UTC (rev 244571)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp     2019-04-24 00:13:00 UTC (rev 244572)
</span><span class="lines">@@ -1643,7 +1643,12 @@
</span><span class="cx">         TestController::singleton().clearAdClickAttribution();
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
+    if (WKStringIsEqualToUTF8CString(messageName, "ClearAdClickAttributionsThroughWebsiteDataRemoval")) {
+        TestController::singleton().clearAdClickAttributionsThroughWebsiteDataRemoval();
+        return nullptr;
+    }
+
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, "SetAdClickAttributionOverrideTimerForTesting")) {
</span><span class="cx">         ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx">         WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
</span></span></pre>
</div>
</div>

</body>
</html>