Bug 1042135 - Change three-state DNT back to two state and update text in Fennec. (r=liuche)

--HG--
extra : rebase_source : 4cb863131033da3cbbccb80751264d324aeda3e7
This commit is contained in:
Margaret Leibovic 2014-09-19 14:41:44 -07:00
parent aa0b466295
commit 6fc4058278
5 changed files with 23 additions and 65 deletions

View File

@ -172,10 +172,8 @@
<!ENTITY pref_cookies_not_accept_foreign "Enabled, excluding 3rd party">
<!ENTITY pref_cookies_disabled "Disabled">
<!ENTITY pref_donottrack_menu "Tracking">
<!ENTITY pref_donottrack_disallow_tracking "Tell sites that I do not want to be tracked">
<!ENTITY pref_donottrack_allow_tracking "Tell sites that I want to be tracked">
<!ENTITY pref_donottrack_no_pref "Do not tell sites anything about my tracking preferences">
<!ENTITY pref_donottrack_title "Do not track">
<!ENTITY pref_donottrack_summary "&brandShortName; will tell sites that you do not want to be tracked">
<!ENTITY pref_char_encoding "Character encoding">
<!ENTITY pref_char_encoding_on "Show menu">

View File

@ -54,16 +54,6 @@
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="pref_donottrack_entries">
<item>@string/pref_donottrack_disallow_tracking</item>
<item>@string/pref_donottrack_allow_tracking</item>
<item>@string/pref_donottrack_no_pref</item>
</string-array>
<string-array name="pref_donottrack_values">
<item>1</item>
<item>2</item>
<item>0</item>
</string-array>
<string-array name="pref_import_android_entries">
<item>@string/bookmarks_title</item>

View File

@ -8,11 +8,11 @@
android:title="@string/pref_category_privacy_short"
android:enabled="false">
<ListPreference android:key="privacy.donottrackheader"
android:title="@string/pref_donottrack_menu"
android:entries="@array/pref_donottrack_entries"
android:entryValues="@array/pref_donottrack_values"
android:persistent="false" />
<CheckBoxPreference android:key="privacy.donottrackheader.enabled"
android:title="@string/pref_donottrack_title"
android:summary="@string/pref_donottrack_summary"
android:defaultValue="false"
android:persistent="false" />
<ListPreference android:key="network.cookie.cookieBehavior"
android:title="@string/pref_cookies_menu"

View File

@ -181,10 +181,8 @@
<string name="pref_cookies_not_accept_foreign">&pref_cookies_not_accept_foreign;</string>
<string name="pref_cookies_disabled">&pref_cookies_disabled;</string>
<string name="pref_donottrack_menu">&pref_donottrack_menu;</string>
<string name="pref_donottrack_disallow_tracking">&pref_donottrack_disallow_tracking;</string>
<string name="pref_donottrack_allow_tracking">&pref_donottrack_allow_tracking;</string>
<string name="pref_donottrack_no_pref">&pref_donottrack_no_pref;</string>
<string name="pref_donottrack_title">&pref_donottrack_title;</string>
<string name="pref_donottrack_summary">&pref_donottrack_summary;</string>
<string name="pref_char_encoding">&pref_char_encoding;</string>
<string name="pref_char_encoding_on">&pref_char_encoding_on;</string>

View File

@ -198,12 +198,6 @@ const kDefaultCSSViewportHeight = 480;
const kViewportRemeasureThrottle = 500;
const kDoNotTrackPrefState = Object.freeze({
NO_PREF: "0",
DISALLOW_TRACKING: "1",
ALLOW_TRACKING: "2",
});
let Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog;
// Define the "dump" function as a binding of the Log.d function so it specifies
@ -838,6 +832,20 @@ var BrowserApp = {
Services.prefs.clearUserPref("plugins.click_to_play");
}
// Migrate the "privacy.donottrackheader.value" pref. See bug 1042135.
if (Services.prefs.prefHasUserValue("privacy.donottrackheader.value")) {
// Make sure 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").
if (Services.prefs.getBoolPref("privacy.donottrackheader.enabled") &&
(Services.prefs.getIntPref("privacy.donottrackheader.value") != 1)) {
Services.prefs.clearUserPref("privacy.donottrackheader.enabled");
}
// This pref has been removed, so always clear it.
Services.prefs.clearUserPref("privacy.donottrackheader.value");
}
// Set the search activity default pref on app upgrade if it has not been set already.
if (this._startupStatus === "upgrade" &&
!Services.prefs.prefHasUserValue("searchActivity.default.migrated")) {
@ -1281,21 +1289,6 @@ var BrowserApp = {
case "privacy.masterpassword.enabled":
pref.type = "bool";
pref.value = MasterPassword.enabled;
prefs.push(pref);
continue;
// Handle do-not-track preference
case "privacy.donottrackheader":
pref.type = "string";
let enableDNT = Services.prefs.getBoolPref("privacy.donottrackheader.enabled");
if (!enableDNT) {
pref.value = kDoNotTrackPrefState.NO_PREF;
} else {
let dntState = Services.prefs.getIntPref("privacy.donottrackheader.value");
pref.value = (dntState === 0) ? kDoNotTrackPrefState.ALLOW_TRACKING :
kDoNotTrackPrefState.DISALLOW_TRACKING;
}
prefs.push(pref);
continue;
#ifdef MOZ_CRASHREPORTER
@ -1379,27 +1372,6 @@ var BrowserApp = {
MasterPassword.setPassword(json.value);
return;
// "privacy.donottrackheader" is not "real" pref name, it's used in the setting menu.
case "privacy.donottrackheader":
switch (json.value) {
// Don't tell anything about tracking me
case kDoNotTrackPrefState.NO_PREF:
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", false);
Services.prefs.clearUserPref("privacy.donottrackheader.value");
break;
// Accept tracking me
case kDoNotTrackPrefState.ALLOW_TRACKING:
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", true);
Services.prefs.setIntPref("privacy.donottrackheader.value", 0);
break;
// Not accept tracking me
case kDoNotTrackPrefState.DISALLOW_TRACKING:
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", true);
Services.prefs.setIntPref("privacy.donottrackheader.value", 1);
break;
}
return;
// Enabling or disabling suggestions will prevent future prompts
case SearchEngines.PREF_SUGGEST_ENABLED:
Services.prefs.setBoolPref(SearchEngines.PREF_SUGGEST_PROMPTED, true);