1313#include " mozilla/AlreadyAddRefed.h"
1414#include " mozilla/ClearOnShutdown.h"
1515#include " mozilla/ContentBlockingAllowList.h"
16- #include " mozilla/glean/GleanMetrics.h"
1716#include " mozilla/Logging.h"
1817#include " mozilla/Services.h"
1918#include " mozilla/StaticPrefs_privacy.h"
@@ -587,8 +586,7 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal(
587586
588587 RefPtr<ClearDataMozPromise::Private> clearPromise =
589588 new ClearDataMozPromise::Private (__func__);
590- RefPtr<ClearDataCallback> cb =
591- new ClearDataCallback (clearPromise, host, bounceTime);
589+ RefPtr<ClearDataCallback> cb = new ClearDataCallback (clearPromise, host);
592590
593591 MOZ_LOG (gBounceTrackingProtectionLog , LogLevel::Debug,
594592 (" %s: Purge state for host: %s" , __FUNCTION__,
@@ -597,9 +595,7 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal(
597595 if (StaticPrefs::privacy_bounceTrackingProtection_enableDryRunMode ()) {
598596 // In dry-run mode, we don't actually clear the data, but we still want to
599597 // resolve the promise to indicate that the data would have been cleared.
600- // Go through ClearDataCallback rather than directly resolving the promise
601- // to ensure telemetry is collected.
602- cb->OnDataDeleted (0 );
598+ clearPromise->Resolve (host, __func__);
603599 } else {
604600 // TODO: Bug 1842067: Clear by site + OA.
605601 rv = clearDataService->DeleteDataFromBaseDomain (host, false ,
@@ -668,38 +664,13 @@ NS_IMPL_ISUPPORTS(BounceTrackingProtection::ClearDataCallback,
668664NS_IMETHODIMP BounceTrackingProtection::ClearDataCallback::OnDataDeleted (
669665 uint32_t aFailedFlags) {
670666 if (aFailedFlags) {
671- MOZ_LOG (gBounceTrackingProtectionLog , LogLevel::Error,
672- (" %s: Failed to clear mHost: %s, mBounceTime: %" PRIu64
673- " , aFailedFlags: %d" ,
674- __FUNCTION__, mHost .get (), mBounceTime , aFailedFlags));
675- RecordClearDataTelemetry (false );
676-
677667 mPromise ->Reject (aFailedFlags, __func__);
678668 } else {
679669 MOZ_LOG (gBounceTrackingProtectionLog , LogLevel::Info,
680- (" %s: Cleared: mHost: %s, mBounceTime: %" PRIu64, __FUNCTION__,
681- mHost .get (), mBounceTime ));
682- RecordClearDataTelemetry (true );
683-
670+ (" %s: Cleared %s" , __FUNCTION__, mHost .get ()));
684671 mPromise ->Resolve (std::move (mHost ), __func__);
685672 }
686673 return NS_OK;
687674}
688675
689- void BounceTrackingProtection::ClearDataCallback::RecordClearDataTelemetry (
690- bool success) {
691- // Record a glean event for the clear action. This is only recorded in
692- // pre-release channels since we record the site host which is considered
693- // category 3 data.
694- // https://wiki.mozilla.org/Data_Collection#Data_Collection_Categories
695- #if defined(EARLY_BETA_OR_EARLIER)
696- glean::bounce_tracking_protection::ActionPurgeExtra extra = {
697- .bounceTime = Some (mBounceTime / PR_USEC_PER_SEC),
698- .siteHost = Some (mHost ),
699- .success = Some (success),
700- };
701- glean::bounce_tracking_protection::action_purge.Record (Some (extra));
702- #endif // defined(EARLY_BETA_OR_EARLIER)
703- }
704-
705676} // namespace mozilla
0 commit comments