Bug 1501286 - Part 3: Remove support for tracking protection UI in about:privatebrowsing r=johannh
☠☠ backed out by 5e471c480b8a ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 25 Oct 2018 13:35:22 +0000
changeset 491333 d9940451c3734f9de2f074005d81ef0e6ca4a3ec
parent 491332 ca6c3139bdd23efd00bc545df3bdf5a272650968
child 491334 578d395f555ee3d71cacb239f5f84ce897b313cb
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjohannh
bugs1501286
milestone65.0a1
Bug 1501286 - Part 3: Remove support for tracking protection UI in about:privatebrowsing r=johannh Depends on D9520 Differential Revision: https://phabricator.services.mozilla.com/D9521
browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
toolkit/components/remotepagemanager/MessagePort.jsm
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -1,49 +1,28 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* eslint-env mozilla/frame-script */
 
 const CB_ENABLED_PREF = "browser.contentblocking.enabled";
-const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled";
 const TP_ENABLED_PREF = "privacy.trackingprotection.enabled";
 const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
 
-let contentBlockingUIEnabled = false;
-
 function updateTPInfo() {
   let tpButton = document.getElementById("tpButton");
   let tpToggle = document.getElementById("tpToggle");
-  let title = document.getElementById("title");
-  let titleTracking = document.getElementById("titleTracking");
   let tpSubHeader = document.getElementById("tpSubHeader");
 
-  let tpTitle = document.getElementById("tpTitle");
-  let cbTitle = document.getElementById("cbTitle");
-  let tpDescription = document.getElementById("tpDescription");
-  let cbDescription = document.getElementById("cbDescription");
-
-  tpTitle.toggleAttribute("hidden", contentBlockingUIEnabled);
-  tpDescription.toggleAttribute("hidden", contentBlockingUIEnabled);
-
-  cbTitle.toggleAttribute("hidden", !contentBlockingUIEnabled);
-  cbDescription.toggleAttribute("hidden", !contentBlockingUIEnabled);
-
   let globalTrackingEnabled = RPMGetBoolPref(TP_ENABLED_PREF);
   let trackingEnabled = globalTrackingEnabled || RPMGetBoolPref(TP_PB_ENABLED_PREF);
 
-  if (contentBlockingUIEnabled) {
-    let contentBlockingEnabled = RPMGetBoolPref(CB_ENABLED_PREF);
-    trackingEnabled = trackingEnabled && contentBlockingEnabled;
-  } else {
-    title.toggleAttribute("hidden", trackingEnabled);
-    titleTracking.toggleAttribute("hidden", !trackingEnabled);
-  }
+  let contentBlockingEnabled = RPMGetBoolPref(CB_ENABLED_PREF);
+  trackingEnabled = trackingEnabled && contentBlockingEnabled;
 
   // if tracking protection is enabled globally we don't even give the user
   // a choice here by hiding the toggle completely.
   tpButton.toggleAttribute("hidden", globalTrackingEnabled);
   tpToggle.checked = trackingEnabled;
 
   tpSubHeader.classList.toggle("tp-off", !trackingEnabled);
 }
@@ -53,39 +32,36 @@ document.addEventListener("DOMContentLoa
     document.documentElement.classList.remove("private");
     document.documentElement.classList.add("normal");
     document.getElementById("startPrivateBrowsing").addEventListener("click", function() {
       RPMSendAsyncMessage("OpenPrivateWindow");
     });
     return;
   }
 
-  contentBlockingUIEnabled = RPMGetBoolPref(CB_UI_ENABLED_PREF);
-
   document.getElementById("startTour").addEventListener("click", function() {
     RPMSendAsyncMessage("DontShowIntroPanelAgain");
   });
 
   let introURL = RPMGetFormatURLPref("privacy.trackingprotection.introURL");
-  // If the CB UI is enabled, tell the tour page to show a different variation
-  // that is updated to reflect the CB control center UI.
-  let variation = "?variation=" + (contentBlockingUIEnabled ? "1" : "0");
+  // Variation 1 is specific to the Content Blocking UI.
+  let variation = "?variation=1";
 
   document.getElementById("startTour").setAttribute("href", introURL + variation);
 
   document.getElementById("learnMore").setAttribute("href",
     RPMGetFormatURLPref("app.support.baseURL") + "private-browsing");
 
   let tpToggle = document.getElementById("tpToggle");
   document.getElementById("tpButton").addEventListener("click", () => {
     tpToggle.click();
   });
   tpToggle.addEventListener("change", async function() {
     let promises = [];
-    if (tpToggle.checked && contentBlockingUIEnabled) {
+    if (tpToggle.checked) {
       promises.push(RPMSetBoolPref(CB_ENABLED_PREF, true));
     }
 
     promises.push(RPMSetBoolPref(TP_PB_ENABLED_PREF, tpToggle.checked));
 
     await Promise.all(promises);
 
     updateTPInfo();
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ -29,17 +29,16 @@
   <body dir="&locale.dir;">
     <p class="showNormal">&aboutPrivateBrowsing.notPrivate;</p>
     <button id="startPrivateBrowsing"
             class="showNormal"
             accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;">&privatebrowsingpage.openPrivateWindow.label;</button>
     <div class="showPrivate container">
       <h1 class="title">
         <span id="title">&privateBrowsing.title;</span>
-        <span id="titleTracking" hidden="hidden">&privateBrowsing.title.tracking;</span>
       </h1>
       <section class="section-main">
         <p>&aboutPrivateBrowsing.info.notsaved.before;<strong>&aboutPrivateBrowsing.info.notsaved.emphasize;</strong>&aboutPrivateBrowsing.info.notsaved.after;</p>
         <div class="list-row">
           <ul>
             <li>&aboutPrivateBrowsing.info.visited;</li>
             <li>&aboutPrivateBrowsing.info.cookies;</li>
             <li>&aboutPrivateBrowsing.info.searches;</li>
@@ -53,24 +52,22 @@
             <li>&aboutPrivateBrowsing.info.downloads;</li>
             <li>&aboutPrivateBrowsing.info.clipboard;</li>
           </ul>
         </div>
         <p>&aboutPrivateBrowsing.note.before;<strong>&aboutPrivateBrowsing.note.emphasize;</strong>&aboutPrivateBrowsing.note.after;</p>
       </section>
 
       <h2 id="tpSubHeader" class="about-subheader">
-        <span id="tpTitle">&trackingProtection.title;</span>
         <span id="cbTitle">&contentBlocking.title;</span>
         <input id="tpToggle" class="toggle toggle-input" type="checkbox"/>
         <span id="tpButton" class="toggle-btn"></span>
       </h2>
 
       <section class="section-main">
-        <p id="tpDescription">&trackingProtection.description2;</p>
         <p id="cbDescription">&contentBlocking.description;</p>
         <p>
           <a id="startTour" class="button">&trackingProtection.startTour1;</a>
         </p>
       </section>
 
       <section class="section-main">
         <p class="about-info">&aboutPrivateBrowsing.learnMore3.before;<a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore3.title;</a>&aboutPrivateBrowsing.learnMore3.after;</p>
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
 const CB_ENABLED_PREF = "browser.contentblocking.enabled";
-const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled";
 
 /**
  * Opens a new private window and loads "about:privatebrowsing" there.
  */
 async function openAboutPrivateBrowsing() {
   let win = await BrowserTestUtils.openNewBrowserWindow({
     private: true,
     waitForTabURL: "about:privatebrowsing",
@@ -49,46 +48,17 @@ async function testLinkOpensUrl({ win, t
 /**
  * Tests the links in "about:privatebrowsing".
  */
 add_task(async function test_links() {
   // Use full version and change the remote URLs to prevent network access.
   Services.prefs.setCharPref("app.support.baseURL", "https://example.com/");
   Services.prefs.setCharPref("privacy.trackingprotection.introURL",
                              "https://example.com/tour");
-  Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, false);
   registerCleanupFunction(function() {
-    Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
-    Services.prefs.clearUserPref("privacy.trackingprotection.introURL");
-    Services.prefs.clearUserPref("app.support.baseURL");
-  });
-
-  let { win, tab } = await openAboutPrivateBrowsing();
-
-  await testLinkOpensTab({ win, tab,
-    elementId: "learnMore",
-    expectedUrl: "https://example.com/private-browsing",
-  });
-
-  await testLinkOpensUrl({ win, tab,
-    elementId: "startTour",
-    expectedUrl: "https://example.com/tour?variation=0",
-  });
-
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function test_links_CB() {
-  // Use full version and change the remote URLs to prevent network access.
-  Services.prefs.setCharPref("app.support.baseURL", "https://example.com/");
-  Services.prefs.setCharPref("privacy.trackingprotection.introURL",
-                             "https://example.com/tour");
-  Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, true);
-  registerCleanupFunction(function() {
-    Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
     Services.prefs.clearUserPref("privacy.trackingprotection.introURL");
     Services.prefs.clearUserPref("app.support.baseURL");
   });
 
   let { win, tab } = await openAboutPrivateBrowsing();
 
   await testLinkOpensTab({ win, tab,
     elementId: "learnMore",
@@ -113,67 +83,25 @@ function waitForPrefChanged(pref) {
       },
     };
     Services.prefs.addObserver(pref, prefObserver);
   });
 }
 
 /**
  * Tests the action to disable and re-enable Tracking Protection in
- * "about:privatebrowsing".
- */
-add_task(async function test_toggleTrackingProtection() {
-  // Use tour version but disable Tracking Protection.
-  Services.prefs.setBoolPref(TP_PB_ENABLED_PREF, true);
-  // For good measure, check that content blocking being off
-  // has no impact if the contentblocking UI is not shown.
-  Services.prefs.setBoolPref(CB_ENABLED_PREF, false);
-  Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, false);
-
-  registerCleanupFunction(function() {
-    Services.prefs.clearUserPref(TP_PB_ENABLED_PREF);
-    Services.prefs.clearUserPref(CB_ENABLED_PREF);
-    Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
-  });
-
-  let { win, tab } = await openAboutPrivateBrowsing();
-
-  // Set up the observer for the preference change before triggering the action.
-  let promisePrefChanged = waitForPrefChanged(TP_PB_ENABLED_PREF);
-  await ContentTask.spawn(tab, {}, async function() {
-    is(content.document.getElementById("tpToggle").checked, true, "toggle is active");
-    content.document.getElementById("tpButton").click();
-  });
-  await promisePrefChanged;
-  ok(!Services.prefs.getBoolPref(TP_PB_ENABLED_PREF), "Tracking Protection is disabled.");
-
-  promisePrefChanged = waitForPrefChanged(TP_PB_ENABLED_PREF);
-  await ContentTask.spawn(tab, {}, async function() {
-    is(content.document.getElementById("tpToggle").checked, false, "toggle is not active");
-    content.document.getElementById("tpButton").click();
-  });
-  await promisePrefChanged;
-  ok(Services.prefs.getBoolPref(TP_PB_ENABLED_PREF), "Tracking Protection is enabled.");
-
-  await BrowserTestUtils.closeWindow(win);
-});
-
-/**
- * Tests the action to disable and re-enable Tracking Protection in
  * "about:privatebrowsing" when content blocking is disabled.
  */
 add_task(async function test_toggleTrackingProtectionContentBlocking() {
   Services.prefs.setBoolPref(TP_PB_ENABLED_PREF, true);
   Services.prefs.setBoolPref(CB_ENABLED_PREF, false);
-  Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, true);
 
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref(TP_PB_ENABLED_PREF);
     Services.prefs.clearUserPref(CB_ENABLED_PREF);
-    Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
   });
 
   let { win, tab } = await openAboutPrivateBrowsing();
 
   let promiseCBPrefChanged = waitForPrefChanged(CB_ENABLED_PREF);
   await ContentTask.spawn(tab, {}, async function() {
     is(content.document.getElementById("tpToggle").checked, false, "toggle is not active");
     content.document.getElementById("tpButton").click();
--- a/browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
+++ b/browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
@@ -2,17 +2,16 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!ENTITY aboutPrivateBrowsing.notPrivate                 "You are currently not in a private window.">
 <!ENTITY privatebrowsingpage.openPrivateWindow.label     "Open a Private Window">
 <!ENTITY privatebrowsingpage.openPrivateWindow.accesskey "P">
 
 <!ENTITY privateBrowsing.title                           "Private Browsing">
-<!ENTITY privateBrowsing.title.tracking                  "Private Browsing with Tracking Protection">
 <!ENTITY aboutPrivateBrowsing.info.notsaved.before       "When you browse in a Private Window, Firefox ">
 <!ENTITY aboutPrivateBrowsing.info.notsaved.emphasize    "does not save">
 <!ENTITY aboutPrivateBrowsing.info.notsaved.after        ":">
 <!ENTITY aboutPrivateBrowsing.info.visited               "visited pages">
 <!ENTITY aboutPrivateBrowsing.info.searches              "searches">
 <!ENTITY aboutPrivateBrowsing.info.cookies               "cookies">
 <!ENTITY aboutPrivateBrowsing.info.temporaryFiles        "temporary files">
 <!ENTITY aboutPrivateBrowsing.info.saved.before          "Firefox ">
@@ -23,14 +22,12 @@
 <!ENTITY aboutPrivateBrowsing.info.clipboard             "copied text">
 <!ENTITY aboutPrivateBrowsing.note.before                "Private Browsing ">
 <!ENTITY aboutPrivateBrowsing.note.emphasize             "doesn’t make you anonymous">
 <!ENTITY aboutPrivateBrowsing.note.after                 " on the Internet. Your employer or Internet service provider can still know what page you visit.">
 <!ENTITY aboutPrivateBrowsing.learnMore3.before          "Learn more about ">
 <!ENTITY aboutPrivateBrowsing.learnMore3.title           "Private Browsing">
 <!ENTITY aboutPrivateBrowsing.learnMore3.after           ".">
 
-<!ENTITY trackingProtection.title                        "Tracking Protection">
-<!ENTITY trackingProtection.description2                 "Some websites use trackers that can monitor your activity across the Internet. With Tracking Protection Firefox will block many trackers that can collect information about your browsing behavior.">
 <!ENTITY trackingProtection.startTour1                   "See how it works">
 
 <!ENTITY contentBlocking.title                           "Content Blocking">
 <!ENTITY contentBlocking.description                     "Some websites use trackers that can monitor your activity across the Internet. In private windows, Firefox Content Blocking automatically blocks many trackers that can collect information about your browsing behavior.">
--- a/browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
+++ b/browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
@@ -81,18 +81,17 @@ p {
 .about-subheader.tp-off {
   background-image: url("chrome://browser/skin/privatebrowsing/tracking-protection-off.svg");
 }
 
 .about-info {
   font-size: .9em;
 }
 
-#cbTitle,
-#tpTitle {
+#cbTitle {
   margin-inline-end: 12px;
 }
 
 a.button {
   padding: 3px 20px;
   background-color: #8000d7;
   border: 1px solid #6000a1;
   text-decoration: none;
--- a/toolkit/components/remotepagemanager/MessagePort.jsm
+++ b/toolkit/components/remotepagemanager/MessagePort.jsm
@@ -22,17 +22,16 @@ ChromeUtils.defineModuleGetter(this, "Pr
 let RPMAccessManager = {
   accessMap: {
     "about:privatebrowsing": {
       // "sendAsyncMessage": handled within AboutPrivateBrowsingHandler.jsm
       // "setBoolPref": handled within AsyncPrefs.jsm and uses the prefs
       //                ["browser.contentblocking.enabled",
       //                 "privacy.trackingprotection.pbmode.enabled"],
       "getBoolPref": ["browser.contentblocking.enabled",
-                      "browser.contentblocking.ui.enabled",
                       "privacy.trackingprotection.enabled",
                       "privacy.trackingprotection.pbmode.enabled"],
       "getFormatURLPref": ["privacy.trackingprotection.introURL",
                            "app.support.baseURL"],
       "isWindowPrivate": ["yes"],
     },
   },