Changeset 271473 in webkit


Ignore:
Timestamp:
Jan 13, 2021 4:10:07 PM (18 months ago)
Author:
wilander@apple.com
Message:

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):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r271472 r271473  
     12021-01-13  John Wilander  <wilander@apple.com>
     2
     3        PCM: Output logs by default, including to Web Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=220596
     5        <rdar://problem/73159180>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This change turns on PCM output to Web Inspector and logs
     10        by default. In the case of WebCore::PrivateClickMeasurement,
     11        this means we no longer need the debugModeEnabled()
     12        convenience function.
     13
     14        * loader/PrivateClickMeasurement.cpp:
     15        (WebCore::PrivateClickMeasurement::parseAttributionRequest):
     16        (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted.
     17        * loader/PrivateClickMeasurement.h:
     18
    1192021-01-13  Said Abou-Hallawa  <said@apple.com>
    220
  • trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp

    r270598 r271473  
    6262        return makeUnexpected(nullString());
    6363
    64     if (!redirectURL.protocolIs("https") || redirectURL.hasCredentials() || redirectURL.hasQuery() || redirectURL.hasFragmentIdentifier()) {
    65         if (UNLIKELY(debugModeEnabled())) {
    66             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.");
    67             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);
    68         }
    69         return makeUnexpected(nullString());
    70     }
     64    if (!redirectURL.protocolIs("https") || redirectURL.hasCredentials() || redirectURL.hasQuery() || redirectURL.hasFragmentIdentifier())
     65        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);
    7166
    7267
     
    7469    if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize) {
    7570        auto attributionTriggerDataUInt64 = path.substring(prefixLength, privateClickMeasurementAttributionTriggerDataPathSegmentSize).toUInt64Strict();
    76         if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy) {
    77             if (UNLIKELY(debugModeEnabled())) {
    78                 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);
    79                 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));
    80             }
    81             return makeUnexpected(nullString());
    82         }
     71        if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy)
     72            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));
    8373
    8474        return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { 0 } };
     
    8777    if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1 + privateClickMeasurementPriorityPathSegmentSize) {
    8878        auto attributionTriggerDataUInt64 = path.substring(prefixLength, privateClickMeasurementAttributionTriggerDataPathSegmentSize).toUInt64Strict();
    89         if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy) {
    90             if (UNLIKELY(debugModeEnabled())) {
    91                 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);
    92                 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));
    93             }
    94             return makeUnexpected(nullString());
    95         }
     79        if (!attributionTriggerDataUInt64 || *attributionTriggerDataUInt64 > AttributionTriggerData::MaxEntropy)
     80            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));
    9681
    9782        auto attributionPriorityUInt64 = path.substring(prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1, privateClickMeasurementPriorityPathSegmentSize).toUInt64Strict();
    98         if (!attributionPriorityUInt64 || *attributionPriorityUInt64 > Priority::MaxEntropy) {
    99             if (UNLIKELY(debugModeEnabled())) {
    100                 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);
    101                 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));
    102             }
    103             return makeUnexpected(nullString());
    104         }
     83        if (!attributionPriorityUInt64 || *attributionPriorityUInt64 > Priority::MaxEntropy)
     84            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));
    10585
    10686        return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { static_cast<uint32_t>(*attributionPriorityUInt64) } };
    10787    }
    10888
    109     if (UNLIKELY(debugModeEnabled())) {
    110         RELEASE_LOG_INFO(PrivateClickMeasurement, "Conversion was not accepted because the URL path contained unrecognized parts.");
    111         return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts."_s);
    112     }
    113     return makeUnexpected(nullString());
     89    return makeUnexpected("[Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts."_s);
    11490}
    11591
     
    170146}
    171147
    172 bool PrivateClickMeasurement::debugModeEnabled()
    173 {
    174     return RuntimeEnabledFeatures::sharedFeatures().privateClickMeasurementDebugModeEnabled();
    175148}
    176 
    177 }
  • trunk/Source/WebCore/loader/PrivateClickMeasurement.h

    r270669 r271473  
    269269private:
    270270    bool isValid() const;
    271     static bool debugModeEnabled();
    272271
    273272    SourceID m_sourceID;
  • trunk/Source/WebKit/ChangeLog

    r271471 r271473  
     12021-01-13  John Wilander  <wilander@apple.com>
     2
     3        PCM: Output logs by default, including to Web Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=220596
     5        <rdar://problem/73159180>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This change turns on PCM output to Web Inspector and logs
     10        by default. In some of the cases, the syslog output was
     11        deleted since it doesn't make sense to log those messages
     12        now that we have output in Web Inspector.
     13
     14        * NetworkProcess/PrivateClickMeasurementManager.cpp:
     15        (WebKit::PrivateClickMeasurementManager::storeUnattributed):
     16        (WebKit::PrivateClickMeasurementManager::handleAttribution):
     17        (WebKit::PrivateClickMeasurementManager::attribute):
     18        (WebKit::PrivateClickMeasurementManager::fireConversionRequest):
     19
    1202021-01-13  Jer Noble  <jer.noble@apple.com>
    221
  • trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp

    r271184 r271473  
    7373    clearExpired();
    7474
    75     if (UNLIKELY(debugModeEnabled())) {
    76         RELEASE_LOG_INFO(PrivateClickMeasurement, "Storing an ad click.");
    77         m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] Storing an ad click."_s);
    78     }
     75    m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] Storing an ad click."_s);
    7976
    8077#if ENABLE(RESOURCE_LOAD_STATISTICS)
     
    9390
    9491    if (!redirectDomain.matches(requestURL)) {
    95         if (UNLIKELY(debugModeEnabled())) {
    96             RELEASE_LOG_INFO(PrivateClickMeasurement, "Attribution was not accepted because the HTTP redirect was not same-site.");
    97             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);
    98         }
     92        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);
    9993        return;
    10094    }
    10195
    10296    if (redirectDomain.matches(firstPartyURL)) {
    103         if (UNLIKELY(debugModeEnabled())) {
    104             RELEASE_LOG_INFO(PrivateClickMeasurement, "Attribution was not accepted because it was requested in an HTTP redirect that is same-site as the first-party.");
    105             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);
    106         }
     97        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);
    10798        return;
    10899    }
     
    130121
    131122                if (UNLIKELY(debugModeEnabled())) {
    132                     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());
    133123                    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));
    134124                    secondsUntilSend = debugModeSecondsUntilSend;
    135                 }
     125                } else
     126                    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));
     127
    136128                startTimer(secondsUntilSend);
    137129            }
     
    173165    loadParameters.shouldRestrictHTTPResponseAccess = false;
    174166
    175     if (UNLIKELY(debugModeEnabled())) {
    176         RELEASE_LOG_INFO(PrivateClickMeasurement, "About to fire an attribution request.");
    177         m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] About to fire an attribution request."_s);
    178     }
     167    RELEASE_LOG_INFO(PrivateClickMeasurement, "About to fire an attribution request.");
     168    m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] About to fire an attribution request."_s);
    179169
    180170    m_pingLoadFunction(WTFMove(loadParameters), [weakThis = makeWeakPtr(*this)](const WebCore::ResourceError& error, const WebCore::ResourceResponse& response) {
     
    182172            return;
    183173
    184         if (UNLIKELY(weakThis->debugModeEnabled())) {
    185             if (!error.isNull()) {
    186 #if PLATFORM(COCOA)
    187                 RELEASE_LOG_ERROR(PrivateClickMeasurement, "Received error: '%{public}s' for ad click attribution request.", error.localizedDescription().utf8().data());
    188 #else
    189                 RELEASE_LOG_ERROR(PrivateClickMeasurement, "Received error: '%s' for ad click attribution request.", error.localizedDescription().utf8().data());
    190 #endif
    191                 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));
    192             }
     174        if (!error.isNull()) {
     175            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));
    193176        }
    194177    });
Note: See TracChangeset for help on using the changeset viewer.