diff --git a/browser/base/content/browser-siteProtections.js b/browser/base/content/browser-siteProtections.js index 43d1035fc327..cb1518444a75 100644 --- a/browser/base/content/browser-siteProtections.js +++ b/browser/base/content/browser-siteProtections.js @@ -606,55 +606,44 @@ var ThirdPartyCookies = { this.updateCategoryItem(); }, - get disabledCategoryLabel() { - delete this.disabledCategoryLabel; - return (this.disabledCategoryLabel = document.getElementById( - "protections-popup-cookies-category-label-disabled" - )); - }, - - get enabledCategoryLabel() { - delete this.enabledCategoryLabel; - return (this.enabledCategoryLabel = document.getElementById( - "protections-popup-cookies-category-label-enabled" + get categoryLabel() { + delete this.categoryLabel; + return (this.categoryLabel = document.getElementById( + "protections-popup-cookies-category-label" )); }, updateCategoryItem() { this.categoryItem.classList.toggle("blocked", this.enabled); - if (!this.enabled) { - this.disabledCategoryLabel.hidden = false; - this.enabledCategoryLabel.hidden = true; - return; - } - let label; - switch (this.behaviorPref) { - case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN: - label = "contentBlocking.cookies.blocking3rdParty2.label"; - break; - case Ci.nsICookieService.BEHAVIOR_REJECT: - label = "contentBlocking.cookies.blockingAll2.label"; - break; - case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN: - label = "contentBlocking.cookies.blockingUnvisited2.label"; - break; - case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER: - label = "contentBlocking.cookies.blockingTrackers3.label"; - break; - default: - Cu.reportError( - `Error: Unknown cookieBehavior pref observed: ${this.behaviorPref}` - ); - break; + + if (!this.enabled) { + label = "contentBlocking.cookies.blockingTrackers3.label"; + } else { + switch (this.behaviorPref) { + case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN: + label = "contentBlocking.cookies.blocking3rdParty2.label"; + break; + case Ci.nsICookieService.BEHAVIOR_REJECT: + label = "contentBlocking.cookies.blockingAll2.label"; + break; + case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN: + label = "contentBlocking.cookies.blockingUnvisited2.label"; + break; + case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER: + label = "contentBlocking.cookies.blockingTrackers3.label"; + break; + default: + Cu.reportError( + `Error: Unknown cookieBehavior pref observed: ${this.behaviorPref}` + ); + break; + } } - this.enabledCategoryLabel.textContent = label + this.categoryLabel.textContent = label ? gNavigatorBundle.getString(label) : ""; - - this.disabledCategoryLabel.hidden = true; - this.enabledCategoryLabel.hidden = false; }, get enabled() { diff --git a/browser/components/controlcenter/content/protectionsPanel.inc.xul b/browser/components/controlcenter/content/protectionsPanel.inc.xul index 5f633820794d..61c45a2ab283 100644 --- a/browser/components/controlcenter/content/protectionsPanel.inc.xul +++ b/browser/components/controlcenter/content/protectionsPanel.inc.xul @@ -88,11 +88,8 @@ class="protections-popup-category" align="center" wrap="true"> - - +