Bug 1501977 - Remove global Content Blocking toggle in about:preferences. r=flod,Ehsan
authorJohann Hofmann <jhofmann@mozilla.com>
Fri, 26 Oct 2018 18:08:53 +0000
changeset 443210 74a560ef3b51f2054faaf99182f7e4ef3978ab26
parent 443209 4755e3693c1ff7d9e1729a51f6d9a82df367cdb7
child 443211 e1404c73b666d9b79bc7b103128f59c095d743b4
push id34944
push userncsoregi@mozilla.com
push dateSat, 27 Oct 2018 09:49:55 +0000
treeherdermozilla-central@49d47a692ca4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflod, Ehsan
bugs1501977
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1501977 - Remove global Content Blocking toggle in about:preferences. r=flod,Ehsan This patch also removes some of the other handling of browser.contentblocking.enabled in about:preferences, such as disabling the cookies and site data section. Differential Revision: https://phabricator.services.mozilla.com/D9915
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/privacy.xul
browser/components/preferences/in-content/tests/browser_contentblocking.js
browser/locales/en-US/browser/preferences/preferences.ftl
browser/themes/shared/incontentprefs/preferences.inc.css
browser/themes/shared/incontentprefs/privacy.css
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -21,19 +21,16 @@ ChromeUtils.defineModuleGetter(this, "Si
 ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingTrackingProtectionUiEnabled",
                                       "browser.contentblocking.trackingprotection.ui.enabled");
 
 XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingRejectTrackersUiEnabled",
                                       "browser.contentblocking.rejecttrackers.ui.enabled");
 
-XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingEnabled",
-                                      "browser.contentblocking.enabled");
-
 const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
 
 const TRACKING_PROTECTION_KEY = "websites.trackingProtectionMode";
 const TRACKING_PROTECTION_PREFS = ["privacy.trackingprotection.enabled",
                                    "privacy.trackingprotection.pbmode.enabled"];
 
 const PREF_OPT_OUT_STUDIES_ENABLED = "app.shield.optoutstudies.enabled";
 const PREF_NORMANDY_ENABLED = "app.normandy.enabled";
@@ -47,19 +44,16 @@ XPCOMUtils.defineLazyGetter(this, "Alert
     alertsService.manualDoNotDisturb;
     return alertsService;
   } catch (ex) {
     return undefined;
   }
 });
 
 Preferences.addAll([
-  // Content Blocking
-  { id: "browser.contentblocking.enabled", type: "bool" },
-
   // Tracking Protection
   { id: "privacy.trackingprotection.enabled", type: "bool" },
   { id: "privacy.trackingprotection.pbmode.enabled", type: "bool" },
   // This isn't a configuration pref, rather it's for saving the previous state
   // of the UI when we turn off the TP controls when the user checks off the
   // All Detected Trackers under Content Blocking.  This pref isn't listed in
   // all.js/firefox.js to make sure it doesn't appear in about:config by default.
   { id: "browser.privacy.trackingprotection.menu", type: "string" },
@@ -172,23 +166,20 @@ var gPrivacyPane = {
   _updateTrackingProtectionUI() {
     let isLocked = TRACKING_PROTECTION_PREFS.some(
       pref => Services.prefs.prefIsLocked(pref));
 
     function setInputsDisabledState(isControlled) {
       let disabled = isLocked || isControlled;
       let tpCheckbox =
         document.getElementById("contentBlockingTrackingProtectionCheckbox");
-      // Only enable the TP menu if content blocking and Detect All Trackers
-      // are enabled.
+      // Only enable the TP menu if Detect All Trackers is enabled.
       document.getElementById("trackingProtectionMenu").disabled = disabled ||
-        !tpCheckbox.checked ||
-        !contentBlockingEnabled;
-      // Only enable the TP category checkbox if content blocking is enabled.
-      tpCheckbox.disabled = disabled || !contentBlockingEnabled;
+        !tpCheckbox.checked;
+      tpCheckbox.disabled = disabled;
 
       // Notify observers that the TP UI has been updated.
       // This is needed since our tests need to be notified about the
       // trackingProtectionMenu element getting disabled/enabled at the right time.
       Services.obs.notifyObservers(window, "privacy-pane-tp-ui-updated");
     }
 
     if (isLocked) {
@@ -252,18 +243,16 @@ var gPrivacyPane = {
 
     /* Initialize Content Blocking */
     this.initContentBlocking();
 
     this.trackingProtectionReadPrefs();
     this.networkCookieBehaviorReadPrefs();
     this._initTrackingProtectionExtensionControl();
 
-    this.updateContentBlockingVisibility();
-
     Preferences.get("privacy.trackingprotection.enabled").on("change",
       gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane));
     Preferences.get("privacy.trackingprotection.pbmode.enabled").on("change",
       gPrivacyPane.trackingProtectionReadPrefs.bind(gPrivacyPane));
 
     // Watch all of the prefs that the new Cookies & Site Data UI depends on
     Preferences.get("network.cookie.cookieBehavior").on("change",
       gPrivacyPane.networkCookieBehaviorReadPrefs.bind(gPrivacyPane));
@@ -429,21 +418,16 @@ var gPrivacyPane = {
   },
 
   // CONTENT BLOCKING
 
   /**
    * Initializes the content blocking section.
    */
   initContentBlocking() {
-    let contentBlockingCheckbox = document.getElementById("contentBlockingCheckbox");
-    setEventListener("contentBlockingToggle", "command",
-      () => contentBlockingCheckbox.click());
-    setEventListener("contentBlockingToggle", "command",
-      this.updateContentBlockingControls);
     setEventListener("changeBlockListLink", "click", this.showBlockLists);
     setEventListener("contentBlockingRestoreDefaults", "command",
       this.restoreContentBlockingPrefs);
     setEventListener("contentBlockingTrackingProtectionCheckbox", "command",
       this.trackingProtectionWritePrefs);
     setEventListener("contentBlockingTrackingProtectionCheckbox", "command",
       this._updateTrackingProtectionUI);
     setEventListener("trackingProtectionMenu", "command",
@@ -506,93 +490,16 @@ var gPrivacyPane = {
 
   /**
    * Highlights the Cookies & Site Data UI section.
    */
   changeCookieSettings() {
     gotoPref("privacy-sitedata");
   },
 
-  /**
-   * Changes the visibility of elements in the CB section depending on the
-   * content blocking UI prefs.
-   */
-  updateContentBlockingVisibility() {
-    // Potentially hide the global toggle.
-    document.getElementById("contentBlockingCheckboxContainer").hidden =
-      !Services.prefs.getBoolPref("browser.contentblocking.global-toggle.enabled", true);
-  },
-
-  /**
-   * Updates the preferences UI to reflect the browser.contentblocking.enabled pref.
-   * This affects the button to toggle the pref and the disabled state of the dependent controls.
-   */
-  updateContentBlockingToggle() {
-    let onOrOff = contentBlockingEnabled ? "on" : "off";
-    let contentBlockingToggle = document.getElementById("contentBlockingToggle");
-    let contentBlockingToggleLabel = document.getElementById("contentBlockingToggleLabel");
-
-    document.l10n.setAttributes(contentBlockingToggle,
-      "content-blocking-toggle-" + onOrOff);
-    contentBlockingToggle.setAttribute("aria-pressed", contentBlockingEnabled);
-    document.l10n.setAttributes(contentBlockingToggleLabel,
-      "content-blocking-toggle-label-" + onOrOff);
-
-    this.updateContentBlockingControls();
-  },
-
-  /**
-   * Changes the disabled state of controls that depend on the browser.contentblocking.enabled pref.
-   */
-  updateContentBlockingControls() {
-    let dependentControls = [
-      "#content-blocking-categories-label",
-      ".content-blocking-checkbox",
-      "#changeBlockListLink",
-      "#contentBlockingChangeCookieSettings",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#blockCookies, #blockCookies > radio",
-    ];
-
-    this._toggleControls(dependentControls, contentBlockingEnabled);
-
-    // The list of dependent controls here would normally include #blockCookiesLabel,
-    // #blockCookiesMenu, #keepUntil and #keepCookiesUntil, but in order to avoid
-    // having two parts of the code responsible for figuring out whether these
-    // controls must be enabled or disabled, we offload that responsibility to
-    // networkCookieBehaviorReadPrefs() which already knows how to deal with it.
-    this.networkCookieBehaviorReadPrefs();
-
-    // If Content Blocking gets disabled, show the warning in the Cookies and Site Data section.
-    let blockCookiesWarning = document.getElementById("blockCookiesWarning");
-    blockCookiesWarning.hidden = contentBlockingEnabled;
-
-    // Need to make sure we account for pref locking/extension overrides when enabling the TP menu.
-    this._updateTrackingProtectionUI();
-
-    // If we are turning Content Blocking on, we may need to keep some parts of the Third-Party Cookies
-    // UI off, depending on the value of the cookieBehavior pref.  readBlockCookiesCheckbox() can do
-    // the work that is needed for that.
-    this.readBlockCookiesCheckbox();
-  },
-
-  _toggleControls(dependentControls, enabled) {
-    for (let selector of dependentControls) {
-      let controls = document.querySelectorAll(selector);
-
-      for (let control of controls) {
-        if (enabled) {
-          control.removeAttribute("disabled");
-        } else {
-          control.setAttribute("disabled", "true");
-        }
-      }
-    }
-  },
-
   // TRACKING PROTECTION MODE
 
   /**
    * Selects the right item of the Tracking Protection radiogroup.
    */
   trackingProtectionReadPrefs() {
     let enabledPref = Preferences.get("privacy.trackingprotection.enabled");
     let pbmPref = Preferences.get("privacy.trackingprotection.pbmode.enabled");
@@ -637,27 +544,26 @@ var gPrivacyPane = {
   networkCookieBehaviorReadPrefs() {
     let behavior = Preferences.get("network.cookie.cookieBehavior").value;
     let blockCookiesCtrl = document.getElementById("blockCookies");
     let blockCookiesLabel = document.getElementById("blockCookiesLabel");
     let blockCookiesMenu = document.getElementById("blockCookiesMenu");
     let keepUntilLabel = document.getElementById("keepUntil");
     let keepUntilMenu = document.getElementById("keepCookiesUntil");
 
-    let disabledByCB = !contentBlockingEnabled;
     let blockCookies = (behavior != 0);
     let cookieBehaviorLocked = Services.prefs.prefIsLocked("network.cookie.cookieBehavior");
-    let blockCookiesControlsDisabled = !blockCookies || cookieBehaviorLocked || disabledByCB;
+    let blockCookiesControlsDisabled = !blockCookies || cookieBehaviorLocked;
     blockCookiesLabel.disabled = blockCookiesMenu.disabled = blockCookiesControlsDisabled;
 
     let completelyBlockCookies = (behavior == 2);
     let privateBrowsing = Preferences.get("browser.privatebrowsing.autostart").value;
     let cookieExpirationLocked = Services.prefs.prefIsLocked("network.cookie.lifetimePolicy");
     let keepUntilControlsDisabled = privateBrowsing || completelyBlockCookies ||
-                                    cookieExpirationLocked || disabledByCB;
+                                    cookieExpirationLocked;
     keepUntilLabel.disabled = keepUntilMenu.disabled = keepUntilControlsDisabled;
 
     switch (behavior) {
       case Ci.nsICookieService.BEHAVIOR_ACCEPT:
         blockCookiesCtrl.value = "allow";
         break;
       case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
         blockCookiesCtrl.value = "disallow";
@@ -1075,46 +981,30 @@ var gPrivacyPane = {
     }
 
     return Ci.nsICookieService.BEHAVIOR_ACCEPT;
   },
 
   enableThirdPartyCookiesUI() {
     document.getElementById("blockCookiesCBDeck").selectedIndex = 0;
     document.getElementById("contentBlockingChangeCookieSettings").hidden = true;
-
-    let dependentControls = [
-      ".reject-trackers-ui .content-blocking-checkbox",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#blockCookiesCBDeck",
-    ];
-
-    this._toggleControls(dependentControls, contentBlockingEnabled);
   },
 
   disableThirdPartyCookiesUI(reason) {
     let deckIndex = 0;
     switch (reason) {
       case "always":
         deckIndex = 1;
         break;
       case "unvisited":
         deckIndex = 2;
         break;
     }
     document.getElementById("blockCookiesCBDeck").selectedIndex = deckIndex;
     document.getElementById("contentBlockingChangeCookieSettings").hidden = false;
-
-    let dependentControls = [
-      ".reject-trackers-ui .content-blocking-checkbox",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#blockCookiesCBDeck",
-    ];
-
-    this._toggleControls(dependentControls, false);
   },
 
   /**
    * Converts between network.cookie.cookieBehavior and the new content blocking UI
    */
   readBlockCookiesCB() {
     let pref = Preferences.get("network.cookie.cookieBehavior");
     switch (pref.value) {
@@ -1179,22 +1069,22 @@ var gPrivacyPane = {
         this.disableThirdPartyCookiesUI("always");
         break;
       case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN:
         this.disableThirdPartyCookiesUI("unvisited");
         break;
       case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
         this.enableThirdPartyCookiesUI();
         bcCheckbox.checked = true;
-        bcControl.disabled = !contentBlockingEnabled;
+        bcControl.disabled = false;
         break;
       case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
         this.enableThirdPartyCookiesUI();
         bcCheckbox.checked = true;
-        bcControl.disabled = !contentBlockingEnabled;
+        bcControl.disabled = false;
         break;
       default:
         break;
     }
   },
 
   /**
    * Converts between network.cookie.cookieBehavior and the new third-party cookies UI
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -48,27 +48,16 @@
                     permissions-button-cancel.label,
                     permissions-button-ok.label,
                     permissions-exceptions-content-blocking-window.title,
                     permissions-exceptions-content-blocking-desc,
                   "/>
         </hbox>
       </vbox>
     </hbox>
-    <hbox id="contentBlockingCheckboxContainer">
-      <checkbox id="contentBlockingCheckbox"
-                onsyncfrompreference="return gPrivacyPane.updateContentBlockingToggle()"
-                preference="browser.contentblocking.enabled"/>
-      <button id="contentBlockingToggle"
-              data-l10n-attrs="tooltiptext"
-              data-l10n-id="content-blocking-toggle-on"/>
-      <label id="contentBlockingToggleLabel"
-             data-l10n-id="content-blocking-toggle-label-on"
-             control="contentBlockingToggle"/>
-    </hbox>
     <vbox id="contentBlockingCategories">
       <label id="content-blocking-categories-label" data-l10n-id="content-blocking-category-label"/>
       <vbox>
         <hbox class="content-blocking-category tracking-protection-ui">
           <vbox>
             <checkbox id="contentBlockingTrackingProtectionCheckbox"
                       class="content-blocking-checkbox" flex="1"
                       src="chrome://browser/skin/controlcenter/trackers.svg"
@@ -166,19 +155,16 @@
 
   <hbox data-subcategory="sitedata" align="baseline">
     <vbox flex="1">
       <description class="description-with-side-element" flex="1">
         <html:span id="totalSiteDataSize" class="tail-with-learn-more"></html:span>
         <label id="siteDataLearnMoreLink"
           class="learnMore text-link" data-l10n-id="sitedata-learn-more"/>
       </description>
-      <description class="description-with-side-element warning-description"
-                   flex="1" hidden="true" id="blockCookiesWarning"
-                   data-l10n-id="sitedata-warning-your-settings-prevent-changes"/>
       <radiogroup id="blockCookies"
                   preference="network.cookie.cookieBehavior"
                   onsyncfrompreference="return gPrivacyPane.readBlockCookies();"
                   onsynctopreference="return gPrivacyPane.writeBlockCookies();">
         <radio value="allow"
                data-l10n-id="sitedata-allow-cookies-option"
                flex="1" />
         <radio value="disallow"
--- a/browser/components/preferences/in-content/tests/browser_contentblocking.js
+++ b/browser/components/preferences/in-content/tests/browser_contentblocking.js
@@ -1,68 +1,22 @@
 /* eslint-env webextensions */
 
-const CB_PREF = "browser.contentblocking.enabled";
 const CB_TP_UI_PREF = "browser.contentblocking.trackingprotection.ui.enabled";
 const CB_RT_UI_PREF = "browser.contentblocking.rejecttrackers.ui.enabled";
 const TP_PREF = "privacy.trackingprotection.enabled";
 const TP_PBM_PREF = "privacy.trackingprotection.pbmode.enabled";
 const TP_LIST_PREF = "urlclassifier.trackingTable";
 const NCB_PREF = "network.cookie.cookieBehavior";
-const TOGGLE_PREF = "browser.contentblocking.global-toggle.enabled";
 
 requestLongerTimeout(2);
 
-// Checks that the content blocking toggle follows and changes the CB pref.
-add_task(async function testContentBlockingToggle() {
-  SpecialPowers.pushPrefEnv({set: [
-    [TOGGLE_PREF, true],
-  ]});
-
-  await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
-  let doc = gBrowser.contentDocument;
-
-  let contentBlockingToggle = doc.getElementById("contentBlockingToggle");
-  let contentBlockingCheckbox = doc.getElementById("contentBlockingCheckbox");
-  let contentBlockingToggleLabel = doc.getElementById("contentBlockingToggleLabel");
-
-  Services.prefs.setBoolPref(CB_PREF, true);
-  await TestUtils.waitForCondition(() => contentBlockingToggleLabel.textContent == "ON", "toggle label is correct");
-
-  ok(contentBlockingCheckbox.checked, "Checkbox is checked when CB is on");
-  is(contentBlockingToggle.getAttribute("aria-pressed"), "true", "toggle button has correct aria attribute");
-
-  Services.prefs.setBoolPref(CB_PREF, false);
-  await TestUtils.waitForCondition(() => contentBlockingToggleLabel.textContent == "OFF", "toggle label is correct");
-
-  ok(!contentBlockingCheckbox.checked, "Checkbox is not checked when CB is off");
-  is(contentBlockingToggle.getAttribute("aria-pressed"), "false", "toggle button has correct aria attribute");
-
-  contentBlockingToggle.click();
-  await TestUtils.waitForCondition(() => contentBlockingToggleLabel.textContent == "ON", "toggle label is correct");
-
-  is(Services.prefs.getBoolPref(CB_PREF), true, "Content Blocking is on");
-  ok(contentBlockingCheckbox.checked, "Checkbox is checked when CB is on");
-  is(contentBlockingToggle.getAttribute("aria-pressed"), "true", "toggle button has correct aria attribute");
-
-  contentBlockingToggle.click();
-  await TestUtils.waitForCondition(() => contentBlockingToggleLabel.textContent == "OFF", "toggle label is correct");
-
-  is(Services.prefs.getBoolPref(CB_PREF), false, "Content Blocking is off");
-  ok(!contentBlockingCheckbox.checked, "Checkbox is not checked when CB is off");
-  is(contentBlockingToggle.getAttribute("aria-pressed"), "false", "toggle button has correct aria attribute");
-
-  Services.prefs.clearUserPref(CB_PREF);
-  gBrowser.removeCurrentTab();
-});
-
 // Tests that the content blocking main category checkboxes have the correct default state.
 add_task(async function testContentBlockingMainCategory() {
   let prefs = [
-    [CB_PREF, true],
     [TP_PREF, false],
     [TP_PBM_PREF, true],
     [NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
   ];
 
   for (let pref of prefs) {
     switch (typeof pref[1]) {
       case "boolean":
@@ -109,28 +63,28 @@ add_task(async function testContentBlock
   always.radioGroup.selectedItem = always;
   ok(!private.selected, "The Only in private windows item should not be selected");
   ok(always.selected, "The Always item should be selected");
 
   // The first time, privacy-pane-tp-ui-updated won't be dispatched since the
   // assignment above is a no-op.
 
   // Ensure the dependent controls are enabled
-  checkControlStateWorker(doc, dependentControls, true);
-  checkControlStateWorker(doc, alwaysEnabledControls, true);
+  checkControlState(doc, dependentControls, true);
+  checkControlState(doc, alwaysEnabledControls, true);
 
   let promise = TestUtils.topicObserved("privacy-pane-tp-ui-updated");
   EventUtils.synthesizeMouseAtCenter(tpCheckbox, {}, doc.defaultView);
 
   await promise;
   ok(!tpCheckbox.checked, "The checkbox should now be unchecked");
 
   // Ensure the dependent controls are disabled
-  checkControlStateWorker(doc, dependentControls, false);
-  checkControlStateWorker(doc, alwaysEnabledControls, true);
+  checkControlState(doc, dependentControls, false);
+  checkControlState(doc, alwaysEnabledControls, true);
 
   // Make sure the selection in the tracking protection submenu persists after
   // a few times of checking and unchecking All Detected Trackers.
   // Doing this in a loop in order to avoid typing in the unrolled version manually.
   // We need to go from the checked state of the checkbox to unchecked back to
   // checked again...
   for (let i = 0; i < 3; ++i) {
     promise = TestUtils.topicObserved("privacy-pane-tp-ui-updated");
@@ -147,35 +101,38 @@ add_task(async function testContentBlock
   for (let pref of prefs) {
     SpecialPowers.clearUserPref(pref[0]);
   }
 });
 
 // Tests that the content blocking "Restore Defaults" button does what it's supposed to.
 add_task(async function testContentBlockingRestoreDefaults() {
   let prefs = {
-    CB_PREF: null,
-    TP_LIST_PREF: null,
-    TP_PREF: null,
-    TP_PBM_PREF: null,
-    NCB_PREF: null,
+    [TP_LIST_PREF]: null,
+    [TP_PREF]: null,
+    [TP_PBM_PREF]: null,
+    [NCB_PREF]: null,
   };
 
   for (let pref in prefs) {
     switch (Services.prefs.getPrefType(pref)) {
     case Services.prefs.PREF_BOOL:
       prefs[pref] = Services.prefs.getBoolPref(pref);
       break;
     case Services.prefs.PREF_INT:
       prefs[pref] = Services.prefs.getIntPref(pref);
       break;
+    case Services.prefs.PREF_STRING:
+      prefs[pref] = Services.prefs.getCharPref(pref);
+      break;
+    default:
+      ok(false, `Unknown pref type for ${pref}`);
     }
   }
 
-  Services.prefs.setBoolPref(CB_PREF, false);
   Services.prefs.setStringPref(TP_LIST_PREF, "test-track-simple,base-track-digest256,content-track-digest256");
   Services.prefs.setBoolPref(TP_PREF, true);
   Services.prefs.setBoolPref(TP_PBM_PREF, false);
   Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER);
 
   for (let pref in prefs) {
     switch (Services.prefs.getPrefType(pref)) {
     case Services.prefs.PREF_BOOL:
@@ -184,16 +141,23 @@ add_task(async function testContentBlock
         ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
       }
       break;
     case Services.prefs.PREF_INT:
       if (Services.prefs.getIntPref(pref) != prefs[pref]) {
         ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
       }
       break;
+    case Services.prefs.PREF_STRING:
+      if (Services.prefs.getCharPref(pref) != prefs[pref]) {
+        ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
+      }
+      break;
+    default:
+      ok(false, `Unknown pref type for ${pref}`);
     }
   }
 
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
   let doc = gBrowser.contentDocument;
 
   let contentBlockingRestoreDefaults = doc.getElementById("contentBlockingRestoreDefaults");
   contentBlockingRestoreDefaults.click();
@@ -222,386 +186,121 @@ add_task(async function testContentBlock
       name: "set_tp",
       applications: {gecko: {id: "@set_tp"}},
       permissions: ["privacy"],
     },
     background,
   });
 
   let resettable = {
-    CB_PREF: null,
-    TP_LIST_PREF: null,
-    NCB_PREF: null,
+    [TP_LIST_PREF]: null,
+    [NCB_PREF]: null,
   };
 
   for (let pref in resettable) {
     switch (Services.prefs.getPrefType(pref)) {
-    case Services.prefs.PREF_BOOL:
-      resettable[pref] = Services.prefs.getBoolPref(pref);
+    case Services.prefs.PREF_STRING:
+      resettable[pref] = Services.prefs.getCharPref(pref);
       break;
     case Services.prefs.PREF_INT:
       resettable[pref] = Services.prefs.getIntPref(pref);
       break;
+    default:
+      ok(false, `Unknown pref type for ${pref}`);
     }
   }
 
-  Services.prefs.setBoolPref(CB_PREF, false);
   Services.prefs.setStringPref(TP_LIST_PREF, "test-track-simple,base-track-digest256,content-track-digest256");
   Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER);
 
   for (let pref in resettable) {
     switch (Services.prefs.getPrefType(pref)) {
-    case Services.prefs.PREF_BOOL:
+    case Services.prefs.PREF_STRING:
       // Account for prefs that may have retained their default value
-      if (Services.prefs.getBoolPref(pref) != resettable[pref]) {
+      if (Services.prefs.getCharPref(pref) != resettable[pref]) {
         ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
       }
       break;
     case Services.prefs.PREF_INT:
       if (Services.prefs.getIntPref(pref) != resettable[pref]) {
         ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
       }
       break;
+    default:
+      ok(false, `Unknown pref type for ${pref}`);
     }
   }
 
   await extension.startup();
 
   await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(TP_PREF));
 
-  let dependentControls = [
-    ".reject-trackers-ui .content-blocking-checkbox",
-    "#content-blocking-categories-label",
-    "#changeBlockListLink",
-    "#contentBlockingChangeCookieSettings",
-    "#blockCookiesCB, #blockCookiesCB > radio",
-  ];
-  let alwaysDisabledControls = [
+  let disabledControls = [
     ".tracking-protection-ui .content-blocking-checkbox",
     "#trackingProtectionMenu",
     "[control=trackingProtectionMenu]",
   ];
 
-  await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
   let doc = gBrowser.contentDocument;
 
+  checkControlState(doc, disabledControls, false);
+
   let contentBlockingRestoreDefaults = doc.getElementById("contentBlockingRestoreDefaults");
   contentBlockingRestoreDefaults.click();
 
   for (let pref in resettable) {
     ok(!Services.prefs.prefHasUserValue(pref), `reset the pref ${pref}`);
   }
 
   ok(Services.prefs.prefHasUserValue(TP_PREF), "did not reset the TP pref");
 
   await extension.unload();
 
   gBrowser.removeCurrentTab();
 });
 
-function checkControlStateWorker(doc, dependentControls, enabled) {
-  for (let selector of dependentControls) {
-    let controls = doc.querySelectorAll(selector);
-    for (let control of controls) {
+function checkControlState(doc, controls, enabled) {
+  for (let selector of controls) {
+    for (let control of doc.querySelectorAll(selector)) {
       if (enabled) {
-        ok(!control.hasAttribute("disabled"), `${selector} is enabled because CB is on.`);
+        ok(!control.hasAttribute("disabled"), `${selector} is enabled.`);
       } else {
-        is(control.getAttribute("disabled"), "true", `${selector} is disabled because CB is off`);
+        is(control.getAttribute("disabled"), "true", `${selector} is disabled.`);
       }
     }
   }
 }
 
-function checkControlState(doc, dependentControls) {
-  let enabled = Services.prefs.getBoolPref(CB_PREF);
-  return checkControlStateWorker(doc, dependentControls, enabled);
-}
-
-async function doDependentControlChecks(dependentControls,
-                                        alwaysDisabledControls = []) {
-  Services.prefs.setBoolPref(CB_PREF, true);
-  Services.prefs.setBoolPref(TOGGLE_PREF, true);
-
-  await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
-  let doc = gBrowser.contentDocument;
-
-  is(Services.prefs.getBoolPref(CB_PREF), true, "Content Blocking is on");
-  checkControlState(doc, dependentControls);
-  checkControlStateWorker(doc, alwaysDisabledControls, false);
-
-  gBrowser.removeCurrentTab();
-
-  Services.prefs.setBoolPref(CB_PREF, false);
-
-  await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
-  doc = gBrowser.contentDocument;
-
-  is(Services.prefs.getBoolPref(CB_PREF), false, "Content Blocking is off");
-  checkControlState(doc, dependentControls);
-  checkControlStateWorker(doc, alwaysDisabledControls, false);
-
-  let contentBlockingToggle = doc.getElementById("contentBlockingToggle");
-  contentBlockingToggle.doCommand();
-
-  await TestUtils.topicObserved("privacy-pane-tp-ui-updated");
-
-  is(Services.prefs.getBoolPref(CB_PREF), true, "Content Blocking is on");
-  checkControlState(doc, dependentControls);
-  checkControlStateWorker(doc, alwaysDisabledControls, false);
-
-  contentBlockingToggle.doCommand();
-
-  await TestUtils.topicObserved("privacy-pane-tp-ui-updated");
-
-  is(Services.prefs.getBoolPref(CB_PREF), false, "Content Blocking is off");
-  checkControlState(doc, dependentControls);
-  checkControlStateWorker(doc, alwaysDisabledControls, false);
-
-  Services.prefs.clearUserPref(CB_PREF);
-  Services.prefs.clearUserPref(TOGGLE_PREF);
-  gBrowser.removeCurrentTab();
-}
-
-// Checks that the granular controls are disabled or enabled depending on the master pref for CB.
-add_task(async function testContentBlockingDependentControls() {
-  // In Accept All Cookies mode, the radiogroup under Third-Party Cookies is always disabled
-  // since the checkbox next to Third-Party Cookies would be unchecked.
-  SpecialPowers.pushPrefEnv({set: [
-    [CB_TP_UI_PREF, true],
-    [CB_RT_UI_PREF, true],
-    [NCB_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT],
-  ]});
-
-  let dependentControls = [
-    ".content-blocking-checkbox",
-    "#content-blocking-categories-label",
-    "#changeBlockListLink",
-    "#contentBlockingChangeCookieSettings",
-    "#blockCookies, #blockCookies > radio",
-    "#keepUntil",
-    "#keepCookiesUntil",
-  ];
-  let alwaysDisabledControls = [
-    "#blockCookiesCB, #blockCookiesCB > radio",
-    "#blockCookiesLabel",
-    "#blockCookiesMenu",
-  ];
-
-  await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-
-  // In Block Cookies from Trackers (or Block Cookies from All Third-Parties) mode, the
-  // radiogroup's disabled status must obey the content blocking enabled state.
-  SpecialPowers.pushPrefEnv({set: [
-    [CB_TP_UI_PREF, true],
-    [CB_RT_UI_PREF, true],
-    [NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
-  ]});
-
-  dependentControls = [
-    ".content-blocking-checkbox",
-    "#content-blocking-categories-label",
-    "#changeBlockListLink",
-    "#contentBlockingChangeCookieSettings",
-    "#blockCookiesCB, #blockCookiesCB > radio",
-    "#blockCookies, #blockCookies > radio",
-    "#blockCookiesLabel",
-    "#blockCookiesMenu",
-    "#keepUntil",
-    "#keepCookiesUntil",
-  ];
-
-  await doDependentControlChecks(dependentControls);
-});
-
 // Checks that the controls for tracking protection are disabled when all TP prefs are off.
 add_task(async function testContentBlockingDependentTPControls() {
   SpecialPowers.pushPrefEnv({set: [
     [CB_TP_UI_PREF, true],
     [CB_RT_UI_PREF, true],
     [TP_PREF, false],
     [TP_PBM_PREF, false],
     [NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
   ]});
 
-  let dependentControls = [
-    "#content-blocking-categories-label",
-    "[control=trackingProtectionMenu]",
-    "#changeBlockListLink",
-    "#contentBlockingChangeCookieSettings",
-    "#blockCookiesCB, #blockCookiesCB > radio",
-    "#blockCookies, #blockCookies > radio",
-    "#blockCookiesLabel",
-    "#blockCookiesMenu",
-    "#keepUntil",
-    "#keepCookiesUntil",
-  ];
-  let alwaysDisabledControls = [
+  let disabledControls = [
     "#trackingProtectionMenu",
   ];
 
-  await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-});
-
-
-// Checks that the granular controls are disabled or enabled depending on the master pref for CB
-// when the Cookies and Site Data section is set to block either "All Cookies" or "Cookies from
-// unvisited websites".
-add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
-  let prefValuesToTest = [
-    Ci.nsICookieService.BEHAVIOR_REJECT,        // Block All Cookies
-  ];
-  for (let value of prefValuesToTest) {
-    await SpecialPowers.pushPrefEnv({set: [
-      [CB_TP_UI_PREF, true],
-      [CB_RT_UI_PREF, true],
-      [TP_PREF, false],
-      [TP_PBM_PREF, true],
-      [NCB_PREF, value],
-    ]});
-
-    // When Block All Cookies is selected, the Third-Party Cookies section under Content Blocking
-    // as well as the Keep Until controls under Cookies and Site Data should get disabled
-    // unconditionally.
-    let dependentControls = [
-      "#content-blocking-categories-label",
-      "#contentBlockingTrackingProtectionCheckbox",
-      ".tracking-protection-icon",
-      "#trackingProtectionMenu",
-      "[control=trackingProtectionMenu]",
-      "#changeBlockListLink",
-      "#contentBlockingChangeCookieSettings",
-      "#blockCookies, #blockCookies > radio",
-      "#blockCookiesLabel",
-      "#blockCookiesMenu",
-    ];
-    let alwaysDisabledControls = [
-      "[control=blockCookiesCB]",
-      "#blockCookiesCBDeck",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#keepUntil",
-      "#keepCookiesUntil",
-    ];
-
-    await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-  }
-
-  // When Block Cookies from unvisited websites is selected, the Third-Party Cookies section under
-  // Content Blocking should get disabled unconditionally.
-  prefValuesToTest = [
-    Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN, // Block Cookies from unvisited websites
-  ];
-  for (let value of prefValuesToTest) {
-    await SpecialPowers.pushPrefEnv({set: [
-      [CB_TP_UI_PREF, true],
-      [CB_RT_UI_PREF, true],
-      [TP_PREF, false],
-      [TP_PBM_PREF, true],
-      [NCB_PREF, value],
-    ]});
+  await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
+  let doc = gBrowser.contentDocument;
 
-    let dependentControls = [
-      "#content-blocking-categories-label",
-      "#contentBlockingTrackingProtectionCheckbox",
-      ".tracking-protection-icon",
-      "#trackingProtectionMenu",
-      "[control=trackingProtectionMenu]",
-      "#changeBlockListLink",
-      "#contentBlockingChangeCookieSettings",
-      "#blockCookies, #blockCookies > radio",
-      "#blockCookiesLabel",
-      "#blockCookiesMenu",
-      "#keepUntil",
-      "#keepCookiesUntil",
-    ];
-    let alwaysDisabledControls = [
-      "[control=blockCookiesCB]",
-      "#blockCookiesCBDeck",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-    ];
-
-    await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-  }
-
-  // When Accept All Cookies is selected, the radio buttons under Third-Party Cookies
-  // in Content Blocking as well as the Type blocked controls in Cookies and Site Data
-  // must remain disabled unconditionally.
-  prefValuesToTest = [
-    Ci.nsICookieService.BEHAVIOR_ACCEPT,         // Accept All Cookies
-  ];
-  for (let value of prefValuesToTest) {
-    await SpecialPowers.pushPrefEnv({set: [
-      [CB_TP_UI_PREF, true],
-      [CB_RT_UI_PREF, true],
-      [TP_PREF, false],
-      [TP_PBM_PREF, true],
-      [NCB_PREF, value],
-    ]});
+  checkControlState(doc, disabledControls, false);
 
-    let dependentControls = [
-      "#content-blocking-categories-label",
-      ".content-blocking-checkbox",
-      "#trackingProtectionMenu",
-      "[control=trackingProtectionMenu]",
-      "#changeBlockListLink",
-      "#contentBlockingChangeCookieSettings",
-      "#blockCookies, #blockCookies > radio",
-      "#keepUntil",
-      "#keepCookiesUntil",
-    ];
-    let alwaysDisabledControls = [
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#blockCookiesLabel",
-      "#blockCookiesMenu",
-    ];
-
-    await doDependentControlChecks(dependentControls, alwaysDisabledControls);
-  }
-
-  // For other choices of cookie policies, no parts of the UI should get disabled
-  // unconditionally.
-  prefValuesToTest = [
-    Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN, // Block All Third-Party Cookies
-    Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, // Block Cookies from third-party trackers
-  ];
-  for (let value of prefValuesToTest) {
-    await SpecialPowers.pushPrefEnv({set: [
-      [CB_TP_UI_PREF, true],
-      [CB_RT_UI_PREF, true],
-      [TP_PREF, false],
-      [TP_PBM_PREF, true],
-      [NCB_PREF, value],
-    ]});
-
-    let dependentControls = [
-      "#content-blocking-categories-label",
-      ".content-blocking-checkbox",
-      "#trackingProtectionMenu",
-      "[control=trackingProtectionMenu]",
-      "#changeBlockListLink",
-      "#contentBlockingChangeCookieSettings",
-      "#blockCookiesCB, #blockCookiesCB > radio",
-      "#blockCookies, #blockCookies > radio",
-      "#blockCookiesLabel",
-      "#blockCookiesMenu",
-      "#keepUntil",
-      "#keepCookiesUntil",
-    ];
-
-    await doDependentControlChecks(dependentControls);
-  }
+  gBrowser.removeCurrentTab();
 });
 
-
 // Checks that the warnings in the Content Blocking Third-Party Cookies section correctly appear based on
 // the selections in the Cookies and Site Data section.
 add_task(async function testContentBlockingThirdPartyCookiesWarning() {
   await SpecialPowers.pushPrefEnv({set: [
-    [CB_PREF, true],
     [CB_TP_UI_PREF, true],
     [CB_RT_UI_PREF, true],
   ]});
 
   let expectedDeckIndex = new Map([
     [Ci.nsICookieService.BEHAVIOR_ACCEPT, 0],
     [Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN, 0],
     [Ci.nsICookieService.BEHAVIOR_REJECT, 1],
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -784,21 +784,16 @@ sitedata-clear =
 sitedata-settings =
     .label = Manage Data…
     .accesskey = M
 
 sitedata-cookies-exceptions =
     .label = Exceptions…
     .accesskey = E
 
-# This is a warning message shown next to a yellow warning icon when the Cookies and Site Data subsection
-# in Preferences has been disabled due to Content Blocking being disabled. It is displayed next to the
-# Cookies and Site Data section.
-sitedata-warning-your-settings-prevent-changes = Your settings in Content Blocking are preventing changes to Cookies and Site Data settings.
-
 ## Privacy Section - Address Bar
 
 addressbar-header = Address Bar
 
 addressbar-suggest = When using the address bar, suggest
 
 addressbar-locbar-history-option =
     .label = Browsing history
@@ -818,26 +813,16 @@ content-blocking-header = Content Blocki
 
 content-blocking-desc = Block third-party content, like ads or code, that can slow your browsing and track you around the web. Customize your settings for the best balance of protection and performance.
 
 content-blocking-learn-more = Learn more
 content-blocking-restore-defaults =
   .label = Restore Defaults
   .accesskey = R
 
-content-blocking-toggle-on =
-  .tooltiptext = Turn Off Content Blocking
-content-blocking-toggle-off =
-  .tooltiptext = Turn On Content Blocking
-
-content-blocking-toggle-label-on = ON
-  .accesskey = O
-content-blocking-toggle-label-off = OFF
-  .accesskey = O
-
 content-blocking-category-label = Choose what to block
 
 content-blocking-tracking-protection-trackers-label =
   .label = Trackers
   .accesskey = T
 content-blocking-tracking-protection-all-detected-trackers-label =
   .label = All Detected Trackers
   .accesskey = T
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -412,21 +412,16 @@ button > hbox > label {
   justify-content: space-between;
 }
 
 #blockCookies,
 #keepRow {
   margin-top: 1.5em;
 }
 
-#blockCookiesWarning {
-  margin-top: 1.5em !important;
-  margin-bottom: -1em !important;
-}
-
 /* Collapse the non-active vboxes in decks to use only the height the
    active vbox needs */
 #historyPane:not([selectedIndex="1"]) > #historyDontRememberPane,
 #historyPane:not([selectedIndex="2"]) > #historyCustomPane,
 #weavePrefsDeck:not([selectedIndex="1"]) > #hasFxaAccount,
 #fxaLoginStatus:not([selectedIndex="1"]) > #fxaLoginUnverified,
 #fxaLoginStatus:not([selectedIndex="2"]) > #fxaLoginRejected {
   visibility: collapse;
--- a/browser/themes/shared/incontentprefs/privacy.css
+++ b/browser/themes/shared/incontentprefs/privacy.css
@@ -49,81 +49,20 @@
 }
 
 /* Content Blocking */
 
 #contentBlockingLearnMore {
   margin-top: 4px !important;
 }
 
-#contentBlockingCategories,
-#contentBlockingCheckboxContainer {
+#contentBlockingCategories {
   margin-top: 16px;
 }
 
-#contentBlockingToggleLabel {
-  line-height: 34px;
-}
-
-#contentBlockingCheckbox {
-  visibility: collapse;
-}
-
-/* If shown, the button-box takes up some space that results
- * in unwanted changes in right-hand margin when toggling
- * this button. We just hide it since we don't need it. */
-#contentBlockingToggle > .button-box {
-  display: none;
-}
-
-#contentBlockingToggle {
-  -moz-appearance: none;
-  box-sizing: border-box;
-  min-width: 48px;
-  max-width: 48px;
-  min-height: 30px;
-  max-height: 30px;
-  border-radius: 20px;
-  background-color: #d7d7db;
-  border: 1px solid transparent;
-  margin-top: 2px;
-  margin-bottom: 2px;
-  margin-inline-start: 1px;
-  margin-inline-end: 7px;
-  padding: 5px;
-  transition: padding .2s ease;
-}
-
-#contentBlockingToggle::before {
-  position: relative;
-  display: block;
-  content: "";
-  width: 18px;
-  height: 18px;
-  border-radius: 10px;
-  background: white;
-}
-
-#contentBlockingCheckbox[checked="true"] + #contentBlockingToggle {
-  background-color: #2292d0;
-  border: 1px solid #2292d0;
-  /* Push the toggle to the right. */
-  padding-inline-start: 23px;
-}
-
-#contentBlockingToggle:hover,
-#contentBlockingToggle:-moz-focusring {
-  border: 1px solid #b1b1b3;
-}
-
-#contentBlockingCheckbox[checked] + #contentBlockingToggle:hover,
-#contentBlockingCheckbox[checked] + #contentBlockingToggle:-moz-focusring {
-  background-color: #0a84ff;
-}
-
 .content-blocking-category {
   margin: 16px 0;
 }
 
 .content-blocking-category-labels {
   padding-inline-start: 4px;
   margin-inline-start: 25px !important;
 }