Closed Bug 2058143 Opened 2 months ago Closed 2 months ago

Remove cookie banner handling implementation

Categories

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

task

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: emz, Assigned: emz)

References

Details

Attachments

(10 external files)

Remove all cookie banner handling code.

This includes:

  • Desktop UI
  • Fenix UI
  • Focus UI
  • toolkit/components/cookiebanners/*

Removes the Cookie Banner Blocker section and subview from the protections
panel, its CSS, its Fluent strings, and the two about:preferences pref
registrations. The preferences.ftl strings and the privacy.mjs registrations
were already orphaned; the prefs UI row was removed in an earlier bug.

Also removes the two protections-popup Glean events that only the deleted
toggle recorded, together with their Legacy Telemetry mirror objects.

Drive-by: browser_privacy_gpc.js had a copy-pasted header comment claiming it
tests the cookie banner UI; it tests Global Privacy Control.

Assignee: nobody → emz
Status: NEW → ASSIGNED

Removes the cookieBannerDetected and cookieBannerHandled triggers, the cookie
banner feature callout, the about:privatebrowsing promo and its asset, the
COOKIE_BANNERS promo type, and the three cookiebanners.* entries from the
SET_PREF allow-list.

Notes for reviewers:

  • BrowserUtils.PromoType keeps a gap at 5 rather than renumbering, matching the
    existing vacancy at 3. The values cross the parent/content boundary, so
    renumbering would be a silent behaviour change.
  • PB_NEWTAB_COOKIE_BANNERS_PROMO was the only type: "default" pb_newtab
    message, so about:privatebrowsing now renders without a default promo. That
    is intended.
  • browser_privatebrowsing_about_default_promo.js and _nimbus_dismiss.js were
    rewritten rather than deleted, to preserve the only coverage of
    handlePromoOnPreload() cross-tab dismissal and the deferred message load path.
  • shouldShowPromo() still throws on an unrecognised promo type, so a stale
    enrolled message naming COOKIE_BANNERS would reject the ShouldShowPromo
    query. This hazard pre-exists: the schemas also permit "OTHER", which is
    likewise absent from PromoType. Left alone to keep this patch a removal.
  • test_shouldShowCookieBannersPromo was the only coverage of
    showForEnterprise: true, which is now untested.

Removes the Cookie Banner Blocker preference, its settings-search entry, the
Nimbus cookie-banners feature and its Glean metric, and the stale exposure
record left in BrowserFragment.

The DataStore cleanup migration added in bug 2053618 is kept and now uses the
literal file name, because the android-components class it imported the name
from is removed in Part 5. Dropping it would strand an orphaned preferences
file on every existing install.

Translatable strings are marked moz:removedIn="155" with
tools:ignore="UnusedResources" rather than deleted, per
mobile/android/focus-android/docs/Removing-strings.md; beta-cut.py harvests
them once the marked version stops shipping.

Also removes the cookie-banners entry from the checked-in experimenter
manifest, and the Cookie Banner Blocker assertion in SettingsPrivacyTest,
which would otherwise fail now the row is gone.

Removes the cookie banner settings screen, the reducer store and its details
panel, the toolbar CFR, the AppState/AppAction/AppReducer plumbing, the SUMO
topic and the Glean metrics and cookie-banner-report-site ping.

Adds a one-time migration deleting the report_site_domains_preferences
DataStore and the five obsolete cookie banner preference keys, mirroring the
equivalent Fenix cleanup. Focus previously had no such cleanup.

Translatable strings are marked moz:removedIn="155" with
tools:ignore="UnusedResources" rather than deleted, per
mobile/android/focus-android/docs/Removing-strings.md.

Reviewer note: removing the cookie_banner_exception ComposeView from
dialog_tracking_protection_sheet.xml re-anchors enhanced_tracking to
security_info. The removed view carried a 28dp top margin, so the gap above
the ETP switch is now the layout's usual 16dp. This inflates cleanly, so
please sanity-check the panel spacing visually.

Removes the concept-engine cookiehandling package, GeckoCookieBannersStorage,
ReportSiteDomainsRepository, the CookieBannerHandlingMode and
CookieBannerHandlingStatus enums, EngineSession.hasCookieBannerRuleForSession,
the Settings.cookieBannerHandling* settings, CookieBannerAction and
SessionState.cookieBanner.

This is a breaking change for the published components; there is no
replacement API.

FakeEngineSession in Fenix is updated in this commit rather than Part 3
because hasCookieBannerRuleForSession is abstract: removing either the member
or its override alone fails to compile.

Removes ContentBlocking.CookieBannerMode and CBCookieBannerMode, the
ContentBlocking.Settings cookie banner getters, setters and builder methods,
GeckoSession.ContentDelegate.onCookieBannerDetected and onCookieBannerHandled,
GeckoSession.hasCookieBannerRuleForBrowsingContextTree, and the four
StorageController cookie banner domain methods, along with the JS side that
serviced them.

This is an outright removal with no prior deprecation and no replacement, as
the underlying Gecko feature is being deleted. Embedders using these APIs will
need to drop the calls.

Removes CLEAR_COOKIE_BANNER_EXCEPTION and CLEAR_COOKIE_BANNER_EXECUTED_RECORD,
their two cleaners, and their use from the Clear-Site-Data header path,
Sanitizer and SiteDataTestUtils.

Bits 26 and 27 are left as permanent holes rather than renumbering the
remaining flags, following the precedent of bug 2006028, which removed
CLEAR_PREDICTOR_NETWORK_DATA and left bit 8 vacant. Renumbering would silently
change the meaning of flag values held by out-of-tree callers. The interface
uuid is likewise not revved, matching that precedent.

All JS consumers land here with the IDL change: in JS, x | undefined
evaluates to x, so a stale reference would silently become a no-op rather
than throwing.

Deletes toolkit/components/cookiebanners and everything that reached into it:
the static and runtime prefs, the JSWindowActor registration, the
nsILoadInfo.hasInjectedCookieForCookieBannerHandling plumbing and its IPC
serialization, the Glean and Legacy Telemetry registrations, the Nimbus
feature, and the shipped cookie-banner-rules-list Remote Settings dump.

Notes for reviewers:

  • Removing the cookiebanners pref group from modules/libpref/moz.build and the
    StaticPrefList.yaml block must happen together; a mismatch fails at build
    time rather than lint time.
  • Deleting the local dump does not decommission the main/cookie-banner-rules-list
    Remote Settings collection. ESR and older clients still sync it live, so the
    server-side collection needs to outlive them and be retired separately.
  • docs/overview/gecko.md used nsCookieBannerService purely as its worked
    example of XPCOM component instantiation; the diagram is kept with a service
    that still exists.
  • Recorded perf pages will now show cookie banners, since hooks_recording.py no
    longer sets the dismissal prefs. Worth a follow-up if that shifts baselines.

ContentPrefService2._execStmts awaited the database connection outside its
try/catch. Callers such as removeByName() do not consume the promise it
returns, so a connection failure surfaced as an unhandled rejection instead of
reaching onError/onDone.

Part 10 calls removeByName() from a synchronous profile data migration, which
opens the database late enough that the connection can be closed before the
removal lands. Without this, every xpcshell test that runs the migrations fails
with "uncaught rejection: Connection is not open."

Per-site cookie banner exceptions were stored as content prefs under the names
"cookiebanner" and "cookiebannerprivate". The private one was persisted to disk
whenever a domain pref was set with persistInPrivateBrowsing, so both need
clearing. Nothing removes them once the feature is gone, so they would sit in
content-prefs.sqlite indefinitely.

Adds profile data version 179, removing both content pref names across all
domains and clearing any user values left under the cookiebanners. and
browser.promo.cookiebanners. branches, whose defaults no longer exist.

See Also: → 2053618
Depends on: 2053618

The following patches are waiting for review from an inactive reviewer:

ID Title Author Reviewer Status
D314665 Bug 2058143 - Part 1: Remove the cookie banner handling UI from the protections panel and preferences. r=#anti-tracking!,#fluent-reviewers!,#desktop-theme-reviewers! emz manuel: Back Aug 16, 2026
D314672 Bug 2058143 - Part 7: Remove the cookie banner clear-data integration. r=#anti-tracking! emz manuel: Back Aug 16, 2026
D314673 Bug 2058143 - Part 8: Remove the cookie banner handling implementation. r=#anti-tracking!,#necko-reviewers! emz manuel: Back Aug 16, 2026
D314674 Bug 2058143 - Part 9: Report content pref connection failures through the callback. r=#anti-tracking! emz manuel: Back Aug 16, 2026
D314675 Bug 2058143 - Part 10: Clear cookie banner data from existing profiles. r=#anti-tracking! emz manuel: Back Aug 16, 2026

:emz, could you please find another reviewer?

For more information, please visit BugBot documentation.

Flags: needinfo?(emz)
Depends on: 2060504
Pushed by ezuehlcke@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0d3c11d148af https://hg.mozilla.org/integration/autoland/rev/be18d5a0fb03 Part 1: Remove the cookie banner handling UI from the protections panel and preferences. r=desktop-theme-reviewers,mstriemer,chutten,timhuang https://github.com/mozilla-firefox/firefox/commit/4d394fd5bdb4 https://hg.mozilla.org/integration/autoland/rev/683b157a9893 Part 2: Remove the cookie banner messaging surfaces and private browsing promo. r=omc-reviewers,desktop-theme-reviewers,joel,mstriemer,emcminn https://github.com/mozilla-firefox/firefox/commit/b8e655f8389c https://hg.mozilla.org/integration/autoland/rev/d95f24e8a083 Part 3: Remove the cookie banner handling UI from Fenix. r=android-reviewers,android-l10n-reviewers,parker,gl https://github.com/mozilla-firefox/firefox/commit/5715ac69dc65 https://hg.mozilla.org/integration/autoland/rev/fc35b7885d19 Part 4: Remove the cookie banner reducer from Focus. r=android-reviewers,android-l10n-reviewers,parker,gl https://github.com/mozilla-firefox/firefox/commit/3c57b6d1a482 https://hg.mozilla.org/integration/autoland/rev/cc97128e262d Part 5: Remove the cookie banner handling API from android-components. r=android-reviewers,gl https://github.com/mozilla-firefox/firefox/commit/1d0c7918b466 https://hg.mozilla.org/integration/autoland/rev/80a5f5790cee Part 6: Remove the cookie banner handling API from GeckoView. r=geckoview-reviewers,android-reviewers,owlish https://github.com/mozilla-firefox/firefox/commit/fa5f9508217e https://hg.mozilla.org/integration/autoland/rev/c3b49c86ffa0 Part 7: Remove the cookie banner clear-data integration. r=timhuang https://github.com/mozilla-firefox/firefox/commit/2213eda366ff https://hg.mozilla.org/integration/autoland/rev/dfc9e3c70dca Part 8: Remove the cookie banner handling implementation. r=necko-reviewers,ipc-reviewers,frontend-codestyle-reviewers,chutten,kershaw,mossop,timhuang https://github.com/mozilla-firefox/firefox/commit/79573d367476 https://hg.mozilla.org/integration/autoland/rev/3104e346936b Part 9: Report content pref connection failures through the callback. r=timhuang https://github.com/mozilla-firefox/firefox/commit/17202d7987df https://hg.mozilla.org/integration/autoland/rev/ef1cf3521be3 Part 10: Clear cookie banner data from existing profiles. r=firefox-desktop-core-reviewers ,mossop,timhuang
Flags: needinfo?(emz)
Duplicate of this bug: 2037910
QA Whiteboard: [qa-triage-done-c156/b155]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: