Bug 1231359 - Simplify the hidden preferences that control whether Tracking Protection is enabled in non-private windows.
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -25,17 +25,20 @@ var gPrivacyPane = {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
let link = document.getElementById("trackingProtectionLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
+ this.trackingProtectionReadPrefs();
+
document.getElementById("trackingprotectionbox").hidden = false;
+ document.getElementById("trackingprotectionpbmbox").hidden = true;
},
#endif
/**
* Linkify the Learn More link of the Private Browsing Mode Tracking
* Protection UI.
*/
_initTrackingProtectionPBM: function () {
@@ -115,18 +118,64 @@ var gPrivacyPane = {
setEventListener("privateBrowsingAutoStart", "command",
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
gPrivacyPane.showCookieExceptions);
setEventListener("showCookiesButton", "command",
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
+ setEventListener("trackingProtectionRadioGroup", "command",
+ gPrivacyPane.trackingProtectionWritePrefs);
setEventListener("changeBlockList", "command",
gPrivacyPane.showBlockLists);
+ setEventListener("changeBlockListPBM", "command",
+ gPrivacyPane.showBlockLists);
+ },
+
+ // TRACKING PROTECTION MODE
+
+ /**
+ * Selects the right item of the Tracking Protection radiogroup.
+ */
+ trackingProtectionReadPrefs: function ()
+ {
+ var enabledPref = document.getElementById("privacy.trackingprotection.enabled");
+ var pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
+ var radiogroup = document.getElementById("trackingProtectionRadioGroup");
+
+ // Global enable takes precedence over enabled in Private Browsing.
+ radiogroup.value = enabledPref.value ? "always" :
+ pbmPref.value ? "private" :
+ "never";
+ },
+
+ /**
+ * Sets the pref values based on the selected item of the radiogroup.
+ */
+ trackingProtectionWritePrefs: function ()
+ {
+ var enabledPref = document.getElementById("privacy.trackingprotection.enabled");
+ var pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
+ var radiogroup = document.getElementById("trackingProtectionRadioGroup");
+
+ switch (radiogroup.value) {
+ case "always":
+ enabledPref.value = true;
+ pbmPref.value = true;
+ break;
+ case "private":
+ enabledPref.value = false;
+ pbmPref.value = true;
+ break;
+ case "never":
+ enabledPref.value = false;
+ pbmPref.value = false;
+ break;
+ }
},
// HISTORY MODE
/**
* The list of preferences which affect the initial history mode settings.
* If the auto start private browsing mode pref is active, the initial
* history mode would be set to "Don't remember anything".
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -79,39 +79,53 @@
data-category="panePrivacy">
<label class="header-name" flex="1">&panePrivacy.title;</label>
<button class="help-button"
aria-label="&helpButton.label;"/>
</hbox>
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
- <caption><label>&tracking.label;</label></caption>
<vbox id="trackingprotectionbox" hidden="true">
- <hbox align="center">
- <checkbox id="trackingProtection"
- preference="privacy.trackingprotection.enabled"
- accesskey="&trackingProtection5.accesskey;"
- label="&trackingProtection5.label;" />
- <label id="trackingProtectionLearnMore"
- class="text-link"
- value="&trackingProtectionLearnMore.label;"/>
+ <hbox align="start">
+ <vbox>
+ <caption><label>&trackingProtectionHeader.label;
+ <label id="trackingProtectionLearnMore" class="text-link"
+ value="&trackingProtectionLearnMore.label;"/>
+ </label></caption>
+ <radiogroup id="trackingProtectionRadioGroup">
+ <radio value="always"
+ label="&trackingProtectionAlways.label;"
+ accesskey="&trackingProtectionAlways.accesskey;"/>
+ <radio value="private"
+ label="&trackingProtectionPrivate.label;"
+ accesskey="&trackingProtectionPrivate.accesskey;"/>
+ <radio value="never"
+ label="&trackingProtectionNever.label;"
+ accesskey="&trackingProtectionNever.accesskey;"/>
+ </radiogroup>
+ </vbox>
+ <spacer flex="1" />
+ <button id="changeBlockList"
+ label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
+ preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox id="trackingprotectionpbmbox">
+ <caption><label>&tracking.label;</label></caption>
<hbox align="center">
<checkbox id="trackingProtectionPBM"
preference="privacy.trackingprotection.pbmode.enabled"
accesskey="&trackingProtectionPBM5.accesskey;"
label="&trackingProtectionPBM5.label;" />
<label id="trackingProtectionPBMLearnMore"
class="text-link"
value="&trackingProtectionPBMLearnMore.label;"/>
<spacer flex="1" />
- <button id="changeBlockList"
+ <button id="changeBlockListPBM"
label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<html:a
class="inline-link" id="doNotTrackSettings" href="#"
>&doNotTrack.settings.label;</html:a>&doNotTrack.post.label;</description>
--- a/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
@@ -1,17 +1,22 @@
<!-- 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/. -->
-<!ENTITY tracking.label "Tracking">
+<!ENTITY trackingProtectionHeader.label "Use Tracking Protection">
+<!ENTITY trackingProtectionAlways.label "Always">
+<!ENTITY trackingProtectionAlways.accesskey "y">
+<!ENTITY trackingProtectionPrivate.label "Only in Private Browsing">
+<!ENTITY trackingProtectionPrivate.accesskey "l">
+<!ENTITY trackingProtectionNever.label "Never">
+<!ENTITY trackingProtectionNever.accesskey "n">
+<!ENTITY trackingProtectionLearnMore.label "Learn more">
-<!ENTITY trackingProtection5.label "Use Tracking Protection">
-<!ENTITY trackingProtection5.accesskey "i">
-<!ENTITY trackingProtectionLearnMore.label "Learn more">
+<!ENTITY tracking.label "Tracking">
<!ENTITY trackingProtectionPBM5.label "Use Tracking Protection in Private Windows">
<!ENTITY trackingProtectionPBM5.accesskey "v">
<!ENTITY trackingProtectionPBMLearnMore.label "Learn more">
<!ENTITY changeBlockList.label "Change Block List">
<!ENTITY changeBlockList.accesskey "C">
<!-- LOCALIZATION NOTE (doNotTrack.pre.label): include a trailing space as needed -->
<!-- LOCALIZATION NOTE (doNotTrack.post.label): include a starting space as needed -->
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -222,16 +222,17 @@ treecol {
/* Privacy pane */
.doNotTrackLearnMore,
#trackingProtectionPBMLearnMore,
#trackingProtectionLearnMore {
-moz-margin-start: 1.5em !important;
margin-top: 0;
+ font-weight: normal;
}
/* 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"]) > #hasAccount,
#weavePrefsDeck:not([selectedIndex="2"]) > #needsUpdate,