Bug 1060852 - Part 1: Code changes to expose privacy.trackingprotection.enabled in privacy preferences and account for removal of do-not-track options r=IanN ui-r=Neil a=IanN CLOSED TREE
authorrsx11m <rsx11m.pub@gmail.com>
Thu, 13 Nov 2014 02:16:20 +0800
changeset 21294 f4287827157c88e5eecbc3dc1ace2ff22614ad0d
parent 21293 ca2967aceeb17f3e8739fd2398e05e48efd6fc02
child 21295 27e18a0a0685f6898e75c6108d75e83170b25fcf
push id1274
push usermbanner@mozilla.com
push dateMon, 12 Jan 2015 19:54:49 +0000
treeherdercomm-beta@baea280adc1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, Neil, IanN
bugs1060852
Bug 1060852 - Part 1: Code changes to expose privacy.trackingprotection.enabled in privacy preferences and account for removal of do-not-track options r=IanN ui-r=Neil a=IanN CLOSED TREE
suite/browser/browser-prefs.js
suite/common/pref/pref-security.js
suite/common/pref/pref-security.xul
suite/common/src/nsSuiteGlue.js
suite/locales/en-US/chrome/common/pref/pref-security.dtd
--- a/suite/browser/browser-prefs.js
+++ b/suite/browser/browser-prefs.js
@@ -931,28 +931,28 @@ pref("services.sync.prefs.sync.mailnews.
 pref("services.sync.prefs.sync.mailnews.ui.junk.manualMarkAsJunkMarksRead", true);
 pref("services.sync.prefs.sync.mailnews.view_default_charset", true);
 pref("services.sync.prefs.sync.mailnews.wraplength", true);
 pref("services.sync.prefs.sync.network.cookie.cookieBehavior", true);
 pref("services.sync.prefs.sync.network.cookie.lifetimePolicy", true);
 pref("services.sync.prefs.sync.offline-apps.allow_by_default", true);
 pref("services.sync.prefs.sync.permissions.default.image", true);
 pref("services.sync.prefs.sync.privacy.donottrackheader.enabled", true);
-pref("services.sync.prefs.sync.privacy.donottrackheader.value", true);
 pref("services.sync.prefs.sync.privacy.item.cache", true);
 pref("services.sync.prefs.sync.privacy.item.cookies", true);
 pref("services.sync.prefs.sync.privacy.item.downloads", true);
 pref("services.sync.prefs.sync.privacy.item.formdata", true);
 pref("services.sync.prefs.sync.privacy.item.history", true);
 pref("services.sync.prefs.sync.privacy.item.offlineApps", true);
 pref("services.sync.prefs.sync.privacy.item.passwords", true);
 pref("services.sync.prefs.sync.privacy.item.sessions", true);
 pref("services.sync.prefs.sync.privacy.item.urlbar", true);
 pref("services.sync.prefs.sync.privacy.sanitize.promptOnSanitize", true);
 pref("services.sync.prefs.sync.privacy.sanitize.sanitizeOnShutdown", true);
+pref("services.sync.prefs.sync.privacy.trackingprotection.enabled", true);
 pref("services.sync.prefs.sync.security.OCSP.enabled", true);
 pref("services.sync.prefs.sync.security.OCSP.require", true);
 pref("services.sync.prefs.sync.security.default_personal_cert", true);
 pref("services.sync.prefs.sync.security.mixed_content.block_active_content", true);
 pref("services.sync.prefs.sync.security.mixed_content.block_display_content", true);
 pref("services.sync.prefs.sync.security.tls.version.min", true);
 pref("services.sync.prefs.sync.security.tls.version.max", true);
 pref("services.sync.prefs.sync.security.warn_entering_secure", true);
--- a/suite/common/pref/pref-security.js
+++ b/suite/common/pref/pref-security.js
@@ -1,19 +1,9 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-/**
- * Enable the DNT ".value" radiogroup only if the ".enabled" box is checked
- */
-
 function Startup()
 {
-  var prefAutostart = document.getElementById("privacy.donottrackheader.enabled");
-  SetDntValueEnabled(prefAutostart.value);
+  // intentionally left empty for soon-ish use
 }
-
-function SetDntValueEnabled(aEnable)
-{
-  EnableElementById("dntSelection", aEnable, false);
-}
--- a/suite/common/pref/pref-security.xul
+++ b/suite/common/pref/pref-security.xul
@@ -10,60 +10,51 @@
 <!ENTITY % prefSecurityDTD SYSTEM "chrome://communicator/locale/pref/pref-security.dtd">
 %prefSecurityDTD;
 ]>
 
 <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <prefpane id="security_pane" label="&pref.security.title;"
             script="chrome://communicator/content/pref/pref-security.js">
     <preferences id="security_preferences">
-      <!-- Do Not Track -->
+      <!-- User Tracking -->
       <preference id="privacy.donottrackheader.enabled"
                   name="privacy.donottrackheader.enabled"
-                  onchange="SetDntValueEnabled(this.value);"
                   type="bool"/>
-      <preference id="privacy.donottrackheader.value"
-                  name="privacy.donottrackheader.value"
-                  type="int"/>
+      <preference id="privacy.trackingprotection.enabled"
+                  name="privacy.trackingprotection.enabled"
+                  type="bool"/>
 
       <!-- Location Aware Browsing -->
       <preference id="geo.enabled"
                   name="geo.enabled"
                   type="bool"/>
 
       <!-- Safe Browsing -->
       <preference id="browser.safebrowsing.malware.enabled"
                   name="browser.safebrowsing.malware.enabled"
                   type="bool"/>
       <preference id="browser.safebrowsing.enabled"
                   name="browser.safebrowsing.enabled"
                   type="bool"/>
     </preferences>
 
-    <!-- Do Not Track -->
-    <groupbox id="doNotTrackGroup">
+    <!-- User Tracking -->
+    <groupbox id="trackingGroup">
       <caption label="&tracking.label;"/>
 
       <description>&trackingIntro.label;</description>
-      <checkbox id="dntTellSites"
-                label="&dntTellSites.label;"
-                accesskey="&dntTellSites.accesskey;"
+      <checkbox id="doNotTrack"
+                label="&doNotTrack.label;"
+                accesskey="&doNotTrack.accesskey;"
                 preference="privacy.donottrackheader.enabled"/>
-      <radiogroup id="dntSelection"
-                  class="indent"
-                  preference="privacy.donottrackheader.value">
-        <radio id="dntNoTrack"
-               value="1"
-               label="&dntTrackingNotOkay.label;"
-               accesskey="&dntTrackingNotOkay.accesskey;"/>
-        <radio id="dntDoTrack"
-               value="0"
-               label="&dntTrackingOkay.label;"
-               accesskey="&dntTrackingOkay.accesskey;"/>
-      </radiogroup>
+      <checkbox id="trackProtect"
+                label="&trackProtect.label;"
+                accesskey="&trackProtect.accesskey;"
+                preference="privacy.trackingprotection.enabled"/>
     </groupbox>
 
     <!-- REMOVE #ifndef once bug 903439 is fixed -->
 #ifndef RELEASE_BUILD
     <!-- Location Aware Browsing -->
     <groupbox id="geoLocationGroup">
       <caption label="&geoLocation.label;"/>
 
--- a/suite/common/src/nsSuiteGlue.js
+++ b/suite/common/src/nsSuiteGlue.js
@@ -913,17 +913,27 @@ SuiteGlue.prototype = {
       } catch(ex) { /* Use default. */ }
 
       PlacesBackups.create(maxBackups); // Don't force creation.
     }
   },
 
   _updatePrefs: function()
   {
-    // Get the preferences service
+    // Make sure that the doNotTrack value conforms to the conversion from
+    // three-state to two-state. (This reverts a setting of "please track me"
+    // to the default "don't say anything").
+    try {
+      if (Services.prefs.getIntPref("privacy.donottrackheader.value") != 1) {
+        Services.prefs.clearUserPref("privacy.donottrackheader.enabled");
+        Services.prefs.clearUserPref("privacy.donottrackheader.value");
+      }
+    } catch (ex) {}
+
+    // Migration of download-manager preferences
     if (Services.prefs.getPrefType("browser.download.dir") == Services.prefs.PREF_INVALID ||
         Services.prefs.getPrefType("browser.download.lastDir") != Services.prefs.PREF_INVALID)
       return; //Do nothing if .dir does not exist, or if it exists and lastDir does not
 
     try {
       Services.prefs.setComplexValue("browser.download.lastDir",
                                      Components.interfaces.nsILocalFile,
                                      Services.prefs.getComplexValue("browser.download.dir",
@@ -943,17 +953,17 @@ SuiteGlue.prototype = {
     try {
       Services.prefs.setIntPref("browser.download.manager.behavior",
                                 Services.prefs.getIntPref("browser.downloadmanager.behavior"));
     } catch (ex) {}
 
     try {
       Services.prefs.setBoolPref("browser.download.progress.closeWhenDone",
                                  !Services.prefs.getBoolPref("browser.download.progressDnldDialog.keepAlive"));
-    } catch (e) {}
+    } catch (ex) {}
   },
 
   /**
    * Devtools Debugger
    */
   get dbgIsEnabled()
   {
     return Services.prefs.getBoolPref(DEBUGGER_REMOTE_ENABLED);
--- a/suite/locales/en-US/chrome/common/pref/pref-security.dtd
+++ b/suite/locales/en-US/chrome/common/pref/pref-security.dtd
@@ -3,22 +3,20 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!--LOCALIZATION NOTE : FILE 'Privacy and Security' prefs settings -->
 <!ENTITY pref.security.title              "Privacy &amp; Security">
 
 <!ENTITY tracking.label                   "User Tracking">
 <!ENTITY trackingIntro.label              "Websites may track how you use them, thus affecting your privacy.">
 
-<!ENTITY dntTellSites.label               "Tell websites about my tracking preference">
-<!ENTITY dntTellSites.accesskey           "T">
-<!ENTITY dntTrackingNotOkay.label         "I do not want to be tracked">
-<!ENTITY dntTrackingNotOkay.accesskey     "n">
-<!ENTITY dntTrackingOkay.label            "I consent to being tracked">
-<!ENTITY dntTrackingOkay.accesskey        "c">
+<!ENTITY doNotTrack.label                 "Tell websites that I do not want to be tracked">
+<!ENTITY doNotTrack.accesskey             "T">
+<!ENTITY trackProtect.label               "Prevent tracking activities by known sites">
+<!ENTITY trackProtect.accesskey           "n">
 
 <!ENTITY geoLocation.label                "Location Aware Browsing">
 <!ENTITY geoIntro.label                   "Websites may request more information about your current location.">
 
 <!ENTITY geoEnabled.label                 "Prompt me for permission if a request is made">
 <!ENTITY geoEnabled.accesskey             "m">
 <!ENTITY geoDisabled.label                "Disable this feature and deny all requests">
 <!ENTITY geoDisabled.accesskey            "D">