Bug 1042135 - Change three-state DNT back to two state and update text. (r=dolske,jst,mcmanus)

--HG--
extra : rebase_source : 2cc113eb167b83ded586b36380bb444a827f0084
This commit is contained in:
Sid Stamm 2014-01-28 09:26:16 -08:00
parent 825e44c4d7
commit aa0b466295
12 changed files with 47 additions and 175 deletions

View File

@ -1277,7 +1277,6 @@ pref("services.sync.prefs.sync.privacy.clearOnShutdown.passwords", true);
pref("services.sync.prefs.sync.privacy.clearOnShutdown.sessions", true);
pref("services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings", 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.sanitize.sanitizeOnShutdown", true);
pref("services.sync.prefs.sync.privacy.trackingprotection.enabled", true);
pref("services.sync.prefs.sync.security.OCSP.enabled", true);

View File

@ -1369,7 +1369,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 24;
const UI_VERSION = 25;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -1617,6 +1617,20 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 25) {
// 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").
try {
if (Services.prefs.getBoolPref("privacy.donottrackheader.enabled") &&
Services.prefs.getIntPref("privacy.donottrackheader.value") != 1) {
Services.prefs.clearUserPref("privacy.donottrackheader.enabled");
Services.prefs.clearUserPref("privacy.donottrackheader.value");
}
}
catch (ex) {}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -162,43 +162,6 @@ var gPrivacyPane = {
document.getElementById("historyPane").selectedIndex = selectedIndex;
},
/**
* Update the Tracking preferences based on controls.
*/
setTrackingPrefs: function PPP_setTrackingPrefs()
{
let dntRadioGroup = document.getElementById("doNotTrackSelection"),
dntValuePref = document.getElementById("privacy.donottrackheader.value"),
dntEnabledPref = document.getElementById("privacy.donottrackheader.enabled");
// if the selected radio button says "no preference", set on/off pref to
// false and don't change the value pref.
if (dntRadioGroup.selectedItem.value == -1) {
dntEnabledPref.value = false;
return dntValuePref.value;
}
dntEnabledPref.value = true;
return dntRadioGroup.selectedItem.value;
},
/**
* Obtain the tracking preference value and reflect it in the UI.
*/
getTrackingPrefs: function PPP_getTrackingPrefs()
{
// XXX avoid using bindings that might not be attached, see bug 859982
let dntValue = Services.prefs.getIntPref("privacy.donottrackheader.value"),
dntEnabled = Services.prefs.getBoolPref("privacy.donottrackheader.enabled");
// if DNT is enbaled, select the value from the selected radio
// button, otherwise choose the "no preference" radio button
if (dntEnabled)
return dntValue;
return document.getElementById("dntnopref").value;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist

View File

@ -13,9 +13,6 @@
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
<preference id="privacy.donottrackheader.value"
name="privacy.donottrackheader.value"
type="int"/>
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
@ -74,21 +71,20 @@
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true" align="start">
<caption><label>&tracking.label;</label></caption>
<radiogroup id="doNotTrackSelection" orient="vertical" align="start"
preference="privacy.donottrackheader.value"
onsynctopreference="return gPrivacyPane.setTrackingPrefs()"
onsyncfrompreference="return gPrivacyPane.getTrackingPrefs()">
<radio id="dntnotrack" value="1" label="&dntTrackingNotOkay.label2;"
accesskey="&dntTrackingNotOkay.accesskey;" />
<radio id="dntdotrack" value="0" label="&dntTrackingOkay.label2;"
accesskey="&dntTrackingOkay.accesskey;" />
<radio id="dntnopref" value="-1" label="&dntTrackingNopref.label2;"
accesskey="&dntTrackingNopref.accesskey;" />
</radiogroup>
<label class="text-link" id="doNotTrackInfo"
href="https://www.mozilla.org/dnt">
&doNotTrackInfo.label;
</label>
<checkbox id="privacyDoNotTrackCheckbox"
label="&dntTrackingNotOkay.label2;"
accesskey="&dntTrackingNotOkay.accesskey;"
preference="privacy.donottrackheader.enabled"/>
<separator class="thin"/>
<vbox>
<hbox pack="end">
<spacer flex="1"/>
<label class="text-link" id="doNotTrackInfo"
href="https://www.mozilla.org/dnt">
&doNotTrackInfo.label;
</label>
</hbox>
</vbox>
</groupbox>
<!-- History -->

View File

@ -124,42 +124,6 @@ var gPrivacyPane = {
document.getElementById("historyPane").selectedIndex = selectedIndex;
},
/**
* Update the Tracking preferences based on controls.
*/
setTrackingPrefs: function PPP_setTrackingPrefs()
{
let dntRadioGroup = document.getElementById("doNotTrackSelection"),
dntValuePref = document.getElementById("privacy.donottrackheader.value"),
dntEnabledPref = document.getElementById("privacy.donottrackheader.enabled");
// if the selected radio button says "no preference", set on/off pref to
// false and don't change the value pref.
if (dntRadioGroup.selectedItem.value == -1) {
dntEnabledPref.value = false;
return dntValuePref.value;
}
dntEnabledPref.value = true;
return dntRadioGroup.selectedItem.value;
},
/**
* Obtain the tracking preference value and reflect it in the UI.
*/
getTrackingPrefs: function PPP_getTrackingPrefs()
{
let dntValuePref = document.getElementById("privacy.donottrackheader.value"),
dntEnabledPref = document.getElementById("privacy.donottrackheader.enabled");
// if DNT is enbaled, select the value from the selected radio
// button, otherwise choose the "no preference" radio button
if (dntEnabledPref.value)
return dntValuePref.value;
return document.getElementById("dntnopref").value;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist

View File

@ -26,9 +26,6 @@
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
<preference id="privacy.donottrackheader.value"
name="privacy.donottrackheader.value"
type="int"/>
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
@ -84,20 +81,19 @@
<!-- Tracking -->
<groupbox id="trackingGroup" align="start">
<caption label="&tracking.label;"/>
<radiogroup id="doNotTrackSelection" orient="vertical"
preference="privacy.donottrackheader.value"
onsynctopreference="return gPrivacyPane.setTrackingPrefs()"
onsyncfrompreference="return gPrivacyPane.getTrackingPrefs()">
<radio id="dntnotrack" value="1" label="&dntTrackingNotOkay.label2;"
accesskey="&dntTrackingNotOkay.accesskey;" />
<radio id="dntdotrack" value="0" label="&dntTrackingOkay.label2;"
accesskey="&dntTrackingOkay.accesskey;" />
<radio id="dntnopref" value="-1" label="&dntTrackingNopref.label2;"
accesskey="&dntTrackingNopref.accesskey;" />
</radiogroup>
<label class="text-link" id="doNotTrackInfo"
href="https://www.mozilla.org/dnt"
value="&doNotTrackInfo.label;"/>
<checkbox id="privacyDoNotTrackCheckbox"
label="&dntTrackingNotOkay.label2;"
accesskey="&dntTrackingNotOkay.accesskey;"
preference="privacy.donottrackheader.enabled"/>
<separator class="thin"/>
<vbox>
<hbox pack="end">
<spacer flex="1"/>
<label class="text-link" id="doNotTrackInfo"
href="https://www.mozilla.org/dnt"
value="&doNotTrackInfo.label;"/>
</hbox>
</vbox>
</groupbox>

View File

@ -4,12 +4,8 @@
<!ENTITY tracking.label "Tracking">
<!ENTITY dntTrackingNopref.label2 "Do not tell sites anything about my tracking preferences">
<!ENTITY dntTrackingNopref.accesskey "o">
<!ENTITY dntTrackingNotOkay.label2 "Tell sites that I do not want to be tracked">
<!ENTITY dntTrackingNotOkay.accesskey "n">
<!ENTITY dntTrackingOkay.label2 "Tell sites that I want to be tracked">
<!ENTITY dntTrackingOkay.accesskey "h">
<!ENTITY trackingProtection.label "Prevent sites from tracking me">
<!ENTITY trackingProtection.accesskey "m">
<!ENTITY trackingProtectionLearnMore.label "Learn more">

View File

@ -112,7 +112,6 @@ namespace mozilla {
namespace dom {
static bool sDoNotTrackEnabled = false;
static uint32_t sDoNotTrackValue = 1;
static bool sVibratorEnabled = false;
static uint32_t sMaxVibrateMS = 0;
static uint32_t sMaxVibrateListLen = 0;
@ -124,9 +123,6 @@ Navigator::Init()
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled",
false);
Preferences::AddUintVarCache(&sDoNotTrackValue,
"privacy.donottrackheader.value",
1);
Preferences::AddBoolVarCache(&sVibratorEnabled,
"dom.vibrator.enabled", true);
Preferences::AddUintVarCache(&sMaxVibrateMS,
@ -628,11 +624,7 @@ NS_IMETHODIMP
Navigator::GetDoNotTrack(nsAString &aResult)
{
if (sDoNotTrackEnabled) {
if (sDoNotTrackValue == 0) {
aResult.AssignLiteral("0");
} else {
aResult.AssignLiteral("1");
}
aResult.AssignLiteral("1");
} else {
aResult.AssignLiteral("unspecified");
}

View File

@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=629535
<script type="application/javascript">
const dntPref = 'privacy.donottrackheader.enabled';
const dntValuePref = 'privacy.donottrackheader.value';
SimpleTest.waitForExplicitFinish();
@ -39,8 +38,6 @@ tests.push(function testDefaultValues() {
'DNT should be disabled by default');
is(navigator.doNotTrack, 'unspecified',
'navigator.doNotTrack should initially be "unspecified".');
is(SpecialPowers.getIntPref(dntValuePref), isB2G ? -1 : 1,
'DNT value should be "1" by default');
nextTest();
});
@ -59,34 +56,6 @@ tests.push(function setEnabled() {
});
});
tests.push(function clearedValue() {
SpecialPowers.pushPrefEnv({"clear": [[dntValuePref]]}, function() {
is(navigator.doNotTrack, "1", 'after clearing value pref');
nextTest();
});
});
tests.push(function setValue0() {
SpecialPowers.pushPrefEnv({"set": [[dntValuePref, 0]]}, function() {
is(navigator.doNotTrack, "0", 'after setting value pref');
nextTest();
});
});
tests.push(function setValue42() {
SpecialPowers.pushPrefEnv({"set": [[dntValuePref, 42]]}, function() {
is(navigator.doNotTrack, "1", 'after setting value pref');
nextTest();
});
});
tests.push(function clearValueAgain() {
SpecialPowers.pushPrefEnv({"clear": [[dntValuePref]]}, function() {
is(navigator.doNotTrack, "1", 'after clearing value pref');
nextTest();
});
});
tests.push(function setDisabled() {
SpecialPowers.pushPrefEnv({"set": [[dntPref, false]]}, function() {
is(navigator.doNotTrack, "unspecified", 'after setting pref to false');

View File

@ -940,11 +940,8 @@ pref("content.sink.pending_event_mode", 0);
// 2 = openAbused
pref("privacy.popups.disable_from_plugins", 2);
// "do not track" HTTP header, disabled by default
// send "do not track" HTTP header, disabled by default
pref("privacy.donottrackheader.enabled", false);
// 0 = tracking is acceptable
// 1 = tracking is unacceptable
pref("privacy.donottrackheader.value", 1);
// Enforce tracking protection
pref("privacy.trackingprotection.enabled", false);

View File

@ -83,8 +83,6 @@ extern PRThread *gSocketThread;
#define INTL_ACCEPT_LANGUAGES "intl.accept_languages"
#define BROWSER_PREF_PREFIX "browser.cache."
#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
#define DONOTTRACK_HEADER_VALUE "privacy.donottrackheader.value"
#define DONOTTRACK_VALUE_UNSET 2
#define TELEMETRY_ENABLED "toolkit.telemetry.enabled"
#define ALLOW_EXPERIMENTS "network.allow-experiments"
#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
@ -175,7 +173,6 @@ nsHttpHandler::nsHttpHandler()
, mSendSecureXSiteReferrer(true)
, mEnablePersistentHttpsCaching(false)
, mDoNotTrackEnabled(false)
, mDoNotTrackValue(1)
, mSafeHintEnabled(false)
, mParentalControlEnabled(false)
, mTelemetryEnabled(false)
@ -274,7 +271,6 @@ nsHttpHandler::Init()
prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true);
prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
prefBranch->AddObserver(DONOTTRACK_HEADER_VALUE, this, true);
prefBranch->AddObserver(TELEMETRY_ENABLED, this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true);
@ -427,8 +423,7 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request)
// Add the "Do-Not-Track" header
if (mDoNotTrackEnabled) {
rv = request->SetHeader(nsHttp::DoNotTrack,
nsPrintfCString("%d", mDoNotTrackValue));
rv = request->SetHeader(nsHttp::DoNotTrack, NS_LITERAL_CSTRING("1"));
if (NS_FAILED(rv)) return rv;
}
@ -1356,14 +1351,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mDoNotTrackEnabled = cVar;
}
}
if (PREF_CHANGED(DONOTTRACK_HEADER_VALUE)) {
val = 1;
rv = prefs->GetIntPref(DONOTTRACK_HEADER_VALUE, &val);
if (NS_SUCCEEDED(rv)) {
mDoNotTrackValue = val;
}
}
// Hint option
if (PREF_CHANGED(SAFE_HINT_HEADER_VALUE)) {
cVar = false;
@ -1860,9 +1847,9 @@ nsHttpHandler::Observe(nsISupports *subject,
mSessionStartTime = NowInSeconds();
if (!mDoNotTrackEnabled) {
Telemetry::Accumulate(Telemetry::DNT_USAGE, DONOTTRACK_VALUE_UNSET);
Telemetry::Accumulate(Telemetry::DNT_USAGE, 2);
} else {
Telemetry::Accumulate(Telemetry::DNT_USAGE, mDoNotTrackValue);
Telemetry::Accumulate(Telemetry::DNT_USAGE, 1);
}
} else if (!strcmp(topic, "profile-change-net-restore")) {
// initialize connection manager

View File

@ -450,7 +450,6 @@ private:
// For broadcasting tracking preference
bool mDoNotTrackEnabled;
uint8_t mDoNotTrackValue;
// for broadcasting safe hint;
bool mSafeHintEnabled;