diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 76df13e49e54..768d8990d5e2 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1539,6 +1539,8 @@ pref("dom.storage_access.max_concurrent_auto_grants", 5); pref("browser.contentblocking.trackingprotection.control-center.ui.enabled", true); pref("browser.contentblocking.rejecttrackers.control-center.ui.enabled", true); +pref("browser.contentblocking.control-center.ui.showAllowedLabels", false); + // Enable the Report Breakage UI on Nightly and Beta but not on Release yet. #ifdef EARLY_BETA_OR_EARLIER pref("browser.contentblocking.reportBreakage.enabled", true); diff --git a/browser/base/content/browser-contentblocking.js b/browser/base/content/browser-contentblocking.js index 5f6a4df61704..39162ce30087 100644 --- a/browser/base/content/browser-contentblocking.js +++ b/browser/base/content/browser-contentblocking.js @@ -80,9 +80,9 @@ var TrackingProtection = { if (this.enabled) { label = "contentBlocking.trackers.blocked.label"; } else { - label = "contentBlocking.trackers.allowed.label"; + label = ContentBlocking.showAllowedLabels ? "contentBlocking.trackers.allowed.label" : null; } - this.categoryLabel.textContent = gNavigatorBundle.getString(label); + this.categoryLabel.textContent = label ? gNavigatorBundle.getString(label) : ""; }, isBlocking(state) { @@ -266,10 +266,10 @@ var ThirdPartyCookies = { Cu.reportError(`Error: Unknown cookieBehavior pref observed: ${this.behaviorPref}`); // fall through case Ci.nsICookieService.BEHAVIOR_ACCEPT: - label = "contentBlocking.cookies.allowed.label"; + label = ContentBlocking.showAllowedLabels ? "contentBlocking.cookies.allowed.label" : null; break; } - this.categoryLabel.textContent = gNavigatorBundle.getString(label); + this.categoryLabel.textContent = label ? gNavigatorBundle.getString(label) : ""; }, init() { @@ -488,6 +488,7 @@ var ContentBlocking = { PREF_REPORT_BREAKAGE_URL: "browser.contentblocking.reportBreakage.url", PREF_INTRO_COUNT_CB: "browser.contentblocking.introCount", PREF_CB_CATEGORY: "browser.contentblocking.category", + PREF_SHOW_ALLOWED_LABELS: "browser.contentblocking.control-center.ui.showAllowedLabels", content: null, icon: null, activeTooltipText: null, @@ -575,6 +576,12 @@ var ContentBlocking = { Services.prefs.addObserver(this.PREF_ANIMATIONS_ENABLED, this.updateAnimationsEnabled); + XPCOMUtils.defineLazyPreferenceGetter(this, "showAllowedLabels", + this.PREF_SHOW_ALLOWED_LABELS, false, () => { + for (let blocker of this.blockers) { + blocker.updateCategoryLabel(); + } + }); XPCOMUtils.defineLazyPreferenceGetter(this, "reportBreakageEnabled", this.PREF_REPORT_BREAKAGE_ENABLED, false); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_categories.js b/browser/base/content/test/trackingUI/browser_trackingUI_categories.js index a2f0693ab000..7042f3dedc40 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_categories.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_categories.js @@ -70,6 +70,8 @@ add_task(async function testCategoryLabelsInAppMenu() { }); add_task(async function testSubcategoryLabels() { + SpecialPowers.pushPrefEnv({set: [["browser.contentblocking.control-center.ui.showAllowedLabels", true]]}); + await BrowserTestUtils.withNewTab("http://www.example.com", async function() { let categoryLabel = document.getElementById("identity-popup-content-blocking-tracking-protection-state-label");