Title: [281723] trunk
Revision
281723
Author
[email protected]
Date
2021-08-27 14:26:21 -0700 (Fri, 27 Aug 2021)

Log Message

Add UIEventAttribution SPI that uses PrivateClickMeasurementAttributionEphemeral::Yes
https://bugs.webkit.org/show_bug.cgi?id=229623

Reviewed by John Wilander.

Source/WebKit:

This will be used by rdar://80806283.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setEphemeralUIEventAttribution:]):
(-[WKWebView _ephemeralUIEventAttribution]):

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (281722 => 281723)


--- trunk/Source/WebKit/ChangeLog	2021-08-27 21:24:39 UTC (rev 281722)
+++ trunk/Source/WebKit/ChangeLog	2021-08-27 21:26:21 UTC (rev 281723)
@@ -1,5 +1,19 @@
 2021-08-27  Alex Christensen  <[email protected]>
 
+        Add UIEventAttribution SPI that uses PrivateClickMeasurementAttributionEphemeral::Yes
+        https://bugs.webkit.org/show_bug.cgi?id=229623
+
+        Reviewed by John Wilander.
+
+        This will be used by rdar://80806283.
+
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/ios/WKWebViewIOS.mm:
+        (-[WKWebView _setEphemeralUIEventAttribution:]):
+        (-[WKWebView _ephemeralUIEventAttribution]):
+
+2021-08-27  Alex Christensen  <[email protected]>
+
         Separate PrivateClickMeasurement database from ResourceLoadStatistics database and add SPI to set its location
         https://bugs.webkit.org/show_bug.cgi?id=229527
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (281722 => 281723)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-08-27 21:24:39 UTC (rev 281722)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-08-27 21:26:21 UTC (rev 281723)
@@ -422,6 +422,7 @@
 
 #if !TARGET_OS_TV && !TARGET_OS_WATCH
 @property (nonatomic, copy, setter=_setUIEventAttribution:) UIEventAttribution *_uiEventAttribution WK_API_AVAILABLE(ios(15.0));
+@property (nonatomic, copy, setter=_setEphemeralUIEventAttribution:) UIEventAttribution *_ephemeralUIEventAttribution WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #endif
 
 @property (nonatomic, readonly) CGRect _contentVisibleRect WK_API_AVAILABLE(ios(10.0));

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


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-08-27 21:24:39 UTC (rev 281722)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-08-27 21:26:21 UTC (rev 281723)
@@ -2645,6 +2645,31 @@
     return nil;
 #endif
 }
+
+- (void)_setEphemeralUIEventAttribution:(UIEventAttribution *)attribution
+{
+#if HAVE(UI_EVENT_ATTRIBUTION)
+    if (attribution) {
+        WebCore::PrivateClickMeasurement measurement(
+            WebCore::PrivateClickMeasurement::SourceID(attribution.sourceIdentifier),
+            WebCore::PrivateClickMeasurement::SourceSite(attribution.reportEndpoint),
+            WebCore::PrivateClickMeasurement::AttributionDestinationSite(attribution.destinationURL),
+            attribution.sourceDescription,
+            attribution.purchaser,
+            WallTime::now(),
+            WebCore::PrivateClickMeasurementAttributionEphemeral::Yes
+        );
+        _page->setPrivateClickMeasurement(WTFMove(measurement));
+    } else
+        _page->setPrivateClickMeasurement(std::nullopt);
+#endif
+}
+
+- (UIEventAttribution *)_ephemeralUIEventAttribution
+{
+    return self._uiEventAttribution;
+}
+
 #endif // !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
 
 - (CGRect)_contentVisibleRect

Modified: trunk/Tools/ChangeLog (281722 => 281723)


--- trunk/Tools/ChangeLog	2021-08-27 21:24:39 UTC (rev 281722)
+++ trunk/Tools/ChangeLog	2021-08-27 21:26:21 UTC (rev 281723)
@@ -1,3 +1,13 @@
+2021-08-27  Alex Christensen  <[email protected]>
+
+        Add UIEventAttribution SPI that uses PrivateClickMeasurementAttributionEphemeral::Yes
+        https://bugs.webkit.org/show_bug.cgi?id=229623
+
+        Reviewed by John Wilander.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
+        (TestWebKitAPI::TEST):
+
 2021-08-27  Yijia Huang  <[email protected]>
 
         Add a new email address to contributors.json

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm (281722 => 281723)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm	2021-08-27 21:24:39 UTC (rev 281722)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm	2021-08-27 21:26:21 UTC (rev 281723)
@@ -344,6 +344,14 @@
     });
 }
 
+TEST(EventAttribution, BasicWithEphemeralIOSSPI)
+{
+    runBasicEventAttributionTest(nil, [](WKWebView *webView, const HTTPServer& server) {
+        auto attribution = adoptNS([[MockEventAttribution alloc] initWithReportEndpoint:server.request().URL destinationURL:exampleURL()]);
+        webView._ephemeralUIEventAttribution = (UIEventAttribution *)attribution.get();
+    });
+}
+
 #endif // HAVE(UI_EVENT_ATTRIBUTION)
 
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to