summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp')
-rw-r--r--toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp
index b94c887c90..bcd9e57bd8 100644
--- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp
+++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp
@@ -9,6 +9,7 @@
#include "ErrorList.h"
#include "mozilla/Assertions.h"
#include "mozilla/Logging.h"
+#include "mozilla/IntegerPrintfMacros.h"
#include "nsIPrincipal.h"
namespace mozilla {
@@ -42,6 +43,19 @@ nsresult BounceTrackingStateGlobal::RecordUserActivation(
__FUNCTION__, PromiseFlatCString(aSiteHost).get()));
}
+ // Make sure we don't overwrite an existing, more recent user activation. This
+ // is only relevant for callers that pass in a timestamp that isn't PR_Now(),
+ // e.g. when importing user activation data.
+ Maybe<PRTime> existingUserActivation = mUserActivation.MaybeGet(aSiteHost);
+ if (existingUserActivation.isSome() &&
+ existingUserActivation.value() >= aTime) {
+ MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug,
+ ("%s: Skip: A more recent user activation "
+ "already exists for %s",
+ __FUNCTION__, PromiseFlatCString(aSiteHost).get()));
+ return NS_OK;
+ }
+
mUserActivation.InsertOrUpdate(aSiteHost, aTime);
if (aSkipStorage || !ShouldPersistToDisk()) {