Closed Bug 1803601 Opened 3 years ago Closed 3 years ago

Allow to persist cookie banner handling exceptions in private mode

Categories

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

task

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: amejia, Assigned: timhuang)

References

(Blocks 1 open bug)

Details

(Whiteboard: [geckoview:m111])

Attachments

(2 files)

At the moment the cookie banner exceptions are only session scoped in private mode (No persistent), Focus for Android is always in private mode, and users would expected that exceptions will persist after app restarts similar to tracking protection exceptions.

See more details on the matrix matrix.

Tim, do you think we could add a flag to the setter method to persist the pref in private browsing for specific callers? Focus could then pass that flag into this method https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/toolkit/components/cookiebanners/nsICookieBannerService.idl#89
We would probably need a separate bucket for PBM exceptions that are persistent?

Severity: -- → N/A
Flags: needinfo?(tihuang)
Priority: -- → P2

I think we can just use the disk version of the setting if the permanent PBM is enabled. Maybe this is easier.

Flags: needinfo?(tihuang)

This might be fine for Focus, but if we use this flag in other cases in the future we may run into issues with PBM overwriting normal browsing prefs.

Yeah, this is a good concern. But we can use a different content pref key for permanent PBM mode. Then, it won't mess up with normal browsing prefs.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED
Whiteboard: [geckoview:m110]

Gabriel, what is the need re: the API? Do you have any requirements, what would be convenient to use to implement this feature? (AC or GV API)

Flags: needinfo?(giorga)
Whiteboard: [geckoview:m110]
Depends on: 1804747
Whiteboard: [geckoview:m111]

(In reply to [:owlish] 🦉 PST from comment #5)

Gabriel, what is the need re: the API? Do you have any requirements, what would be convenient to use to implement this feature? (AC or GV API)

Hi , I think it should be something like this method from ac ,with a different name like addPresistentPrivateException.
override suspend fun addException(
uri: String,
privateBrowsing: Boolean,
) {
setGeckoException(uri, DISABLED, privateBrowsing)
}

Flags: needinfo?(giorga)

One question from me that Arturo might be able to answer. Does Focus rely on the pref browser.privatebrowsing.autostart to enable permanent private mode? If so, do you think we can use the same pref to control the behavior here, or should we introduce a separate pref for this purpose? Thanks.

Flags: needinfo?(amejiamarmol)

I've discovered how Geckoview persists permission for the private mode. There is a separate API to allow Geckoview to persist permission for a private session. Maybe we can also follow the same pattern here.

(In reply to Tim Huang[:timhuang] from comment #7)

One question from me that Arturo might be able to answer. Does Focus rely on the pref browser.privatebrowsing.autostart to enable permanent private mode? If so, do you think we can use the same pref to control the behavior here, or should we introduce a separate pref for this purpose? Thanks.

We don't use it in GeckoView, we don't expose it to apps. But if it's convenient for you we can do it, the flag is true and we call

      Services.cookieBanners.setDomainPref(  uri,  mode, true);

right?

Flags: needinfo?(amejiamarmol)

(In reply to Tim Huang[:timhuang] from comment #8)

I've discovered how Geckoview persists permission for the private mode. There is a separate API to allow Geckoview to persist permission for a private session. Maybe we can also follow the same pattern here.

Having a separate API will be ideally to be more explicit and have consistency with other APIs, but not sure how much work does that generates for you.

I am adding a Services.cookieBanners.setDomainPrefAndPersistInPrivateBrowsing() to allow GeckoView to persist settings for private windows.

That sounds fantastic 🙌!
Thanks!

This patch adds a new function setDomainPrefAndPersistInPrivateBrowsing()
to nsICookieBannerService. This function allows persisting domain pref
in the private browsing mode.

Blocks: 1805925
Blocks: 1804747
No longer depends on: 1804747
Pushed by tihuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a9679be52b5b Part 1: Adding a Services.cookieBanners.setDomainPrefAndPersistInPrivateBrowsing() to allow persist cookie banner domain pref for the private browsing. r=pbz https://hg.mozilla.org/integration/autoland/rev/fff79aec4a22 Part 2: Add tests for nsICookieBannerService.setDomainPrefAndPersistInPrivateBrowsing(). r=pbz

Backed out for causing build bustages on nsCookieBannerService.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/checkouts/gecko/toolkit/components/cookiebanners/nsCookieBannerService.cpp(640,24): error: function declared 'stdcall' here was previously declared without calling convention
Flags: needinfo?(tihuang)
Pushed by tihuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ed716ee573f9 Part 1: Adding a Services.cookieBanners.setDomainPrefAndPersistInPrivateBrowsing() to allow persist cookie banner domain pref for the private browsing. r=pbz https://hg.mozilla.org/integration/autoland/rev/3f2bdf32df53 Part 2: Add tests for nsICookieBannerService.setDomainPrefAndPersistInPrivateBrowsing(). r=pbz
Flags: needinfo?(tihuang)
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: