Closed Bug 1788225 Opened 2 years ago Closed 2 years ago

Add a per-site preference for cookie banner handling

Categories

(Core :: Privacy: Anti-Tracking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: pbz, Assigned: timhuang)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

A per-site preference for cookie banner handling allows users to disable the mechanism for a specific site. We could also support changing the behavior (MODE_REJECT, MODE_REJECT_OR_ACCEPT).

We can use the content pref service to store a flag per domain:
https://searchfox.org/mozilla-central/source/dom/interfaces/base/nsIContentPrefService2.idl

The flag can be checked in the rule getters of nsICookieBannerService. Then consumers don't have to care about these preferences.

Some questions that came up in today's meeting:

nsIContentPrefService
Getter is async, that doesn’t work for the cookie injector
Can we warm up the cache beforehand?
Can we import all exceptions on cookie banner service init?
HashSet of origins? domains?
Cache reads in-memory in cookie banner service
Write changes directly to nsIContentPrefService
Use an observer / listener to subscribe to content pref type “cookiehandling” and keep in-memory cache up to date
Alternative? Key value storage
What should be the key for exceptions?
Domain?
Basedomain?
This should somehow match our rule keying.
Base domain matches the behavior of our existing toggles better

Assignee: nobody → tihuang
Status: NEW → ASSIGNED
Priority: P3 → P2

This patch implements the CookieBannerDomainPrefService which manage
the per domain pref setting for cookie banner handling. The service uses
the nsIContentPrefService2 to store the per site pref value.

This patches adds functions to nsCookieBannerService that allow
get, set and remove cookie banner domain preference.

Depends on D157866

The site preference will take precedence over the pref setting when we
getting the cookie rule and the clicking rule. We will use the top-level
uri to check the site preference which aligns with the behavior of ETP
toggle.

Depends on D157867

Depends on D157869

Pushed by tihuang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e39d4ec1a0aa
Part 1: Implementing CookieBannerDomainPrefService. r=pbz
https://hg.mozilla.org/integration/autoland/rev/4a016fb178b8
Part 2: Add functions to nsCookieBannerService to allow setting domain preference. r=pbz
https://hg.mozilla.org/integration/autoland/rev/b4c5c6ac0ed6
Part 3: Check the site preference of the top-level domain when getting the cookie rule and clicking rule. r=pbz
https://hg.mozilla.org/integration/autoland/rev/5b509c1c080e
Part 4: Add tests for cookie banner domain preferences. r=pbz
Regressions: 1795484
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: