Title: [271842] branches/safari-611-branch/Source
Revision
271842
Author
alanc...@apple.com
Date
2021-01-25 14:12:31 -0800 (Mon, 25 Jan 2021)

Log Message

Cherry-pick r271473. rdar://problem/73478401

    PCM: Output logs by default, including to Web Inspector
    https://bugs.webkit.org/show_bug.cgi?id=220596
    <rdar://problem/73159180>

    Reviewed by Brent Fulgham.

    This change turns on PCM output to Web Inspector and logs
    Source/WebCore:

    by default. In the case of WebCore::PrivateClickMeasurement,
    this means we no longer need the debugModeEnabled()
    convenience function.

    * loader/PrivateClickMeasurement.cpp:
    (WebCore::PrivateClickMeasurement::parseAttributionRequest):
    (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted.
    * loader/PrivateClickMeasurement.h:

    Source/WebKit:

    by default. In some of the cases, the syslog output was
    deleted since it doesn't make sense to log those messages
    now that we have output in Web Inspector.

    * NetworkProcess/PrivateClickMeasurementManager.cpp:
    (WebKit::PrivateClickMeasurementManager::storeUnattributed):
    (WebKit::PrivateClickMeasurementManager::handleAttribution):
    (WebKit::PrivateClickMeasurementManager::attribute):
    (WebKit::PrivateClickMeasurementManager::fireConversionRequest):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (271841 => 271842)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-01-25 22:12:26 UTC (rev 271841)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-01-25 22:12:31 UTC (rev 271842)
@@ -1,5 +1,60 @@
 2021-01-25  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r271473. rdar://problem/73478401
+
+    PCM: Output logs by default, including to Web Inspector
+    https://bugs.webkit.org/show_bug.cgi?id=220596
+    <rdar://problem/73159180>
+    
+    Reviewed by Brent Fulgham.
+    
+    This change turns on PCM output to Web Inspector and logs
+    Source/WebCore:
+    
+    by default. In the case of WebCore::PrivateClickMeasurement,
+    this means we no longer need the debugModeEnabled()
+    convenience function.
+    
+    * loader/PrivateClickMeasurement.cpp:
+    (WebCore::PrivateClickMeasurement::parseAttributionRequest):
+    (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted.
+    * loader/PrivateClickMeasurement.h:
+    
+    Source/WebKit:
+    
+    by default. In some of the cases, the syslog output was
+    deleted since it doesn't make sense to log those messages
+    now that we have output in Web Inspector.
+    
+    * NetworkProcess/PrivateClickMeasurementManager.cpp:
+    (WebKit::PrivateClickMeasurementManager::storeUnattributed):
+    (WebKit::PrivateClickMeasurementManager::handleAttribution):
+    (WebKit::PrivateClickMeasurementManager::attribute):
+    (WebKit::PrivateClickMeasurementManager::fireConversionRequest):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-13  John Wilander  <wilan...@apple.com>
+
+            PCM: Output logs by default, including to Web Inspector
+            https://bugs.webkit.org/show_bug.cgi?id=220596
+            <rdar://problem/73159180>
+
+            Reviewed by Brent Fulgham.
+
+            This change turns on PCM output to Web Inspector and logs
+            by default. In the case of WebCore::PrivateClickMeasurement,
+            this means we no longer need the debugModeEnabled()
+            convenience function.
+
+            * loader/PrivateClickMeasurement.cpp:
+            (WebCore::PrivateClickMeasurement::parseAttributionRequest):
+            (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted.
+            * loader/PrivateClickMeasurement.h:
+
+2021-01-25  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r271471. rdar://problem/73477068
 
     Source/WebCore:

Modified: branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp (271841 => 271842)


--- branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-01-25 22:12:26 UTC (rev 271841)
+++ branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.cpp	2021-01-25 22:12:31 UTC (rev 271842)
@@ -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: branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.h (271841 => 271842)


--- branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.h	2021-01-25 22:12:26 UTC (rev 271841)
+++ branches/safari-611-branch/Source/WebCore/loader/PrivateClickMeasurement.h	2021-01-25 22:12:31 UTC (rev 271842)
@@ -268,7 +268,6 @@
 
 private:
     bool isValid() const;
-    static bool debugModeEnabled();
 
     SourceID m_sourceID;
     SourceSite m_sourceSite;

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (271841 => 271842)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-01-25 22:12:26 UTC (rev 271841)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-01-25 22:12:31 UTC (rev 271842)
@@ -1,5 +1,61 @@
 2021-01-25  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r271473. rdar://problem/73478401
+
+    PCM: Output logs by default, including to Web Inspector
+    https://bugs.webkit.org/show_bug.cgi?id=220596
+    <rdar://problem/73159180>
+    
+    Reviewed by Brent Fulgham.
+    
+    This change turns on PCM output to Web Inspector and logs
+    Source/WebCore:
+    
+    by default. In the case of WebCore::PrivateClickMeasurement,
+    this means we no longer need the debugModeEnabled()
+    convenience function.
+    
+    * loader/PrivateClickMeasurement.cpp:
+    (WebCore::PrivateClickMeasurement::parseAttributionRequest):
+    (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted.
+    * loader/PrivateClickMeasurement.h:
+    
+    Source/WebKit:
+    
+    by default. In some of the cases, the syslog output was
+    deleted since it doesn't make sense to log those messages
+    now that we have output in Web Inspector.
+    
+    * NetworkProcess/PrivateClickMeasurementManager.cpp:
+    (WebKit::PrivateClickMeasurementManager::storeUnattributed):
+    (WebKit::PrivateClickMeasurementManager::handleAttribution):
+    (WebKit::PrivateClickMeasurementManager::attribute):
+    (WebKit::PrivateClickMeasurementManager::fireConversionRequest):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-13  John Wilander  <wilan...@apple.com>
+
+            PCM: Output logs by default, including to Web Inspector
+            https://bugs.webkit.org/show_bug.cgi?id=220596
+            <rdar://problem/73159180>
+
+            Reviewed by Brent Fulgham.
+
+            This change turns on PCM output to Web Inspector and logs
+            by default. In some of the cases, the syslog output was
+            deleted since it doesn't make sense to log those messages
+            now that we have output in Web Inspector.
+
+            * NetworkProcess/PrivateClickMeasurementManager.cpp:
+            (WebKit::PrivateClickMeasurementManager::storeUnattributed):
+            (WebKit::PrivateClickMeasurementManager::handleAttribution):
+            (WebKit::PrivateClickMeasurementManager::attribute):
+            (WebKit::PrivateClickMeasurementManager::fireConversionRequest):
+
+2021-01-25  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r271471. rdar://problem/73477068
 
     Source/WebCore:

Modified: branches/safari-611-branch/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp (271841 => 271842)


--- branches/safari-611-branch/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp	2021-01-25 22:12:26 UTC (rev 271841)
+++ branches/safari-611-branch/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp	2021-01-25 22:12:31 UTC (rev 271842)
@@ -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));
         }
     });
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to