Bug 1258041 - Update the tracking protection list selection UI to account for the DNT-related changes. r?jaws r?francois draft
authorPanos Astithas <past@mozilla.com>
Tue, 24 May 2016 20:15:40 +0300
changeset 372093 37c01bf2ca007527910a1256444ebd6c9d114aae
parent 372031 4a7a28982402ba18d512b8d5cefa52b504d4ad9c
child 522094 2128597c775527e5fc5567eed91a2bb630700c3f
push id19436
push userbmo:past@mozilla.com
push dateFri, 27 May 2016 11:32:09 +0000
reviewersjaws, francois
bugs1258041
milestone49.0a1
Bug 1258041 - Update the tracking protection list selection UI to account for the DNT-related changes. r?jaws r?francois MozReview-Commit-ID: Gf98ufkowhx
browser/components/preferences/blocklists.js
modules/libpref/init/all.js
--- a/browser/components/preferences/blocklists.js
+++ b/browser/components/preferences/blocklists.js
@@ -1,14 +1,15 @@
 /* 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/. */
 
 Components.utils.import("resource://gre/modules/Services.jsm");
-const TEST_LIST = "test-track-simple";
+const BASE_LIST_ID = "base";
+const CONTENT_LIST_ID = "content";
 const TRACK_SUFFIX = "-track-digest256";
 const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
 const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
 const UPDATE_TIME_PREF = "browser.safebrowsing.provider.mozilla.nextupdatetime";
 
 var gBlocklistManager = {
   _type: "",
   _blockLists: [],
@@ -127,17 +128,22 @@ var gBlocklistManager = {
       if (shouldProceed) {
         let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
                            .createInstance(Ci.nsISupportsPRBool);
         Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
                                      "restart");
         shouldProceed = !cancelQuit.data;
 
         if (shouldProceed) {
-          let trackingTable = TEST_LIST + "," + selected.id + TRACK_SUFFIX;
+          let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
+          if (selected.id != CONTENT_LIST_ID) {
+            trackingTable = trackingTable.replace("," + CONTENT_LIST_ID + TRACK_SUFFIX, "");
+          } else {
+            trackingTable += "," + CONTENT_LIST_ID + TRACK_SUFFIX;
+          }
           Services.prefs.setCharPref(TRACKING_TABLE_PREF, trackingTable);
           Services.prefs.setCharPref(UPDATE_TIME_PREF, 42);
 
           Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit |
                                 Ci.nsIAppStartup.eRestart);
         }
       }
 
@@ -188,19 +194,16 @@ var gBlocklistManager = {
 
   _updateTree: function () {
     this._tree = document.getElementById("blocklistsTree");
     this._view._rowCount = this._blockLists.length;
     this._tree.view = this._view;
   },
 
   _getActiveList: function () {
-    let activeList = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
-    activeList = activeList.replace(TEST_LIST, "");
-    activeList = activeList.replace(",", "");
-    activeList = activeList.replace(TRACK_SUFFIX, "");
-    return activeList.trim();
+    let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
+    return trackingTable.includes(CONTENT_LIST_ID) ? CONTENT_LIST_ID : BASE_LIST_ID;
   }
 };
 
 function initWithParams(params) {
   gBlocklistManager.init(params);
 }
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5002,21 +5002,21 @@ pref("urlclassifier.downloadBlockTable",
  // Only download the whitelist on Windows, since the whitelist is
  // only useful for suppressing remote lookups for signed binaries which we can
  // only verify on Windows (Bug 974579). Other platforms always do remote lookups.
 pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-digest256");
 #else
 pref("urlclassifier.downloadAllowTable", "");
 #endif
 
-pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-forbid-simple,goog-downloadwhite-digest256,mozstd-track-digest256,mozstd-trackwhite-digest256,mozfull-track-digest256,test-block-simple,mozplugin-block-digest256,mozplugin2-block-digest256");
+pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-forbid-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,test-block-simple,mozplugin-block-digest256,mozplugin2-block-digest256");
 
 // The table and update/gethash URLs for Safebrowsing phishing and malware
 // checks.
-pref("urlclassifier.trackingTable", "test-track-simple,mozstd-track-digest256");
+pref("urlclassifier.trackingTable", "test-track-simple,base-track-digest256");
 pref("urlclassifier.trackingWhitelistTable", "test-trackwhite-simple,mozstd-trackwhite-digest256");
 
 // The number of random entries to send with a gethash request.
 pref("urlclassifier.gethashnoise", 4);
 
 // Gethash timeout for Safebrowsing.
 pref("urlclassifier.gethash.timeout_ms", 5000);
 
@@ -5061,27 +5061,27 @@ pref("browser.safebrowsing.forbiddenURIs
 pref("urlclassifier.forbiddenTable", "test-forbid-simple");
 
 // The table and global pref for blocking plugin content
 pref("browser.safebrowsing.blockedURIs.enabled", false);
 pref("urlclassifier.blockedTable", "test-block-simple,mozplugin-block-digest256");
 
 // The protocol version we communicate with mozilla server.
 pref("browser.safebrowsing.provider.mozilla.pver", "2.2");
-pref("browser.safebrowsing.provider.mozilla.lists", "mozstd-track-digest256,mozstd-trackwhite-digest256,mozfull-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256");
+pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256");
 pref("browser.safebrowsing.provider.mozilla.updateURL", "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
 pref("browser.safebrowsing.provider.mozilla.gethashURL", "https://shavar.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
 // Set to a date in the past to force immediate download in new profiles.
 pref("browser.safebrowsing.provider.mozilla.nextupdatetime", "1");
 // Block lists for tracking protection. The name values will be used as the keys
 // to lookup the localized name in preferences.properties.
-pref("browser.safebrowsing.provider.mozilla.lists.mozstd.name", "mozstdName");
-pref("browser.safebrowsing.provider.mozilla.lists.mozstd.description", "mozstdDesc");
-pref("browser.safebrowsing.provider.mozilla.lists.mozfull.name", "mozfullName");
-pref("browser.safebrowsing.provider.mozilla.lists.mozfull.description", "mozfullDesc");
+pref("browser.safebrowsing.provider.mozilla.lists.base.name", "mozstdName");
+pref("browser.safebrowsing.provider.mozilla.lists.base.description", "mozstdDesc");
+pref("browser.safebrowsing.provider.mozilla.lists.content.name", "mozfullName");
+pref("browser.safebrowsing.provider.mozilla.lists.content.description", "mozfullDesc");
 
 // Allow users to ignore Safe Browsing warnings.
 pref("browser.safebrowsing.allowOverride", true);
 
 #ifdef MOZILLA_OFFICIAL
 // Normally the "client ID" sent in updates is appinfo.name, but for
 // official Firefox releases from Mozilla we use a special identifier.
 pref("browser.safebrowsing.id", "navclient-auto-ffox");