diff --git a/browser/base/content/browser-contentblocking.js b/browser/base/content/browser-contentblocking.js index 1af597875017..91d50e4035d4 100644 --- a/browser/base/content/browser-contentblocking.js +++ b/browser/base/content/browser-contentblocking.js @@ -129,7 +129,6 @@ var ThirdPartyCookies = { var ContentBlocking = { // If the user ignores the doorhanger, we stop showing it after some time. MAX_INTROS: 20, - PREF_ENABLED: "browser.contentblocking.enabled", PREF_ANIMATIONS_ENABLED: "toolkit.cosmeticAnimations.enabled", PREF_REPORT_BREAKAGE_ENABLED: "browser.contentblocking.reportBreakage.enabled", PREF_REPORT_BREAKAGE_URL: "browser.contentblocking.reportBreakage.url", @@ -216,13 +215,9 @@ var ContentBlocking = { Services.prefs.addObserver(this.PREF_ANIMATIONS_ENABLED, this.updateAnimationsEnabled); - XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingEnabled", this.PREF_ENABLED, false, - this.updateEnabled.bind(this)); XPCOMUtils.defineLazyPreferenceGetter(this, "reportBreakageEnabled", this.PREF_REPORT_BREAKAGE_ENABLED, false); - this.updateEnabled(); - this.appMenuLabel.setAttribute("label", this.strings.appMenuTitle); this.appMenuLabel.setAttribute("tooltiptext", this.strings.appMenuTooltip); @@ -242,19 +237,6 @@ var ContentBlocking = { Services.prefs.removeObserver(this.PREF_ANIMATIONS_ENABLED, this.updateAnimationsEnabled); }, - get enabled() { - return this.contentBlockingEnabled; - }, - - updateEnabled() { - this.content.toggleAttribute("enabled", this.enabled); - - // The enabled state of blockers may also change since it depends on this.enabled. - for (let blocker of this.blockers) { - blocker.categoryItem.classList.toggle("blocked", this.enabled && blocker.enabled); - } - }, - hideIdentityPopupAndReload() { document.getElementById("identity-popup").hidePopup(); BrowserReload(); @@ -366,7 +348,7 @@ var ContentBlocking = { // dialog should only be able to open in the currently selected tab and onSecurityChange // runs on tab switch, so we can avoid associating the data with the document directly. blocker.activated = blocker.isBlockerActivated(state); - blocker.categoryItem.classList.toggle("blocked", this.enabled && blocker.enabled); + blocker.categoryItem.classList.toggle("blocked", blocker.enabled); blocker.categoryItem.hidden = !blocker.visible; anyBlockerActivated = anyBlockerActivated || blocker.activated; } @@ -375,7 +357,7 @@ var ContentBlocking = { // occurs on the page. Note that merely allowing the loading of content that // we could have blocked does not trigger the appearance of the shield. // This state will be overriden later if there's an exception set for this site. - let active = this.enabled && anyBlockerActivated; + let active = anyBlockerActivated; let isAllowing = state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT; let detected = anyBlockerActivated || isAllowing; @@ -391,7 +373,7 @@ var ContentBlocking = { this.content.toggleAttribute("active", active); this.iconBox.toggleAttribute("active", active); - this.iconBox.toggleAttribute("hasException", this.enabled && hasException); + this.iconBox.toggleAttribute("hasException", hasException); // For release (due to the large volume) we only want to receive reports // for breakage that is directly related to third party cookie blocking. diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js b/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js index 534ab7dd7c53..89c8de9b84f5 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js @@ -4,7 +4,6 @@ * See also Bug 1175858. */ -const CB_PREF = "browser.contentblocking.enabled"; const TP_PREF = "privacy.trackingprotection.enabled"; const TP_PB_PREF = "privacy.trackingprotection.enabled"; const NCB_PREF = "network.cookie.cookieBehavior"; @@ -17,7 +16,6 @@ registerCleanupFunction(function() { Services.prefs.clearUserPref(TP_PREF); Services.prefs.clearUserPref(TP_PB_PREF); Services.prefs.clearUserPref(NCB_PREF); - Services.prefs.clearUserPref(CB_PREF); Services.prefs.clearUserPref(ContentBlocking.prefIntroCount); }); @@ -168,8 +166,6 @@ add_task(async function testNormalBrowsing() { ok(TrackingProtection.enabled, "TP is enabled after setting the pref"); Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER); ok(ThirdPartyCookies.enabled, "ThirdPartyCookies is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(ContentBlocking.enabled, "CB is enabled after setting the pref"); Services.prefs.setIntPref(ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS); await testTrackingProtectionAnimation(gBrowser); @@ -190,8 +186,6 @@ add_task(async function testPrivateBrowsing() { ok(TrackingProtection.enabled, "TP is enabled after setting the pref"); Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER); ok(ThirdPartyCookies.enabled, "ThirdPartyCookies is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(TrackingProtection.enabled, "CB is enabled after setting the pref"); Services.prefs.setIntPref(ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS); await testTrackingProtectionAnimation(tabbrowser); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_fetch.js b/browser/base/content/test/trackingUI/browser_trackingUI_fetch.js index 558bee7bc3ad..45a846c4d8a3 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_fetch.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_fetch.js @@ -20,7 +20,6 @@ function waitForSecurityChange(numChanges = 1) { add_task(async function test_fetch() { await SpecialPowers.pushPrefEnv({ set: [ ["privacy.trackingprotection.enabled", true], - ["browser.contentblocking.enabled", true], ]}); await BrowserTestUtils.withNewTab({ gBrowser, url: URL }, async function(newTabBrowser) { @@ -34,7 +33,6 @@ add_task(async function test_fetch() { let ContentBlocking = newTabBrowser.ownerGlobal.ContentBlocking; ok(ContentBlocking, "got CB object"); - ok(ContentBlocking.enabled, "CB is enabled"); ok(ContentBlocking.content.hasAttribute("detected"), "has detected content blocking"); ok(ContentBlocking.iconBox.hasAttribute("active"), "icon box is active"); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js b/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js index 3d906c485f67..d2bb3df028ac 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js @@ -3,7 +3,6 @@ "use strict"; -const CB_PREF = "browser.contentblocking.enabled"; const TP_PREF = "privacy.trackingprotection.enabled"; const FB_PREF = "browser.fastblock.enabled"; const TPC_PREF = "network.cookie.cookieBehavior"; @@ -67,7 +66,6 @@ add_task(async function testOpenPreferencesFromPrefsButton() { // links to about:preferences add_task(async function testOpenPreferencesFromAddBlockingButtons() { SpecialPowers.pushPrefEnv({set: [ - [CB_PREF, true], [FB_PREF, false], [TP_PREF, false], [TPC_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT], diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js b/browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js index 8fd5cef3e2ab..c462c3ab9255 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js @@ -4,7 +4,6 @@ // Test that sites added to the Tracking Protection whitelist in private // browsing mode don't persist once the private browsing window closes. -const CB_PREF = "browser.contentblocking.enabled"; const TP_PB_PREF = "privacy.trackingprotection.enabled"; const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html"; var TrackingProtection = null; @@ -13,7 +12,6 @@ var browser = null; registerCleanupFunction(function() { Services.prefs.clearUserPref(TP_PB_PREF); - Services.prefs.clearUserPref(CB_PREF); ContentBlocking = TrackingProtection = browser = null; UrlClassifierTestUtils.cleanupTestTrackers(); }); @@ -105,8 +103,6 @@ add_task(async function testExceptionAddition() { Services.prefs.setBoolPref(TP_PB_PREF, true); ok(TrackingProtection.enabled, "TP is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(TrackingProtection.enabled, "CB is enabled after setting the pref"); info("Load a test page containing tracking elements"); await promiseTabLoadEvent(tab, TRACKING_PAGE); @@ -142,7 +138,6 @@ add_task(async function testExceptionPersistence() { TrackingProtection = browser.ownerGlobal.TrackingProtection; ok(TrackingProtection, "TP is attached to the private window"); - ok(ContentBlocking.enabled, "CB is still enabled"); ok(TrackingProtection.enabled, "TP is still enabled"); info("Load a test page containing tracking elements"); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js b/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js index 1921e216312c..9ba428231ec7 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js @@ -7,7 +7,6 @@ const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/ const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html"; const COOKIE_PAGE = "http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html"; -const CB_PREF = "browser.contentblocking.enabled"; const TP_PREF = "privacy.trackingprotection.enabled"; const PREF_REPORT_BREAKAGE_ENABLED = "browser.contentblocking.reportBreakage.enabled"; const PREF_REPORT_BREAKAGE_URL = "browser.contentblocking.reportBreakage.url"; @@ -39,7 +38,6 @@ add_task(async function testReportBreakageVisibility() { { url: TRACKING_PAGE, prefs: { - "browser.contentblocking.enabled": true, "privacy.trackingprotection.enabled": true, "browser.contentblocking.reportBreakage.enabled": true, }, @@ -49,7 +47,6 @@ add_task(async function testReportBreakageVisibility() { url: TRACKING_PAGE, hasException: true, prefs: { - "browser.contentblocking.enabled": true, "privacy.trackingprotection.enabled": true, "browser.contentblocking.reportBreakage.enabled": true, }, @@ -58,16 +55,6 @@ add_task(async function testReportBreakageVisibility() { { url: TRACKING_PAGE, prefs: { - "browser.contentblocking.enabled": false, - "privacy.trackingprotection.enabled": true, - "browser.contentblocking.reportBreakage.enabled": true, - }, - buttonVisible: false, - }, - { - url: TRACKING_PAGE, - prefs: { - "browser.contentblocking.enabled": true, "privacy.trackingprotection.enabled": true, "browser.contentblocking.reportBreakage.enabled": false, }, @@ -76,7 +63,6 @@ add_task(async function testReportBreakageVisibility() { { url: BENIGN_PAGE, prefs: { - "browser.contentblocking.enabled": true, "privacy.trackingprotection.enabled": true, "browser.contentblocking.reportBreakage.enabled": true, }, @@ -85,7 +71,6 @@ add_task(async function testReportBreakageVisibility() { { url: COOKIE_PAGE, prefs: { - "browser.contentblocking.enabled": true, "privacy.trackingprotection.enabled": false, "network.cookie.cookieBehavior": Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, "browser.contentblocking.reportBreakage.enabled": false, @@ -122,7 +107,6 @@ add_task(async function testReportBreakageVisibility() { add_task(async function testReportBreakageCancel() { Services.prefs.setBoolPref(TP_PREF, true); - Services.prefs.setBoolPref(CB_PREF, true); Services.prefs.setBoolPref(PREF_REPORT_BREAKAGE_ENABLED, true); await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() { @@ -153,7 +137,6 @@ add_task(async function testReportBreakageCancel() { ok(true, "Main view was shown"); }); - Services.prefs.clearUserPref(CB_PREF); Services.prefs.clearUserPref(TP_PREF); Services.prefs.clearUserPref(PREF_REPORT_BREAKAGE_ENABLED); }); @@ -166,7 +149,6 @@ add_task(async function testReportBreakage() { let path = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort + "/"; Services.prefs.setBoolPref(TP_PREF, true); - Services.prefs.setBoolPref(CB_PREF, true); Services.prefs.setBoolPref(PREF_REPORT_BREAKAGE_ENABLED, true); Services.prefs.setStringPref(PREF_REPORT_BREAKAGE_URL, path); @@ -248,7 +230,6 @@ add_task(async function testReportBreakage() { // Stop the server. await new Promise(r => server.stop(r)); - Services.prefs.clearUserPref(CB_PREF); Services.prefs.clearUserPref(TP_PREF); Services.prefs.clearUserPref(PREF_REPORT_BREAKAGE_ENABLED); Services.prefs.clearUserPref(PREF_REPORT_BREAKAGE_URL); @@ -256,7 +237,6 @@ add_task(async function testReportBreakage() { add_task(async function cleanup() { // Clear prefs that are touched in this test again for sanity. - Services.prefs.clearUserPref(CB_PREF); Services.prefs.clearUserPref(TP_PREF); Services.prefs.clearUserPref(PREF_REPORT_BREAKAGE_ENABLED); Services.prefs.clearUserPref(PREF_REPORT_BREAKAGE_URL); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_state.js b/browser/base/content/test/trackingUI/browser_trackingUI_state.js index 7a9b8c4bf9bc..9a00d88691ea 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_state.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_state.js @@ -14,7 +14,6 @@ * See also Bugs 1175327, 1043801, 1178985 */ -const CB_PREF = "browser.contentblocking.enabled"; const TP_PREF = "privacy.trackingprotection.enabled"; const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled"; const TPC_PREF = "network.cookie.cookieBehavior"; @@ -33,7 +32,6 @@ registerCleanupFunction(function() { UrlClassifierTestUtils.cleanupTestTrackers(); Services.prefs.clearUserPref(TP_PREF); Services.prefs.clearUserPref(TP_PB_PREF); - Services.prefs.clearUserPref(CB_PREF); Services.prefs.clearUserPref(TPC_PREF); }); @@ -67,8 +65,7 @@ function testBenignPage() { ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is hidden"); ok(hidden("#tracking-action-block"), "blockButton is hidden"); ok(hidden("#tracking-action-unblock"), "unblockButton is hidden"); - is(!hidden("#identity-popup-content-blocking-disabled-label"), !ContentBlocking.enabled, - "disabled label is visible if CB is off"); + ok(hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is not visible"); ok(!hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is visible"); ok(hidden("#identity-popup-content-blocking-detected"), "blocking detected label is hidden"); @@ -82,15 +79,12 @@ function testBenignPageWithException() { ok(!ContentBlocking.content.hasAttribute("active"), "content is not active"); ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active"); - is(ContentBlocking.iconBox.hasAttribute("hasException"), ContentBlocking.enabled, - "shield shows exception if CB is on"); + ok(ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows exception"); is(ContentBlocking.iconBox.getAttribute("tooltiptext"), gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip"); - is(!BrowserTestUtils.is_hidden(ContentBlocking.iconBox), ContentBlocking.enabled, - "icon box is not hidden if CB is on"); - is(!hidden("#tracking-action-block"), ContentBlocking.enabled, - "blockButton is visible if CB is on"); + ok(!BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is not hidden"); + ok(!hidden("#tracking-action-block"), "blockButton is visible"); ok(hidden("#tracking-action-unblock"), "unblockButton is hidden"); ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible"); @@ -100,11 +94,8 @@ function testBenignPageWithException() { } function areTrackersBlocked(isPrivateBrowsing) { - let cbEnabled = Services.prefs.getBoolPref(CB_PREF); - let blockedByTP = cbEnabled && - Services.prefs.getBoolPref(isPrivateBrowsing ? TP_PB_PREF : TP_PREF); - let blockedByTPC = cbEnabled && - Services.prefs.getIntPref(TPC_PREF) == Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER; + let blockedByTP = Services.prefs.getBoolPref(isPrivateBrowsing ? TP_PB_PREF : TP_PREF); + let blockedByTPC = Services.prefs.getIntPref(TPC_PREF) == Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER; return blockedByTP || blockedByTPC; } @@ -169,18 +160,14 @@ function testTrackingPageUnblocked(blockedByTP, window) { ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected"); ok(ContentBlocking.content.hasAttribute("hasException"), "content shows exception"); - let blockingEnabled = Services.prefs.getBoolPref(CB_PREF); ok(!ContentBlocking.content.hasAttribute("active"), "content is not active"); ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active"); - is(ContentBlocking.iconBox.hasAttribute("hasException"), blockingEnabled, - "shield" + (blockingEnabled ? " shows" : " doesn't show") + " exception"); + ok(ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows exception"); is(ContentBlocking.iconBox.getAttribute("tooltiptext"), gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip"); - is(BrowserTestUtils.is_visible(ContentBlocking.iconBox), blockingEnabled, - "icon box is" + (blockingEnabled ? "" : " not") + " visible"); - is(hidden("#tracking-action-block"), !blockingEnabled, - "blockButton is" + (blockingEnabled ? " not" : "") + " visible"); + ok(BrowserTestUtils.is_visible(ContentBlocking.iconBox), "icon box is visible"); + ok(!hidden("#tracking-action-block"), "blockButton is visible"); ok(hidden("#tracking-action-unblock"), "unblockButton is hidden"); ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible"); @@ -198,32 +185,7 @@ function testTrackingPageUnblocked(blockedByTP, window) { "TP category item is not set to blocked"); } -function testTrackingPageWithCBDisabled() { - info("Tracking content must be white-listed and not blocked"); - ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected"); - ok(!ContentBlocking.content.hasAttribute("hasException"), "content shows no exception"); - ok(!ContentBlocking.content.hasAttribute("active"), "content is not active"); - - ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active"); - ok(!ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows no exception"); - ok(!ContentBlocking.iconBox.getAttribute("tooltiptext"), "icon box has no tooltip"); - - ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is hidden"); - ok(hidden("#tracking-action-block"), "blockButton is hidden"); - ok(hidden("#tracking-action-unblock"), "unblockButton is hidden"); - ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible"); - - ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden"); - ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible"); - - ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible"); - ok(!hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"), - "TP category item is showing add blocking"); - ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"), - "TP category item is not set to blocked"); -} - -async function testContentBlockingEnabled(tab) { +async function testContentBlocking(tab) { info("Testing with Tracking Protection ENABLED."); info("Load a test page not containing tracking elements"); @@ -266,36 +228,6 @@ async function testContentBlockingEnabled(tab) { testTrackingPage(tab.ownerGlobal); } -async function testContentBlockingDisabled(tab) { - info("Testing with Tracking Protection DISABLED."); - - info("Load a test page not containing tracking elements"); - await promiseTabLoadEvent(tab, BENIGN_PAGE); - testBenignPage(); - - info("Load a test page not containing tracking elements which has an exception."); - let isPrivateBrowsing = PrivateBrowsingUtils.isWindowPrivate(tab.ownerGlobal); - let uri = Services.io.newURI("https://example.org/"); - if (isPrivateBrowsing) { - PrivateBrowsingUtils.addToTrackingAllowlist(uri); - } else { - Services.perms.add(uri, "trackingprotection", Services.perms.ALLOW_ACTION); - } - - await promiseTabLoadEvent(tab, uri.spec); - testBenignPageWithException(); - - if (isPrivateBrowsing) { - PrivateBrowsingUtils.removeFromTrackingAllowlist(uri); - } else { - Services.perms.remove(uri, "trackingprotection"); - } - - info("Load a test page containing tracking elements"); - await promiseTabLoadEvent(tab, gTrackingPageURL); - testTrackingPageWithCBDisabled(); -} - add_task(async function testNormalBrowsing() { await UrlClassifierTestUtils.addTestTrackers(); @@ -311,24 +243,12 @@ add_task(async function testNormalBrowsing() { Services.prefs.setIntPref(TPC_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); Services.prefs.setBoolPref(TP_PREF, true); ok(TrackingProtection.enabled, "TP is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(ContentBlocking.enabled, "CB is enabled after setting the pref"); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); gBrowser.removeCurrentTab(); @@ -352,24 +272,12 @@ add_task(async function testPrivateBrowsing() { is(TrackingProtection.enabled, Services.prefs.getBoolPref(TP_PB_PREF), "TP.enabled is based on the pb pref value"); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); Services.prefs.setBoolPref(TP_PB_PREF, true); ok(TrackingProtection.enabled, "TP is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(TrackingProtection.enabled, "CB is enabled after setting the pref"); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); privateWin.close(); @@ -390,27 +298,13 @@ add_task(async function testThirdPartyCookies() { is(ThirdPartyCookies.enabled, Services.prefs.getIntPref(TPC_PREF) == Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, "TPC.enabled is based on the original pref value"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(ContentBlocking.enabled, "CB is enabled after setting the pref"); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); Services.prefs.setIntPref(TPC_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER); ok(ThirdPartyCookies.enabled, "TPC is enabled after setting the pref"); - Services.prefs.setBoolPref(CB_PREF, true); - ok(ContentBlocking.enabled, "CB is enabled after setting the pref"); - await testContentBlockingEnabled(tab); - - Services.prefs.setBoolPref(CB_PREF, false); - ok(!ContentBlocking.enabled, "CB is disabled after setting the pref"); - - await testContentBlockingDisabled(tab); + await testContentBlocking(tab); Services.prefs.clearUserPref(TPC_PREF); gBrowser.removeCurrentTab(); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_state_all_disabled.js b/browser/base/content/test/trackingUI/browser_trackingUI_state_all_disabled.js index 469d0435a371..08926de29cc5 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_state_all_disabled.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_state_all_disabled.js @@ -5,7 +5,6 @@ const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html"; const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html"; -const CB_PREF = "browser.contentblocking.enabled"; const TP_PREF = "privacy.trackingprotection.enabled"; const FB_PREF = "browser.fastblock.enabled"; const COOKIE_PREF = "network.cookie.cookieBehavior"; @@ -15,7 +14,6 @@ const ANIMATIONS_PREF = "toolkit.cosmeticAnimations.enabled"; // categories are turned off, even when content blocking is on. add_task(async function testContentBlockingAllDisabled() { await SpecialPowers.pushPrefEnv({set: [ - [CB_PREF, true], [TP_PREF, false], [FB_PREF, false], [COOKIE_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT], diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js b/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js index 19b4110deef8..ce7e19689374 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js @@ -39,8 +39,6 @@ add_task(async function setup() { let scalars = Services.telemetry.snapshotScalars( Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT, false).parent; - is(scalars["contentblocking.enabled"], Services.prefs.getBoolPref("browser.contentblocking.enabled"), - "CB enabled status was recorded at startup"); is(scalars["contentblocking.exceptions"], 0, "no CB exceptions at startup"); }); diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 669afc8d57c5..73be5c71141e 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -1364,9 +1364,6 @@ BrowserGlue.prototype = { let cookieBehavior = Services.prefs.getIntPref("network.cookie.cookieBehavior"); Services.telemetry.getHistogramById("COOKIE_BEHAVIOR").add(cookieBehavior); - let contentBlockingEnabled = Services.prefs.getBoolPref("browser.contentblocking.enabled"); - Services.telemetry.scalarSet("contentblocking.enabled", contentBlockingEnabled); - let exceptions = 0; for (let permission of Services.perms.enumerator) { if (permission.type == "trackingprotection") { diff --git a/browser/components/uitour/test/browser_contentBlocking.js b/browser/components/uitour/test/browser_contentBlocking.js index 56a46feb053a..e9fa1b032a33 100644 --- a/browser/components/uitour/test/browser_contentBlocking.js +++ b/browser/components/uitour/test/browser_contentBlocking.js @@ -1,7 +1,6 @@ "use strict"; const PREF_INTRO_COUNT = "browser.contentblocking.introCount"; -const PREF_CB_ENABLED = "browser.contentblocking.enabled"; const PREF_TP_ENABLED = "privacy.trackingprotection.enabled"; const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html"; const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html"; @@ -12,7 +11,6 @@ var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/Url registerCleanupFunction(function() { UrlClassifierTestUtils.cleanupTestTrackers(); - Services.prefs.clearUserPref(PREF_CB_ENABLED); Services.prefs.clearUserPref(PREF_TP_ENABLED); Services.prefs.clearUserPref(PREF_INTRO_COUNT); }); @@ -22,7 +20,6 @@ function allowOneIntro() { } add_task(async function setup_test() { - Services.prefs.setBoolPref(PREF_CB_ENABLED, true); Services.prefs.setBoolPref(PREF_TP_ENABLED, true); await UrlClassifierTestUtils.addTestTrackers(); }); diff --git a/browser/components/uitour/test/browser_trackingProtection.js b/browser/components/uitour/test/browser_trackingProtection.js index 3e3d620c84f9..353309c1cf27 100644 --- a/browser/components/uitour/test/browser_trackingProtection.js +++ b/browser/components/uitour/test/browser_trackingProtection.js @@ -1,7 +1,6 @@ "use strict"; const PREF_INTRO_COUNT = "browser.contentblocking.introCount"; -const PREF_CB_ENABLED = "browser.contentblocking.enabled"; const PREF_TP_ENABLED = "privacy.trackingprotection.enabled"; const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html"; const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html"; @@ -12,7 +11,6 @@ var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/Url registerCleanupFunction(function() { UrlClassifierTestUtils.cleanupTestTrackers(); - Services.prefs.clearUserPref(PREF_CB_ENABLED); Services.prefs.clearUserPref(PREF_TP_ENABLED); }); @@ -21,7 +19,6 @@ function allowOneIntro() { } add_task(async function setup_test() { - Services.prefs.setBoolPref(PREF_CB_ENABLED, true); Services.prefs.setBoolPref(PREF_TP_ENABLED, true); await UrlClassifierTestUtils.addTestTrackers(); }); diff --git a/browser/themes/shared/controlcenter/panel.inc.css b/browser/themes/shared/controlcenter/panel.inc.css index 3ef6b62360c0..dcce5116daaa 100644 --- a/browser/themes/shared/controlcenter/panel.inc.css +++ b/browser/themes/shared/controlcenter/panel.inc.css @@ -400,17 +400,7 @@ description#identity-popup-content-verifier, stroke: #d7b600; } -#identity-popup-content-blocking-content[enabled][hasException] #identity-popup-content-blocking-disabled-label-global { - display: none; -} - -#identity-popup-content-blocking-content:not([enabled]) #identity-popup-content-blocking-disabled-label { - display: -moz-box; - background-color: #d70022; - stroke: #d70022; -} - -#identity-popup-content-blocking-content:not([enabled]) #identity-popup-content-blocking-disabled-label-exception { +#identity-popup-content-blocking-content[hasException] #identity-popup-content-blocking-disabled-label-global { display: none; } @@ -444,7 +434,7 @@ description#identity-popup-content-verifier, display: none; } -#identity-popup-content-blocking-content[enabled][hasException] .identity-popup-content-blocking-category-state-label, +#identity-popup-content-blocking-content[hasException] .identity-popup-content-blocking-category-state-label, .identity-popup-content-blocking-category:not(.blocked) .identity-popup-content-blocking-category-state-label { display: none; } @@ -480,10 +470,9 @@ description#identity-popup-content-verifier, margin-top: 6px; } -/* Hide the "report breakage" button if TP is off or we have not detected any - * trackers (except if the user added an exception, in which case they might - * still (especially!) want to report the breakage). */ -#identity-popup-content-blocking-content:not([enabled]) #identity-popup-content-blocking-report-breakage, +/* Hide the "report breakage" button if we have not detected any trackers + * (except if the user added an exception, in which case they might still + * (especially!) want to report the breakage). */ #identity-popup-content-blocking-content:not([active]):not([hasException]) #identity-popup-content-blocking-report-breakage { display: none; } @@ -494,7 +483,7 @@ description#identity-popup-content-verifier, /* Offer to permanently add an exception in normal mode. */ #main-window[privatebrowsingmode] #identity-popup-content-blocking-content[active]:not([hasException]) > #tracking-action-unblock-private, /* If there's an exception just offer to remove the exception again. */ -#identity-popup-content-blocking-content[enabled][hasException] > #tracking-action-block { +#identity-popup-content-blocking-content[hasException] > #tracking-action-block { display: -moz-box; } diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 110b63ccd6b0..64dc611325ee 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -442,20 +442,6 @@ security: - main contentblocking: - enabled: - bug_numbers: - - 1484251 - description: > - Whether content blocking was enabled at startup. - expires: never - kind: boolean - notification_emails: - - jhofmann@mozilla.com - - pdol@mozilla.com - - seceng-telemetry@mozilla.com - release_channel_collection: opt-out - record_in_processes: - - main exceptions: bug_numbers: - 1484251