diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp')
-rw-r--r-- | toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp index 3481753431..b94c887c90 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp @@ -106,6 +106,11 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( NS_ENSURE_ARG_MIN(aFrom, 0); NS_ENSURE_TRUE(!aTo || aTo.value() > aFrom, NS_ERROR_INVALID_ARG); + MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, + ("%s: Clearing user activations by time range from %" PRIu64 + " to %" PRIu64 " %s", + __FUNCTION__, aFrom, aTo.valueOr(0), Describe().get())); + // Clear in memory user activation data. if (aEntryType.isNothing() || aEntryType.value() == @@ -113,10 +118,10 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( for (auto iter = mUserActivation.Iter(); !iter.Done(); iter.Next()) { if (iter.Data() >= aFrom && (aTo.isNothing() || iter.Data() <= aTo.value())) { - iter.Remove(); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, ("%s: Remove user activation for %s", __FUNCTION__, PromiseFlatCString(iter.Key()).get())); + iter.Remove(); } } } @@ -128,10 +133,10 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( for (auto iter = mBounceTrackers.Iter(); !iter.Done(); iter.Next()) { if (iter.Data() >= aFrom && (aTo.isNothing() || iter.Data() <= aTo.value())) { - iter.Remove(); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, ("%s: Remove bouncer tracker for %s", __FUNCTION__, PromiseFlatCString(iter.Key()).get())); + iter.Remove(); } } } @@ -187,4 +192,27 @@ nsresult BounceTrackingStateGlobal::RemoveBounceTrackers( return NS_OK; } +// static +nsCString BounceTrackingStateGlobal::DescribeMap( + const nsTHashMap<nsCStringHashKey, PRTime>& aMap) { + nsAutoCString mapStr; + + for (auto iter = aMap.ConstIter(); !iter.Done(); iter.Next()) { + mapStr.Append(nsPrintfCString("{ %s: %" PRIu64 " }, ", + PromiseFlatCString(iter.Key()).get(), + iter.Data())); + } + + return std::move(mapStr); +} + +nsCString BounceTrackingStateGlobal::Describe() { + nsAutoCString originAttributeSuffix; + mOriginAttributes.CreateSuffix(originAttributeSuffix); + return nsPrintfCString( + "{ mOriginAttributes: %s, mUserActivation: %s, mBounceTrackers: %s }", + originAttributeSuffix.get(), DescribeMap(mUserActivation).get(), + DescribeMap(mBounceTrackers).get()); +} + } // namespace mozilla |