Bug 737600 - When telemetry is disabled in the pref pane, we should update toolkit.telemetry.rejected, r=mak77

This commit is contained in:
Theo Chevalier 2012-12-08 18:39:24 +01:00
parent 5d2d786fba
commit b673e3b720
7 changed files with 60 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#filter substitution
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# 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
@ -153,6 +154,18 @@ var gAdvancedPane = {
} catch (e) { }
},
/**
* When the user toggles telemetry, update the rejected value as well, so we
* know he expressed a choice, and don't re-prompt inadvertently.
*/
telemetryEnabledChanged: function (event)
{
let rejected = document.getElementById("toolkit.telemetry.rejected");
rejected.value = !event.target.value;
let displayed = document.getElementById("toolkit.telemetry.prompted");
displayed.value = @MOZ_TELEMETRY_DISPLAY_REV@;
},
/**
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.

View File

@ -50,9 +50,18 @@
type="bool"/>
#endif
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
onchange="gAdvancedPane.telemetryEnabledChanged(event);"
type="bool"/>
<preference id="toolkit.telemetry.prompted"
name="toolkit.telemetry.prompted"
type="int"/>
<preference id="toolkit.telemetry.rejected"
name="toolkit.telemetry.rejected"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" type="int"/>
@ -186,9 +195,11 @@
label="&submitCrashes.label;" accesskey="&submitCrashes.accesskey;"/>
#endif
#endif
#ifdef MOZ_TELEMETRY_REPORTING
<checkbox id="submitTelemetryBox" flex="1"
preference="toolkit.telemetry.enabled"
label="&submitTelemetry.label;" accesskey="&submitTelemetry.accesskey;"/>
#endif
</groupbox>
</tabpanel>

View File

@ -1,3 +1,4 @@
#filter substitution
/* 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/. */
@ -141,6 +142,18 @@ var gAdvancedPane = {
} catch (e) { }
},
/**
* When the user toggles telemetry, update the rejected value as well, so we
* know he expressed a choice, and don't re-prompt inadvertently.
*/
telemetryEnabledChanged: function (event)
{
let rejected = document.getElementById("toolkit.telemetry.rejected");
rejected.value = !event.target.value;
let displayed = document.getElementById("toolkit.telemetry.prompted");
displayed.value = @MOZ_TELEMETRY_DISPLAY_REV@;
},
/**
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.

View File

@ -52,9 +52,18 @@
type="bool"/>
#endif
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
onchange="gAdvancedPane.telemetryEnabledChanged(event);"
type="bool"/>
<preference id="toolkit.telemetry.prompted"
name="toolkit.telemetry.prompted"
type="int"/>
<preference id="toolkit.telemetry.rejected"
name="toolkit.telemetry.rejected"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
@ -207,9 +216,11 @@
label="&submitCrashes.label;" accesskey="&submitCrashes.accesskey;"/>
#endif
#endif
#ifdef MOZ_TELEMETRY_REPORTING
<checkbox id="submitTelemetryBox" flex="1"
preference="toolkit.telemetry.enabled"
label="&submitTelemetry.label;" accesskey="&submitTelemetry.accesskey;"/>
#endif
</groupbox>
</tabpanel>

View File

@ -8639,6 +8639,9 @@ AC_SUBST(MOZ_PKG_SPECIAL)
AC_SUBST(MOZILLA_OFFICIAL)
AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
if test "$MOZ_TELEMETRY_REPORTING"; then
AC_DEFINE(MOZ_TELEMETRY_REPORTING)
fi

View File

@ -1,3 +1,4 @@
#filter substitution
/* 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/. */
@ -22,6 +23,9 @@ const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].
const MAX_BAR_HEIGHT = 18;
const PREF_TELEMETRY_SERVER_OWNER = "toolkit.telemetry.server_owner";
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
const PREF_TELEMETRY_DISPLAYED = "toolkit.telemetry.prompted";
const PREF_TELEMETRY_REJECTED = "toolkit.telemetry.rejected";
const TELEMETRY_DISPLAY_REV = @MOZ_TELEMETRY_DISPLAY_REV@;
const PREF_DEBUG_SLOW_SQL = "toolkit.telemetry.debugSlowSql";
const PREF_SYMBOL_SERVER_URI = "profiler.symbolicationUrl";
const DEFAULT_SYMBOL_SERVER_URI = "http://symbolapi.mozilla.org";
@ -75,6 +79,10 @@ let observer = {
observe: function observe(aSubject, aTopic, aData) {
if (aData == PREF_TELEMETRY_ENABLED) {
this.updatePrefStatus();
Services.prefs.setBoolPref(PREF_TELEMETRY_REJECTED,
!getPref(PREF_TELEMETRY_ENABLED, false));
Services.prefs.setIntPref(PREF_TELEMETRY_DISPLAYED,
TELEMETRY_DISPLAY_REV);
}
},

View File

@ -16,7 +16,7 @@ toolkit.jar:
content/global/aboutRights-unbranded.xhtml (aboutRights-unbranded.xhtml)
* content/global/aboutSupport.js
* content/global/aboutSupport.xhtml
content/global/aboutTelemetry.js
* content/global/aboutTelemetry.js
* content/global/aboutTelemetry.xhtml
content/global/aboutTelemetry.css (aboutTelemetry.css)
content/global/directionDetector.html