Changeset 271473 in webkit
- Timestamp:
- Jan 13, 2021 4:10:07 PM (18 months ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/loader/PrivateClickMeasurement.cpp (modified) (4 diffs)
-
WebCore/loader/PrivateClickMeasurement.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271472 r271473 1 2021-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 1 19 2021-01-13 Said Abou-Hallawa <said@apple.com> 2 20 -
trunk/Source/WebCore/loader/PrivateClickMeasurement.cpp
r270598 r271473 62 62 return makeUnexpected(nullString()); 63 63 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); 71 66 72 67 … … 74 69 if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize) { 75 70 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)); 83 73 84 74 return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { 0 } }; … … 87 77 if (path.length() == prefixLength + privateClickMeasurementAttributionTriggerDataPathSegmentSize + 1 + privateClickMeasurementPriorityPathSegmentSize) { 88 78 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)); 96 81 97 82 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)); 105 85 106 86 return AttributionTriggerData { static_cast<uint32_t>(*attributionTriggerDataUInt64), Priority { static_cast<uint32_t>(*attributionPriorityUInt64) } }; 107 87 } 108 88 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); 114 90 } 115 91 … … 170 146 } 171 147 172 bool PrivateClickMeasurement::debugModeEnabled()173 {174 return RuntimeEnabledFeatures::sharedFeatures().privateClickMeasurementDebugModeEnabled();175 148 } 176 177 } -
trunk/Source/WebCore/loader/PrivateClickMeasurement.h
r270669 r271473 269 269 private: 270 270 bool isValid() const; 271 static bool debugModeEnabled();272 271 273 272 SourceID m_sourceID; -
trunk/Source/WebKit/ChangeLog
r271471 r271473 1 2021-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 1 20 2021-01-13 Jer Noble <jer.noble@apple.com> 2 21 -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp
r271184 r271473 73 73 clearExpired(); 74 74 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); 79 76 80 77 #if ENABLE(RESOURCE_LOAD_STATISTICS) … … 93 90 94 91 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); 99 93 return; 100 94 } 101 95 102 96 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); 107 98 return; 108 99 } … … 130 121 131 122 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());133 123 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)); 134 124 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 136 128 startTimer(secondsUntilSend); 137 129 } … … 173 165 loadParameters.shouldRestrictHTTPResponseAccess = false; 174 166 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); 179 169 180 170 m_pingLoadFunction(WTFMove(loadParameters), [weakThis = makeWeakPtr(*this)](const WebCore::ResourceError& error, const WebCore::ResourceResponse& response) { … … 182 172 return; 183 173 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)); 193 176 } 194 177 });
Note: See TracChangeset
for help on using the changeset viewer.