1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_BounceTrackingRecord_h
8 #define mozilla_BounceTrackingRecord_h
10 #include "nsStringFwd.h"
11 #include "nsTHashSet.h"
16 class CanonicalBrowsingContext
;
19 // Stores per-tab data relevant to bounce tracking protection for every extended
21 class BounceTrackingRecord final
{
23 void SetInitialHost(const nsACString
& aHost
);
25 const nsACString
& GetInitialHost() const;
27 void SetFinalHost(const nsACString
& aHost
);
29 const nsACString
& GetFinalHost() const;
31 void AddBounceHost(const nsACString
& aHost
);
33 void AddStorageAccessHost(const nsACString
& aHost
);
35 void AddUserActivationHost(const nsACString
& aHost
);
37 const nsTHashSet
<nsCStringHashKey
>& GetBounceHosts() const;
39 const nsTHashSet
<nsCStringHashKey
>& GetStorageAccessHosts() const;
41 const nsTHashSet
<nsCStringHashKey
>& GetUserActivationHosts() const;
43 // Create a string that describes this record. Used for logging.
47 // A site's host. The initiator site of the current extended navigation.
48 nsAutoCString mInitialHost
;
50 // A site's host or null. The destination of the current extended navigation.
51 // Updated after every document load.
52 nsAutoCString mFinalHost
;
54 // A set of sites' hosts. All server-side and client-side redirects hit during
55 // this extended navigation.
56 nsTHashSet
<nsCStringHashKey
> mBounceHosts
;
58 // A set of sites' hosts. All sites which accessed storage during this
59 // extended navigation.
60 nsTHashSet
<nsCStringHashKey
> mStorageAccessHosts
;
62 // A set of sites' hosts. All sites which received user activation during
63 // this extended navigation.
64 // This is not used by bounce tracking protection itself, but are instead
65 // used to enable storage access heuristics. See Bug 1935235.
66 nsTHashSet
<nsCStringHashKey
> mUserActivationHosts
;
68 // Create a comma-delimited string that describes a string set. Used for
70 static nsCString
DescribeSet(const nsTHashSet
<nsCStringHashKey
>& set
);
73 } // namespace mozilla