gecko-dev/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStorageObserver.h
Paul Zuehlcke 8fcf41c736 Bug 1894040 - Support for enabling or disabling BounceTrackingProtection during runtime. r=anti-tracking-reviewers,bvandersloot
This patch switches the main logic from a boolean pref to an integer with different feature modes.
See nsIBounceTrackingProtection for the new modes supported. Dry-run mode has been merged into the mode
pref.

A new state is introduced MODE_ENABLED_STANDBY in which BTP still collects user activation signals, but
does not classify or purge bounce trackers. This new mode should be used when it's expected that the
feature may be toggled on/off after rollout. Collecting user activation even in the "disabled" state
ensures that when the feature gets re-enabled the user activation map is already warmed up and sites
important to the user are not classified + purged.

The BounceTrackingProtection singleton listens for changes on the mode pref and inits / tears down accordingly.
However it never shuts down fully. To fully disable the feature a restart is required.

Differential Revision: https://phabricator.services.mozilla.com/D217848
2024-08-13 12:38:26 +00:00

36 lines
918 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_BounceTrackingStorageObserver_h__
#define mozilla_BounceTrackingStorageObserver_h__
#include "mozilla/Logging.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
namespace mozilla {
namespace dom {
class WindowContext;
}
extern LazyLogModule gBounceTrackingProtectionLog;
class BounceTrackingStorageObserver : public nsIObserver,
public nsSupportsWeakReference {
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
public:
[[nodiscard]] static nsresult OnInitialStorageAccess(
dom::WindowContext* aWindowContext);
[[nodiscard]] nsresult Init();
private:
virtual ~BounceTrackingStorageObserver() = default;
};
} // namespace mozilla
#endif