Title: [283313] trunk
Revision
283313
Author
commit-qu...@webkit.org
Date
2021-09-30 08:42:31 -0700 (Thu, 30 Sep 2021)

Log Message

Clean up PrivateClickMeasurement
https://bugs.webkit.org/show_bug.cgi?id=230978

Patch by Alex Christensen <achristen...@webkit.org> on 2021-09-30
Reviewed by Kate Cheney.

Source/WebCore:

In r270669 I added sourceDescription and purchaser to PrivateClickMeasurement,
but they're actually only needed for the UIEventAttribution getter on WKWebView.
I moved them to a new struct PrivateClickMeasurementAndMetadata which stores this additional
information only on WebPageProxy instead of all the PCM infrastructure.

I reduced the size of SourceID.id to 1 byte.  Now a SourceID is always valid, so we don't need
to check after it has been created.  We still check when creating one from parsing web content,
but everywhere else we know that it is valid because of its type.

I removed the default constructor of PrivateClickMeasurement and default parameter values.
There aren't very many places where we construct one except for the tests, and it's good to see
what values we are using so we don't forget anything.

No change in behavior.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const):
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::isValid const):
(WebCore::PrivateClickMeasurement::isolatedCopy const):
(WebCore::PrivateClickMeasurement::parseAttributionRequest):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::SourceID::SourceID):
(WebCore::PrivateClickMeasurement::Priority::Priority):
(WebCore::PrivateClickMeasurement::AttributionTriggerData::AttributionTriggerData):
(WebCore::PrivateClickMeasurement::PrivateClickMeasurement):
(WebCore::PrivateClickMeasurement::isEphemeral const):
(WebCore::PrivateClickMeasurement::setEphemeral):
(WebCore::PrivateClickMeasurement::encode const):
(WebCore::PrivateClickMeasurement::decode):
(WebCore::PrivateClickMeasurement::AttributionTriggerData::decode):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::emptyValue):
(WebCore::PrivateClickMeasurement::SourceID::isValid const): Deleted.
(WebCore::PrivateClickMeasurement::sourceDescription const): Deleted.
(WebCore::PrivateClickMeasurement::purchaser const): Deleted.

Source/WebKit:

* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:]):
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setUIEventAttribution:]):
(-[WKWebView _uiEventAttribution]):
(-[WKWebView _setEphemeralUIEventAttribution:forApplicationWithBundleID:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:

Tools:

I removed the InvalidSourceID test because it is now impossible to make an invalid source ID
because it uses a uint8_t and allows the values 0-255.

* TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283312 => 283313)


--- trunk/Source/WebCore/ChangeLog	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebCore/ChangeLog	2021-09-30 15:42:31 UTC (rev 283313)
@@ -1,3 +1,46 @@
+2021-09-30  Alex Christensen  <achristen...@webkit.org>
+
+        Clean up PrivateClickMeasurement
+        https://bugs.webkit.org/show_bug.cgi?id=230978
+
+        Reviewed by Kate Cheney.
+
+        In r270669 I added sourceDescription and purchaser to PrivateClickMeasurement,
+        but they're actually only needed for the UIEventAttribution getter on WKWebView.
+        I moved them to a new struct PrivateClickMeasurementAndMetadata which stores this additional
+        information only on WebPageProxy instead of all the PCM infrastructure.
+
+        I reduced the size of SourceID.id to 1 byte.  Now a SourceID is always valid, so we don't need
+        to check after it has been created.  We still check when creating one from parsing web content,
+        but everywhere else we know that it is valid because of its type.
+
+        I removed the default constructor of PrivateClickMeasurement and default parameter values.
+        There aren't very many places where we construct one except for the tests, and it's good to see
+        what values we are using so we don't forget anything.
+
+        No change in behavior.
+
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const):
+        * loader/PrivateClickMeasurement.cpp:
+        (WebCore::PrivateClickMeasurement::isValid const):
+        (WebCore::PrivateClickMeasurement::isolatedCopy const):
+        (WebCore::PrivateClickMeasurement::parseAttributionRequest):
+        * loader/PrivateClickMeasurement.h:
+        (WebCore::PrivateClickMeasurement::SourceID::SourceID):
+        (WebCore::PrivateClickMeasurement::Priority::Priority):
+        (WebCore::PrivateClickMeasurement::AttributionTriggerData::AttributionTriggerData):
+        (WebCore::PrivateClickMeasurement::PrivateClickMeasurement):
+        (WebCore::PrivateClickMeasurement::isEphemeral const):
+        (WebCore::PrivateClickMeasurement::setEphemeral):
+        (WebCore::PrivateClickMeasurement::encode const):
+        (WebCore::PrivateClickMeasurement::decode):
+        (WebCore::PrivateClickMeasurement::AttributionTriggerData::decode):
+        (WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::emptyValue):
+        (WebCore::PrivateClickMeasurement::SourceID::isValid const): Deleted.
+        (WebCore::PrivateClickMeasurement::sourceDescription const): Deleted.
+        (WebCore::PrivateClickMeasurement::purchaser const): Deleted.
+
 2021-09-30  Alan Bujtas  <za...@apple.com>
 
         (REGRESSION r282150) Missing background-color on inline box while hovering

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (283312 => 283313)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -455,7 +455,7 @@
 #else
     String bundleID;
 #endif
-    auto privateClickMeasurement = PrivateClickMeasurement { SourceID(attributionSourceID.value()), SourceSite(WTFMove(documentRegistrableDomain)), AttributionDestinationSite(destinationURL), bundleID };
+    auto privateClickMeasurement = PrivateClickMeasurement { SourceID(attributionSourceID.value()), SourceSite(WTFMove(documentRegistrableDomain)), AttributionDestinationSite(destinationURL), bundleID, WallTime::now(), PrivateClickMeasurement::AttributionEphemeral::No };
 
     auto attributionSourceNonceAttr = attributeWithoutSynchronization(attributionsourcenonceAttr);
     if (!attributionSourceNonceAttr.isEmpty()) {

Modified: trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp (283312 => 283313)


--- trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -54,7 +54,6 @@
 {
     return m_attributionTriggerData
         && m_attributionTriggerData.value().isValid()
-        && m_sourceID.isValid()
         && !m_sourceSite.registrableDomain.isEmpty()
         && !m_destinationSite.registrableDomain.isEmpty()
         && (m_timesToSend.sourceEarliestTimeToSend || m_timesToSend.destinationEarliestTimeToSend);
@@ -88,20 +87,19 @@
 
 PrivateClickMeasurement PrivateClickMeasurement::isolatedCopy() const
 {
-    PrivateClickMeasurement copy;
-    copy.m_sourceID = m_sourceID;
-    copy.m_sourceSite = m_sourceSite.isolatedCopy();
-    copy.m_destinationSite = m_destinationSite.isolatedCopy();
-    copy.m_sourceDescription = m_sourceDescription.isolatedCopy();
-    copy.m_purchaser = m_purchaser.isolatedCopy();
-    copy.m_timeOfAdClick = m_timeOfAdClick.isolatedCopy();
-    copy.m_isEphemeral = m_isEphemeral;
+    PrivateClickMeasurement copy {
+        m_sourceID,
+        m_sourceSite.isolatedCopy(),
+        m_destinationSite.isolatedCopy(),
+        m_sourceApplicationBundleID.isolatedCopy(),
+        m_timeOfAdClick.isolatedCopy(),
+        m_isEphemeral,
+    };
     copy.m_attributionTriggerData = m_attributionTriggerData;
     copy.m_timesToSend = m_timesToSend;
     copy.m_ephemeralSourceNonce = crossThreadCopy(m_ephemeralSourceNonce);
     copy.m_sourceUnlinkableToken = m_sourceUnlinkableToken.isolatedCopy();
     copy.m_sourceSecretToken = crossThreadCopy(m_sourceSecretToken);
-    copy.m_sourceApplicationBundleID = m_sourceApplicationBundleID.isolatedCopy();
     return copy;
 }
 
@@ -121,7 +119,7 @@
         if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy)
             return makeUnexpected(makeString("[Private Click Measurement] Conversion was not accepted because the conversion data could not be parsed or was higher than the allowed maximum of "_s, AttributionTriggerData::MaxEntropy, "."_s));
 
-        return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { 0 } };
+        return AttributionTriggerData { static_cast<uint8_t>(*attributionTriggerDataUInt64), Priority { 0 } };
     }
     
     if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1 + privateClickMeasurementPriorityPathSegmentSize) {
@@ -133,7 +131,7 @@
         if (!attributionPriorityUInt64 || *attributionPriorityUInt64 > Priority::MaxEntropy)
             return makeUnexpected(makeString("[Private Click Measurement] Conversion was not accepted because the priority could not be parsed or was higher than the allowed maximum of "_s, Priority::MaxEntropy, "."_s));
 
-        return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { static_cast<uint32_t>(*attributionPriorityUInt64) } };
+        return AttributionTriggerData { static_cast<uint8_t>(*attributionTriggerDataUInt64), Priority { static_cast<uint8_t>(*attributionPriorityUInt64) } };
     }
 
     return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts."_s);

Modified: trunk/Source/WebCore/loader/PrivateClickMeasurement.h (283312 => 283313)


--- trunk/Source/WebCore/loader/PrivateClickMeasurement.h	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebCore/loader/PrivateClickMeasurement.h	2021-09-30 15:42:31 UTC (rev 283313)
@@ -47,34 +47,25 @@
 
 namespace WebCore {
 
-enum class PrivateClickMeasurementAttributionEphemeral : bool { No, Yes };
-
 class PrivateClickMeasurement {
 public:
-    using PriorityValue = uint32_t;
+    using PriorityValue = uint8_t;
+    enum class AttributionEphemeral : bool { No, Yes };
 
     enum class PcmDataCarried : bool { NonPersonallyIdentifiable, PersonallyIdentifiable };
     enum class AttributionReportEndpoint : bool { Source, Destination };
 
     struct SourceID {
-        static constexpr uint32_t MaxEntropy = 255;
-
-        SourceID() = default;
-        explicit SourceID(uint32_t id)
+        static constexpr uint8_t MaxEntropy = 255;
+        explicit SourceID(uint8_t id)
             : id { id }
         {
         }
-        
-        bool isValid() const
-        {
-            return id <= MaxEntropy;
-        }
-        
-        uint32_t id { 0 };
+
+        uint8_t id { 0 };
     };
 
     struct SourceSite {
-        SourceSite() = default;
         explicit SourceSite(const URL& url)
             : registrableDomain { url }
         {
@@ -166,10 +157,10 @@
     };
 
     struct Priority {
-        static constexpr uint32_t MaxEntropy = 63;
+        static constexpr uint8_t MaxEntropy = 63;
 
         explicit Priority(PriorityValue value)
-        : value { value }
+            : value { value }
         {
         }
         
@@ -177,11 +168,11 @@
     };
     
     struct AttributionTriggerData {
-        static constexpr uint32_t MaxEntropy = 15;
+        static constexpr uint8_t MaxEntropy = 15;
 
         enum class WasSent : bool { No, Yes };
         
-        AttributionTriggerData(uint32_t data, Priority priority, WasSent wasSent = WasSent::No)
+        AttributionTriggerData(uint8_t data, Priority priority, WasSent wasSent = WasSent::No)
             : data { data }
             , priority { priority.value }
             , wasSent { wasSent }
@@ -193,7 +184,7 @@
             return data <= MaxEntropy && priority <= Priority::MaxEntropy;
         }
         
-        uint32_t data;
+        uint8_t data { 0 };
         PriorityValue priority;
         WasSent wasSent = WasSent::No;
 
@@ -311,13 +302,10 @@
         }
     };
 
-    PrivateClickMeasurement() = default;
-    PrivateClickMeasurement(SourceID sourceID, const SourceSite& sourceSite, const AttributionDestinationSite& destinationSite, const String& sourceApplicationBundleID, String&& sourceDescription = { }, String&& purchaser = { }, WallTime timeOfAdClick = WallTime::now(), PrivateClickMeasurementAttributionEphemeral isEphemeral = PrivateClickMeasurementAttributionEphemeral::No)
+    PrivateClickMeasurement(SourceID sourceID, const SourceSite& sourceSite, const AttributionDestinationSite& destinationSite, const String& sourceApplicationBundleID, WallTime timeOfAdClick, AttributionEphemeral isEphemeral)
         : m_sourceID { sourceID }
         , m_sourceSite { sourceSite }
         , m_destinationSite { destinationSite }
-        , m_sourceDescription { WTFMove(sourceDescription) }
-        , m_purchaser { WTFMove(purchaser) }
         , m_timeOfAdClick { timeOfAdClick }
         , m_isEphemeral { isEphemeral }
         , m_sourceApplicationBundleID { sourceApplicationBundleID }
@@ -342,10 +330,8 @@
     void setAttribution(AttributionTriggerData&& attributionTriggerData) { m_attributionTriggerData = WTFMove(attributionTriggerData); }
     const String& sourceApplicationBundleID() const { return m_sourceApplicationBundleID; }
 
-    const String& sourceDescription() const { return m_sourceDescription; }
-    const String& purchaser() const { return m_purchaser; }
-    bool isEphemeral() const { return m_isEphemeral == PrivateClickMeasurementAttributionEphemeral::Yes; }
-    void setEphemeral(PrivateClickMeasurementAttributionEphemeral isEphemeral) { m_isEphemeral = isEphemeral; }
+    bool isEphemeral() const { return m_isEphemeral == AttributionEphemeral::Yes; }
+    void setEphemeral(AttributionEphemeral isEphemeral) { m_isEphemeral = isEphemeral; }
 
     // MARK: - Fraud Prevention
     WEBCORE_EXPORT URL tokenPublicKeyURL() const;
@@ -397,10 +383,8 @@
     SourceID m_sourceID;
     SourceSite m_sourceSite;
     AttributionDestinationSite m_destinationSite;
-    String m_sourceDescription;
-    String m_purchaser;
     WallTime m_timeOfAdClick;
-    PrivateClickMeasurementAttributionEphemeral m_isEphemeral;
+    AttributionEphemeral m_isEphemeral;
 
     std::optional<AttributionTriggerData> m_attributionTriggerData;
     AttributionTimeToSendData m_timesToSend;
@@ -428,8 +412,6 @@
     encoder << m_sourceID.id
         << m_sourceSite.registrableDomain
         << m_destinationSite.registrableDomain
-        << m_sourceDescription
-        << m_purchaser
         << m_timeOfAdClick
         << m_ephemeralSourceNonce
         << m_isEphemeral
@@ -441,7 +423,7 @@
 template<class Decoder>
 std::optional<PrivateClickMeasurement> PrivateClickMeasurement::decode(Decoder& decoder)
 {
-    std::optional<uint32_t> sourceID;
+    std::optional<uint8_t> sourceID;
     decoder >> sourceID;
     if (!sourceID)
         return std::nullopt;
@@ -456,16 +438,6 @@
     if (!destinationRegistrableDomain)
         return std::nullopt;
     
-    std::optional<String> sourceDescription;
-    decoder >> sourceDescription;
-    if (!sourceDescription)
-        return std::nullopt;
-    
-    std::optional<String> purchaser;
-    decoder >> purchaser;
-    if (!purchaser)
-        return std::nullopt;
-    
     std::optional<WallTime> timeOfAdClick;
     decoder >> timeOfAdClick;
     if (!timeOfAdClick)
@@ -476,7 +448,7 @@
     if (!ephemeralSourceNonce)
         return std::nullopt;
 
-    std::optional<PrivateClickMeasurementAttributionEphemeral> isEphemeral;
+    std::optional<AttributionEphemeral> isEphemeral;
     decoder >> isEphemeral;
     if (!isEphemeral)
         return std::nullopt;
@@ -501,8 +473,6 @@
         SourceSite { WTFMove(*sourceRegistrableDomain) },
         AttributionDestinationSite { WTFMove(*destinationRegistrableDomain) },
         WTFMove(*sourceApplicationBundleID),
-        WTFMove(*sourceDescription),
-        WTFMove(*purchaser),
         WTFMove(*timeOfAdClick),
         WTFMove(*isEphemeral)
     };
@@ -539,7 +509,7 @@
 template<class Decoder>
 std::optional<PrivateClickMeasurement::AttributionTriggerData> PrivateClickMeasurement::AttributionTriggerData::decode(Decoder& decoder)
 {
-    std::optional<uint32_t> data;
+    std::optional<uint8_t> data;
     decoder >> data;
     if (!data)
         return std::nullopt;
@@ -564,7 +534,7 @@
 
 template<> struct DefaultHash<WebCore::PrivateClickMeasurement::SourceSite> : WebCore::PrivateClickMeasurement::SourceSiteHash { };
 template<> struct HashTraits<WebCore::PrivateClickMeasurement::SourceSite> : GenericHashTraits<WebCore::PrivateClickMeasurement::SourceSite> {
-    static WebCore::PrivateClickMeasurement::SourceSite emptyValue() { return { }; }
+    static WebCore::PrivateClickMeasurement::SourceSite emptyValue() { return WebCore::PrivateClickMeasurement::SourceSite(WebCore::RegistrableDomain()); }
     static void constructDeletedValue(WebCore::PrivateClickMeasurement::SourceSite& slot) { new (NotNull, &slot.registrableDomain) WebCore::RegistrableDomain(WTF::HashTableDeletedValue); }
     static bool isDeletedValue(const WebCore::PrivateClickMeasurement::SourceSite& slot) { return slot.registrableDomain.isHashTableDeletedValue(); }
 };

Modified: trunk/Source/WebKit/ChangeLog (283312 => 283313)


--- trunk/Source/WebKit/ChangeLog	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/ChangeLog	2021-09-30 15:42:31 UTC (rev 283313)
@@ -1,3 +1,25 @@
+2021-09-30  Alex Christensen  <achristen...@webkit.org>
+
+        Clean up PrivateClickMeasurement
+        https://bugs.webkit.org/show_bug.cgi?id=230978
+
+        Reviewed by Kate Cheney.
+
+        * NetworkProcess/DatabaseUtilities.cpp:
+        (WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase const):
+        * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
+        (WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
+        * UIProcess/API/Cocoa/WKWebViewTesting.mm:
+        (-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:]):
+        * UIProcess/API/ios/WKWebViewIOS.mm:
+        (-[WKWebView _setUIEventAttribution:]):
+        (-[WKWebView _uiEventAttribution]):
+        (-[WKWebView _setEphemeralUIEventAttribution:forApplicationWithBundleID:]):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+        (WebKit::WebPageProxy::createNewPage):
+        * UIProcess/WebPageProxy.h:
+
 2021-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][a11y] Connect UI process a11y tree with the web process when building with ATSPI

Modified: trunk/Source/WebKit/NetworkProcess/DatabaseUtilities.cpp (283312 => 283313)


--- trunk/Source/WebKit/NetworkProcess/DatabaseUtilities.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/NetworkProcess/DatabaseUtilities.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -158,7 +158,7 @@
     if (bundleID.isEmpty())
         bundleID = safariBundleID;
 
-    WebCore::PrivateClickMeasurement attribution(WebCore::PrivateClickMeasurement::SourceID(sourceID), WebCore::PrivateClickMeasurement::SourceSite(WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString(sourceSiteDomain)), WebCore::PrivateClickMeasurement::AttributionDestinationSite(WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString(destinationSiteDomain)), bundleID, { }, { }, WallTime::fromRawSeconds(timeOfAdClick));
+    WebCore::PrivateClickMeasurement attribution(WebCore::PrivateClickMeasurement::SourceID(sourceID), WebCore::PrivateClickMeasurement::SourceSite(WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString(sourceSiteDomain)), WebCore::PrivateClickMeasurement::AttributionDestinationSite(WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString(destinationSiteDomain)), bundleID, WallTime::fromRawSeconds(timeOfAdClick), WebCore::PrivateClickMeasurement::AttributionEphemeral::No);
 
     if (attributionType == PrivateClickMeasurementAttributionType::Attributed) {
         auto attributionTriggerData = statement.columnInt(3);
@@ -167,7 +167,7 @@
         auto destinationEarliestTimeToSendValue = statement.columnDouble(10);
 
         if (attributionTriggerData != -1)
-            attribution.setAttribution(WebCore::PrivateClickMeasurement::AttributionTriggerData { static_cast<uint32_t>(attributionTriggerData), WebCore::PrivateClickMeasurement::Priority(priority) });
+            attribution.setAttribution(WebCore::PrivateClickMeasurement::AttributionTriggerData { static_cast<uint8_t>(attributionTriggerData), WebCore::PrivateClickMeasurement::Priority(priority) });
 
         std::optional<WallTime> sourceEarliestTimeToSend;
         std::optional<WallTime> destinationEarliestTimeToSend;

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp (283312 => 283313)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -217,7 +217,7 @@
 void PrivateClickMeasurementManager::insertPrivateClickMeasurement(PrivateClickMeasurement&& measurement, PrivateClickMeasurementAttributionType type)
 {
     if (m_isRunningEphemeralMeasurementTest)
-        measurement.setEphemeral(PrivateClickMeasurementAttributionEphemeral::Yes);
+        measurement.setEphemeral(PrivateClickMeasurement::AttributionEphemeral::Yes);
     if (measurement.isEphemeral()) {
         m_ephemeralMeasurement = WTFMove(measurement);
         return;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm (283312 => 283313)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm	2021-09-30 15:42:31 UTC (rev 283313)
@@ -62,13 +62,13 @@
         WebCore::PrivateClickMeasurement::SourceSite(reportEndpoint),
         WebCore::PrivateClickMeasurement::AttributionDestinationSite(destination),
         bundleID,
-        sourceDescription,
-        purchaser
+        WallTime::now(),
+        WebCore::PrivateClickMeasurement::AttributionEphemeral::No
     );
     if (nonce)
         measurement.setEphemeralSourceNonce({ nonce });
 
-    _page->setPrivateClickMeasurement(WTFMove(measurement));
+    _page->setPrivateClickMeasurement({{ WTFMove(measurement), { }, { }}});
 }
 
 - (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (283312 => 283313)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-09-30 15:42:31 UTC (rev 283313)
@@ -2633,10 +2633,10 @@
             WebCore::PrivateClickMeasurement::SourceSite(attribution.reportEndpoint),
             WebCore::PrivateClickMeasurement::AttributionDestinationSite(attribution.destinationURL),
             WebCore::applicationBundleIdentifier(),
-            attribution.sourceDescription,
-            attribution.purchaser
+            WallTime::now(),
+            WebCore::PrivateClickMeasurement::AttributionEphemeral::No
         );
-        _page->setPrivateClickMeasurement(WTFMove(measurement));
+        _page->setPrivateClickMeasurement({{ WTFMove(measurement), attribution.sourceDescription, attribution.purchaser }});
     } else
         _page->setPrivateClickMeasurement(std::nullopt);
 #endif
@@ -2646,11 +2646,11 @@
 {
 #if HAVE(UI_EVENT_ATTRIBUTION)
     auto& measurement = _page->privateClickMeasurement();
-    if (!measurement || !measurement->sourceID().isValid())
+    if (!measurement)
         return nil;
 
-    auto destinationURL = URL(URL(), makeString("https://", measurement->destinationSite().registrableDomain.string()));
-    return adoptNS([[UIEventAttribution alloc] initWithSourceIdentifier:measurement->sourceID().id destinationURL:destinationURL sourceDescription:measurement->sourceDescription() purchaser:measurement->purchaser()]).autorelease();
+    auto destinationURL = URL(URL(), makeString("https://", measurement->pcm.destinationSite().registrableDomain.string()));
+    return adoptNS([[UIEventAttribution alloc] initWithSourceIdentifier:measurement->pcm.sourceID().id destinationURL:destinationURL sourceDescription:measurement->sourceDescription purchaser:measurement->purchaser]).autorelease();
 #else
     return nil;
 #endif
@@ -2671,12 +2671,10 @@
             WebCore::PrivateClickMeasurement::SourceSite(attribution.reportEndpoint),
             WebCore::PrivateClickMeasurement::AttributionDestinationSite(attribution.destinationURL),
             bundleID,
-            attribution.sourceDescription,
-            attribution.purchaser,
             WallTime::now(),
-            WebCore::PrivateClickMeasurementAttributionEphemeral::Yes
+            WebCore::PrivateClickMeasurement::AttributionEphemeral::Yes
         );
-        _page->setPrivateClickMeasurement(WTFMove(measurement));
+        _page->setPrivateClickMeasurement({{ WTFMove(measurement), attribution.sourceDescription, attribution.purchaser }});
     } else
         _page->setPrivateClickMeasurement(std::nullopt);
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (283312 => 283313)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -4926,7 +4926,7 @@
     if (frame->isMainFrame()) {
         std::optional<WebCore::PrivateClickMeasurement> privateClickMeasurement;
         if (m_privateClickMeasurement)
-            privateClickMeasurement = m_privateClickMeasurement;
+            privateClickMeasurement = m_privateClickMeasurement->pcm;
         else if (navigation && navigation->privateClickMeasurement())
             privateClickMeasurement = navigation->privateClickMeasurement();
         if (privateClickMeasurement) {
@@ -5846,7 +5846,8 @@
 
         newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = mainFrameURL.host() == request.url().host();
 
-        newPage->m_privateClickMeasurement = privateClickMeasurement;
+        if (privateClickMeasurement)
+            newPage->m_privateClickMeasurement = {{ WTFMove(*privateClickMeasurement), { }, { }}};
 #if HAVE(APP_SSO)
         newPage->m_shouldSuppressSOAuthorizationInNextNavigationPolicyDecision = true;
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (283312 => 283313)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-09-30 15:42:31 UTC (rev 283313)
@@ -716,8 +716,13 @@
     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
     bool delegatesScrolling() const { return m_delegatesScrolling; }
 
-    void setPrivateClickMeasurement(std::optional<WebCore::PrivateClickMeasurement>&& measurement) { m_privateClickMeasurement = WTFMove(measurement); }
-    const std::optional<WebCore::PrivateClickMeasurement>& privateClickMeasurement() const { return m_privateClickMeasurement; }
+    struct PrivateClickMeasurementAndMetadata {
+        WebCore::PrivateClickMeasurement pcm;
+        String sourceDescription;
+        String purchaser;
+    };
+    void setPrivateClickMeasurement(std::optional<PrivateClickMeasurementAndMetadata>&& measurement) { m_privateClickMeasurement = WTFMove(measurement); }
+    const std::optional<PrivateClickMeasurementAndMetadata>& privateClickMeasurement() const { return m_privateClickMeasurement; }
 
     enum class ActivityStateChangeDispatchMode : bool { Deferrable, Immediate };
     enum class ActivityStateChangeReplyMode : bool { Asynchronous, Synchronous };
@@ -3086,7 +3091,7 @@
     bool m_isRunningModalJavaScriptDialog { false };
     bool m_isSuspended { false };
 
-    std::optional<WebCore::PrivateClickMeasurement> m_privateClickMeasurement;
+    std::optional<PrivateClickMeasurementAndMetadata> m_privateClickMeasurement;
 
 #if ENABLE(WEBXR) && !USE(OPENXR)
     std::unique_ptr<PlatformXRSystem> m_xrSystem;

Modified: trunk/Tools/ChangeLog (283312 => 283313)


--- trunk/Tools/ChangeLog	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Tools/ChangeLog	2021-09-30 15:42:31 UTC (rev 283313)
@@ -1,3 +1,18 @@
+2021-09-30  Alex Christensen  <achristen...@webkit.org>
+
+        Clean up PrivateClickMeasurement
+        https://bugs.webkit.org/show_bug.cgi?id=230978
+
+        Reviewed by Kate Cheney.
+
+        I removed the InvalidSourceID test because it is now impossible to make an invalid source ID
+        because it uses a uint8_t and allows the values 0-255.
+
+        * TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
+        (TestWebKitAPI::TEST):
+
 2021-09-29  Alex Christensen  <achristen...@webkit.org>
 
         Terminate PCM daemon before and after unit test that uses it

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp (283312 => 283313)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp	2021-09-30 15:42:31 UTC (rev 283313)
@@ -44,7 +44,7 @@
 
 TEST(PrivateClickMeasurement, WellKnownURLs)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(min6BitValue), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(min6BitValue), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(min6BitValue, PrivateClickMeasurement::Priority(min6BitValue)));
 
     auto attributionSourceURL = attribution.attributionReportSourceURL();
@@ -55,7 +55,7 @@
 
 TEST(PrivateClickMeasurement, ValidMinValues)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(min6BitValue), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(min6BitValue), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(min6BitValue, PrivateClickMeasurement::Priority(min6BitValue)));
 
     ASSERT_EQ(attribution.attributionReportJSON()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":0,\"attributed_on_site\":\"example.com\",\"trigger_data\":0,\"version\":2}");
@@ -63,7 +63,7 @@
 
 TEST(PrivateClickMeasurement, ValidMidValues)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID((uint32_t)192), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID((uint32_t)192), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData((uint32_t)9, PrivateClickMeasurement::Priority((uint32_t)22)));
 
     ASSERT_EQ(attribution.attributionReportJSON()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":192,\"attributed_on_site\":\"example.com\",\"trigger_data\":9,\"version\":2}");
@@ -71,7 +71,7 @@
 
 TEST(PrivateClickMeasurement, ValidMaxValues)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
 
     ASSERT_EQ(attribution.attributionReportJSON()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":255,\"attributed_on_site\":\"example.com\",\"trigger_data\":15,\"version\":2}");
@@ -79,7 +79,7 @@
 
 TEST(PrivateClickMeasurement, EarliestTimeToSendAttributionMinimumDelay)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     auto now = WallTime::now();
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
     auto earliestTimeToSend = attribution.timesToSend();
@@ -132,18 +132,9 @@
 
 // Negative test cases.
 
-TEST(PrivateClickMeasurement, InvalidSourceID)
-{
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy + 1), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
-    attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
-
-    ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
-    ASSERT_TRUE(attribution.attributionReportAttributeOnURL().isEmpty());
-}
-
 TEST(PrivateClickMeasurement, InvalidSourceHost)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { emptyURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { emptyURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
 
     ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
@@ -152,7 +143,7 @@
 
 TEST(PrivateClickMeasurement, InvalidDestinationHost)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy + 1), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { emptyURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { emptyURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
 
     ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
@@ -161,7 +152,7 @@
 
 TEST(PrivateClickMeasurement, AttributionTriggerData)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData((PrivateClickMeasurement::AttributionTriggerData::MaxEntropy + 1), PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy)));
 
     ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
@@ -170,7 +161,7 @@
 
 TEST(PrivateClickMeasurement, InvalidPriority)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
     attribution.attributeAndGetEarliestTimeToSend(PrivateClickMeasurement::AttributionTriggerData(PrivateClickMeasurement::AttributionTriggerData::MaxEntropy, PrivateClickMeasurement::Priority(PrivateClickMeasurement::Priority::MaxEntropy + 1)));
 
     ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
@@ -179,7 +170,7 @@
 
 TEST(PrivateClickMeasurement, InvalidMissingConversion)
 {
-    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier" };
+    PrivateClickMeasurement attribution { PrivateClickMeasurement::SourceID(PrivateClickMeasurement::SourceID::MaxEntropy), PrivateClickMeasurement::SourceSite { webKitURL }, PrivateClickMeasurement::AttributionDestinationSite { exampleURL }, "test.bundle.identifier", WallTime::now(), WebCore::PrivateClickMeasurement::AttributionEphemeral::No };
 
     ASSERT_TRUE(attribution.attributionReportSourceURL().isEmpty());
     ASSERT_TRUE(attribution.attributionReportAttributeOnURL().isEmpty());
@@ -312,7 +303,14 @@
 {
     const char serverPublicKeyBase64URL[] = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzb1dThrtYwVh46SjInegKhAqpbJwm1XnTBCvybSK8zk53R0Am1hG33AVF5J1lqYf36wp663GasclHtqzvxFZIvDA1DUSH4aZz_fDHCTTxEeJVPORS3zNN2UjWwbtnwsh4BmDTi-z_cDn0LAz2JuZyKlyFt5GgVLAQvL9H3VLHU9_XHNK-uboyXfcHRTtrDnpu3c6wvX5dd-AJoLmIQTZBEJfVkxBGznk1qKHjc6nASAirKF_wJCnuwAK8C6BAcjNcwUWCeKp0YECzCXU--JXd2OEU-QhxPC67faiDOh3V0vlfqZLtrlbnanUCKrvhw7GaGOGYotIrnZtuNfxC14d_XNVd1FS8nHjRTHnEgw_jnlSssfgStz0uJtcmkfgoJBvOE4mIRpi7iSlRfXNkKsWX1J-gwcnCVo5u0uJEW6X6NyvEGYJ8w5BPfwsQuK9y-4Z7ikt9IOucEHY7ThDmi9TNNhHBVj0Gu4wGoSjq3a6vL5N10ZSHXoq1XgfGPrmHhhL90cjvWonoyOXsUqlXEzTjD2W9897Q-Mx9BUNrGQPqmIx8F5MwxWcOrye8WRp4Q88n2YSUnV7C8ayld3v1Fh7N5jeSqeVmtDVRYTn2sVfNqgXrzgdigJcQR8vFENu6nzFPwsrXPMaCiLUnZNUmQ1ZSLQeQyhYXxHqRJrnuCDWXLkCAwEAAQ";
 
-    PrivateClickMeasurement pcm;
+    WebCore::PrivateClickMeasurement pcm(
+        WebCore::PrivateClickMeasurement::SourceID({ }),
+        WebCore::PrivateClickMeasurement::SourceSite(URL()),
+        WebCore::PrivateClickMeasurement::AttributionDestinationSite(URL()),
+        { },
+        WallTime::now(),
+        WebCore::PrivateClickMeasurement::AttributionEphemeral::No
+    );
     auto sourceUnlinkableToken = pcm.tokenSignatureJSON();
     EXPECT_EQ(sourceUnlinkableToken->asObject()->size(), 0ul);
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/PrivateClickMeasurementCocoa.mm (283312 => 283313)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/PrivateClickMeasurementCocoa.mm	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/PrivateClickMeasurementCocoa.mm	2021-09-30 15:42:31 UTC (rev 283313)
@@ -42,7 +42,14 @@
     auto ephemeralNonce = PrivateClickMeasurement::EphemeralSourceNonce { "ABCDEFabcdef0123456789"_s };
     EXPECT_TRUE(ephemeralNonce.isValid());
 
-    PrivateClickMeasurement pcm;
+    WebCore::PrivateClickMeasurement pcm(
+        WebCore::PrivateClickMeasurement::SourceID({ }),
+        WebCore::PrivateClickMeasurement::SourceSite(URL()),
+        WebCore::PrivateClickMeasurement::AttributionDestinationSite(URL()),
+        { },
+        WallTime::now(),
+        WebCore::PrivateClickMeasurement::AttributionEphemeral::No
+    );
     pcm.setEphemeralSourceNonce(WTFMove(ephemeralNonce));
 
     // Generate the server key pair.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm (283312 => 283313)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm	2021-09-30 15:26:21 UTC (rev 283312)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm	2021-09-30 15:42:31 UTC (rev 283313)
@@ -493,6 +493,8 @@
     runBasicEventAttributionTest(nil, [](WKWebView *webView, const HTTPServer& server) {
         auto attribution = adoptNS([[MockEventAttribution alloc] initWithReportEndpoint:server.request().URL destinationURL:exampleURL()]);
         webView._uiEventAttribution = (UIEventAttribution *)attribution.get();
+        EXPECT_WK_STREQ(webView._uiEventAttribution.sourceDescription, "test source description");
+        EXPECT_WK_STREQ(webView._uiEventAttribution.purchaser, "test purchaser");
     });
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to