Title: [285313] branches/safari-612-branch/Source

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285312 => 285313)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-04 21:37:26 UTC (rev 285312)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-04 21:39:52 UTC (rev 285313)
@@ -1,5 +1,26 @@
 2021-11-04  Russell Epstein  <[email protected]>
 
+        Apply patch. rdar://problem/80991209
+
+    2021-11-04  Kate Cheney  <[email protected]>
+
+            PCM: Safari on iOS and macOS are not sending ad click attribution reports for Private Click Measurement
+            https://bugs.webkit.org/show_bug.cgi?id=228104
+            <rdar://problem/80991209>
+
+            Reviewed by John Wilander.
+
+            No new tests. Several existing tests would timeout with the removal of
+            m_firePendingAttributionRequestsTimer.startOneShot(m_isRunningTest ? 0_s : seconds)
+            if the fix wasn't in place.
+
+            * loader/PrivateClickMeasurement.cpp:
+            (WebCore::randomlyBetweenTwentyFourAndFortyEightHours):
+            (WebCore::PrivateClickMeasurement::attributeAndGetEarliestTimeToSend):
+            * loader/PrivateClickMeasurement.h:
+
+2021-11-04  Russell Epstein  <[email protected]>
+
         Cherry-pick r285089. rdar://problem/84522357
 
     Layer tree should not be stuck in frozen state after explicitly stopping a page load

Modified: branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp (285312 => 285313)


--- branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-11-04 21:37:26 UTC (rev 285312)
+++ branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-11-04 21:39:52 UTC (rev 285313)
@@ -148,12 +148,12 @@
     m_sourceApplicationBundleID = appBundleIDForTesting;
 }
 
-static Seconds randomlyBetweenTwentyFourAndFortyEightHours()
+static Seconds randomlyBetweenTwentyFourAndFortyEightHours(PrivateClickMeasurement::IsRunningLayoutTest isRunningTest)
 {
-    return 24_h + Seconds(randomNumber() * (24_h).value());
+    return isRunningTest == PrivateClickMeasurement::IsRunningLayoutTest::Yes ? 1_s : 24_h + Seconds(randomNumber() * (24_h).value());
 }
 
-PrivateClickMeasurement::AttributionSecondsUntilSendData PrivateClickMeasurement::attributeAndGetEarliestTimeToSend(AttributionTriggerData&& attributionTriggerData)
+PrivateClickMeasurement::AttributionSecondsUntilSendData PrivateClickMeasurement::attributeAndGetEarliestTimeToSend(AttributionTriggerData&& attributionTriggerData, IsRunningLayoutTest isRunningTest)
 {
     if (!attributionTriggerData.isValid() || (m_attributionTriggerData && m_attributionTriggerData->priority >= attributionTriggerData.priority))
         return { };
@@ -161,8 +161,8 @@
     m_attributionTriggerData = WTFMove(attributionTriggerData);
     // 24-48 hour delay before sending. This helps privacy since the conversion and the attribution
     // requests are detached and the time of the attribution does not reveal the time of the conversion.
-    auto sourceSecondsUntilSend = randomlyBetweenTwentyFourAndFortyEightHours();
-    auto destinationSecondsUntilSend = randomlyBetweenTwentyFourAndFortyEightHours();
+    auto sourceSecondsUntilSend = randomlyBetweenTwentyFourAndFortyEightHours(isRunningTest);
+    auto destinationSecondsUntilSend = randomlyBetweenTwentyFourAndFortyEightHours(isRunningTest);
     m_timesToSend = { WallTime::now() + sourceSecondsUntilSend, WallTime::now() + destinationSecondsUntilSend };
 
     return AttributionSecondsUntilSendData { sourceSecondsUntilSend, destinationSecondsUntilSend };

Modified: branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.h (285312 => 285313)


--- branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.h	2021-11-04 21:37:26 UTC (rev 285312)
+++ branches/safari-612-branch/Source/WebCore/loader/PrivateClickMeasurement.h	2021-11-04 21:39:52 UTC (rev 285313)
@@ -55,6 +55,7 @@
 
     enum class PcmDataCarried : bool { NonPersonallyIdentifiable, PersonallyIdentifiable };
     enum class AttributionReportEndpoint : bool { Source, Destination };
+    enum class IsRunningLayoutTest : bool { No, Yes };
 
     struct SourceID {
         static constexpr uint32_t MaxEntropy = 255;
@@ -326,7 +327,7 @@
 
     WEBCORE_EXPORT static const Seconds maxAge();
     WEBCORE_EXPORT static Expected<AttributionTriggerData, String> parseAttributionRequest(const URL& redirectURL);
-    WEBCORE_EXPORT AttributionSecondsUntilSendData attributeAndGetEarliestTimeToSend(AttributionTriggerData&&);
+    WEBCORE_EXPORT AttributionSecondsUntilSendData attributeAndGetEarliestTimeToSend(AttributionTriggerData&&, IsRunningLayoutTest);
     WEBCORE_EXPORT bool hasHigherPriorityThan(const PrivateClickMeasurement&) const;
     WEBCORE_EXPORT URL attributionReportSourceURL() const;
     WEBCORE_EXPORT URL attributionReportAttributeOnURL() const;

Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (285312 => 285313)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-11-04 21:37:26 UTC (rev 285312)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-11-04 21:39:52 UTC (rev 285313)
@@ -1,5 +1,42 @@
 2021-11-04  Russell Epstein  <[email protected]>
 
+        Apply patch. rdar://problem/80991209
+
+    2021-11-04  Kate Cheney  <[email protected]>
+
+            PCM: Safari on iOS and macOS are not sending ad click attribution reports for Private Click Measurement
+            https://bugs.webkit.org/show_bug.cgi?id=228104
+            <rdar://problem/80991209>
+
+            Reviewed by John Wilander.
+
+            firePendingAttributionRequests() was sometimes scheduling the next timer
+            fire to be the raw time value instead of the difference between now
+            and the scheduled send time. This was resulting in some reports not being
+            sent within the 24-48 hour range.
+
+            To test this, this patch removes the immediate timer fire for testing
+            and instead sets the earliest time to send values to both be 1 second.
+            This will test that the proper timer gets set to send both reports.
+
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
+            (WebKit::PCM::Database::attributePrivateClickMeasurement):
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
+            (WebKit::PrivateClickMeasurementManager::startTimer):
+            (WebKit::PrivateClickMeasurementManager::attribute):
+            (WebKit::PrivateClickMeasurementManager::randomlyBetweenFifteenAndThirtyMinutes const):
+            (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
+            In the case of both times being past due to report, schedule one for
+            15 - 30 minutes later.
+
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp:
+            (WebKit::PCM::Store::attributePrivateClickMeasurement):
+            * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h:
+
+2021-11-04  Russell Epstein  <[email protected]>
+
         Cherry-pick r285177. rdar://problem/85033636
 
     Terminate unresponsive network process by crashing it
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to