Modified: trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp (271472 => 271473)
--- trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp 2021-01-14 00:07:24 UTC (rev 271472)
+++ trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp 2021-01-14 00:10:07 UTC (rev 271473)
@@ -61,25 +61,15 @@
if (path.isEmpty() || !path.startsWith(privateClickMeasurementPathPrefix))
return makeUnexpected(nullString());
- if (!redirectURL.protocolIs("https") || redirectURL.hasCredentials() || redirectURL.hasQuery() || redirectURL.hasFragmentIdentifier()) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the URL's protocol is not HTTPS or the URL contains one or more of username, password, query string, and fragment.");
- return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL's protocol is not HTTPS or the URL contains one or more of username, password, query string, and fragment."_s);
- }
- return makeUnexpected(nullString());
- }
+ if (!redirectURL.protocolIs("https") || redirectURL.hasCredentials() || redirectURL.hasQuery() || redirectURL.hasFragmentIdentifier())
+ return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL's protocol is not HTTPS or the URL contains one or more of username, password, query string, and fragment."_s);
auto prefixLength = sizeof(privateClickMeasurementPathPrefix) - 1;
if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize) {
auto attributionTriggerDataUInt64 = path.substring(prefixLength, privateClickMeasurementAttributionTriggerDataPathSegmentSize).toUInt64Strict();
- if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the conversion data could not be parsed or was higher than the allowed maximum of %{public}u.", 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 makeUnexpected(nullString());
- }
+ 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 } };
}
@@ -86,31 +76,17 @@
if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1 + privateClickMeasurementPriorityPathSegmentSize) {
auto attributionTriggerDataUInt64 = path.substring(prefixLength, privateClickMeasurementAttributionTriggerDataPathSegmentSize).toUInt64Strict();
- if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the conversion data could not be parsed or was higher than the allowed maximum of %{public}u.", 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 makeUnexpected(nullString());
- }
+ 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));
auto attributionPriorityUInt64 = path.substring(prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1, privateClickMeasurementPriorityPathSegmentSize).toUInt64Strict();
- if (!attributionPriorityUInt64 || *attributionPriorityUInt64 > Priority::MaxEntropy) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the priority could not be parsed or was higher than the allowed maximum of %{public}u.", 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 makeUnexpected(nullString());
- }
+ 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) } };
}
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the URL path contained unrecognized parts.");
- return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts."_s);
- }
- return makeUnexpected(nullString());
+ return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts."_s);
}
Optional<Seconds> PrivateClickMeasurement::attributeAndGetEarliestTimeToSend(AttributionTriggerData&& attributionTriggerData)
@@ -169,9 +145,4 @@
return reportDetails;
}
-bool PrivateClickMeasurement::debugModeEnabled()
-{
- return RuntimeEnabledFeatures::sharedFeatures().privateClickMeasurementDebugModeEnabled();
}
-
-}
Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp (271472 => 271473)
--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp 2021-01-14 00:07:24 UTC (rev 271472)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp 2021-01-14 00:10:07 UTC (rev 271473)
@@ -72,10 +72,7 @@
clearExpired();
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Storing an ad click.");
- m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] Storing an ad click."_s);
- }
+ m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] Storing an ad click."_s);
#if ENABLE(RESOURCE_LOAD_STATISTICS)
if (auto* resourceLoadStatistics = m_networkSession->resourceLoadStatistics())
@@ -92,18 +89,12 @@
auto& firstPartyURL = redirectRequest.firstPartyForCookies();
if (!redirectDomain.matches(requestURL)) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Attribution was not accepted because the HTTP redirect was not same-site.");
- m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Error, "[Private Click Measurement] Attribution was not accepted because the HTTP redirect was not same-site."_s);
- }
+ m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Attribution was not accepted because the HTTP redirect was not same-site."_s);
return;
}
if (redirectDomain.matches(firstPartyURL)) {
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Attribution was not accepted because it was requested in an HTTP redirect that is same-site as the first-party.");
- m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Error, "[Private Click Measurement] Attribution was not accepted because it was requested in an HTTP redirect that is same-site as the first-party."_s);
- }
+ m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Attribution was not accepted because it was requested in an HTTP redirect that is same-site as the first-party."_s);
return;
}
@@ -129,10 +120,11 @@
return;
if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "Setting timer for firing attribution request to the debug mode timeout of %{public}f seconds where the regular timeout would have been %{public}f seconds.", debugModeSecondsUntilSend.seconds(), secondsUntilSend.seconds());
m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, makeString("[Private Click Measurement] Setting timer for firing attribution request to the debug mode timeout of "_s, debugModeSecondsUntilSend.seconds(), " seconds where the regular timeout would have been "_s, secondsUntilSend.seconds(), " seconds."_s));
secondsUntilSend = debugModeSecondsUntilSend;
- }
+ } else
+ m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, makeString("[Private Click Measurement] Setting timer for firing attribution request to the timeout of "_s, secondsUntilSend.seconds(), " seconds."_s));
+
startTimer(secondsUntilSend);
}
});
@@ -172,24 +164,15 @@
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = true;
loadParameters.shouldRestrictHTTPResponseAccess = false;
- if (UNLIKELY(debugModeEnabled())) {
- RELEASE_LOG_INFO(PrivateClickMeasurement, "About to fire an attribution request.");
- m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] About to fire an attribution request."_s);
- }
+ RELEASE_LOG_INFO(PrivateClickMeasurement, "About to fire an attribution request.");
+ m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] About to fire an attribution request."_s);
m_pingLoadFunction(WTFMove(loadParameters), [weakThis = makeWeakPtr(*this)](const WebCore::ResourceError& error, const WebCore::ResourceResponse& response) {
if (!weakThis)
return;
- if (UNLIKELY(weakThis->debugModeEnabled())) {
- if (!error.isNull()) {
-#if PLATFORM(COCOA)
- RELEASE_LOG_ERROR(PrivateClickMeasurement, "Received error: '%{public}s' for ad click attribution request.", error.localizedDescription().utf8().data());
-#else
- RELEASE_LOG_ERROR(PrivateClickMeasurement, "Received error: '%s' for ad click attribution request.", error.localizedDescription().utf8().data());
-#endif
- weakThis->m_networkProcess->broadcastConsoleMessage(weakThis->m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Error, makeString("[Private Click Measurement] Received error: '"_s, error.localizedDescription(), "' for ad click attribution request."_s));
- }
+ if (!error.isNull()) {
+ weakThis->m_networkProcess->broadcastConsoleMessage(weakThis->m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Error, makeString("[Private Click Measurement] Received error: '"_s, error.localizedDescription(), "' for ad click attribution request."_s));
}
});
}