Bug 1589015 - Stop using two label elements in the cookies category item. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D49599

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-10-18 08:23:48 +00:00
Родитель 3131adff9f
Коммит dd9ab00dff
3 изменённых файлов: 30 добавлений и 46 удалений

Просмотреть файл

@ -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() {

Просмотреть файл

@ -88,11 +88,8 @@
class="protections-popup-category" align="center"
wrap="true">
<image class="protections-popup-category-icon thirdpartycookies-icon"/>
<label flex="1" id="protections-popup-cookies-category-label-disabled"
class="protections-popup-category-label">&contentBlocking.cookies2.label;</label>
<label flex="1" id="protections-popup-cookies-category-label-enabled"
class="protections-popup-category-label"
hidden="true"></label>
<label flex="1" id="protections-popup-cookies-category-label"
class="protections-popup-category-label"/>
</toolbarbutton>
<!-- wrap=true is needed for descriptionheightworkaround, see bug 1564077 -->
<toolbarbutton id="protections-popup-category-cryptominers"

Просмотреть файл

@ -728,8 +728,6 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY contentBlocking.socialblock.label "Social Media Trackers">
<!ENTITY contentBlocking.cookies2.label "Cross-Site Tracking Cookies">
<!ENTITY contentBlocking.cryptominers.label "Cryptominers">
<!ENTITY contentBlocking.fingerprinters.label "Fingerprinters">