Bug 1511954 - Remove the "Allowed" label of content blocking categories and put it behind a pref. r=Ehsan

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2018-12-05 22:32:38 +00:00
Родитель 7d5d9316d4
Коммит fdf4659de3
3 изменённых файлов: 15 добавлений и 4 удалений

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

@ -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);

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

@ -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);

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

@ -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");