Backed out changeset 66b01a30ed12 (bug 1589015) for causing perma fails on browser_trackingUI_categories.js. CLOSED TREE

This commit is contained in:
Razvan Maries 2019-10-18 12:29:35 +03:00
parent 431636d12a
commit 29261ec7e6
3 changed files with 46 additions and 30 deletions

View File

@ -606,44 +606,55 @@ var ThirdPartyCookies = {
this.updateCategoryItem();
},
get categoryLabel() {
delete this.categoryLabel;
return (this.categoryLabel = document.getElementById(
"protections-popup-cookies-category-label"
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"
));
},
updateCategoryItem() {
this.categoryItem.classList.toggle("blocked", this.enabled);
let label;
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.disabledCategoryLabel.hidden = false;
this.enabledCategoryLabel.hidden = true;
return;
}
this.categoryLabel.textContent = label
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;
}
this.enabledCategoryLabel.textContent = label
? gNavigatorBundle.getString(label)
: "";
this.disabledCategoryLabel.hidden = true;
this.enabledCategoryLabel.hidden = false;
},
get enabled() {

View File

@ -88,8 +88,11 @@
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"
class="protections-popup-category-label"/>
<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>
</toolbarbutton>
<!-- wrap=true is needed for descriptionheightworkaround, see bug 1564077 -->
<toolbarbutton id="protections-popup-category-cryptominers"

View File

@ -728,6 +728,8 @@ 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">