diff --git a/browser/components/preferences/advanced.xul b/browser/components/preferences/advanced.xul
index 39468b2b213..f52b873a3b6 100644
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -54,11 +54,7 @@
#ifdef MOZ_TELEMETRY_REPORTING
#endif
diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul
index 2bef7b1e654..2f4d0c369ca 100644
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -54,11 +54,7 @@
#ifdef MOZ_TELEMETRY_REPORTING
#endif
diff --git a/browser/experiments/Experiments.jsm b/browser/experiments/Experiments.jsm
index 15a092bba01..f4bdf2b4ba7 100644
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -67,7 +67,6 @@ const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
const PREF_BRANCH_TELEMETRY = "toolkit.telemetry.";
const PREF_TELEMETRY_ENABLED = "enabled";
-const PREF_TELEMETRY_PRERELEASE = "enabledPreRelease";
const TELEMETRY_LOG = {
// log(key, [kind, experimentId, details])
@@ -167,8 +166,7 @@ function loadJSONAsync(file, options) {
}
function telemetryEnabled() {
- return gPrefsTelemetry.get(PREF_TELEMETRY_ENABLED, false) ||
- gPrefsTelemetry.get(PREF_TELEMETRY_PRERELEASE, false);
+ return gPrefsTelemetry.get(PREF_TELEMETRY_ENABLED, false);
}
// Returns a promise that is resolved with the AddonInstall for that URL.
@@ -357,7 +355,6 @@ Experiments.Experiments.prototype = {
gPrefs.observe(PREF_ENABLED, this._toggleExperimentsEnabled, this);
gPrefsTelemetry.observe(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
- gPrefsTelemetry.observe(PREF_TELEMETRY_PRERELEASE, this._telemetryStatusChanged, this);
AsyncShutdown.profileBeforeChange.addBlocker("Experiments.jsm shutdown",
this.uninit.bind(this));
@@ -390,7 +387,6 @@ Experiments.Experiments.prototype = {
gPrefs.ignore(PREF_ENABLED, this._toggleExperimentsEnabled, this);
gPrefsTelemetry.ignore(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
- gPrefsTelemetry.ignore(PREF_TELEMETRY_PRERELEASE, this._telemetryStatusChanged, this);
if (this._timer) {
this._timer.clear();
diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in
index 7d13cb8ddd0..ba11ff2289b 100644
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -104,11 +104,7 @@ public class AppConstants {
#endif
public static final String TELEMETRY_PREF_NAME =
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
- "toolkit.telemetry.enabledPreRelease";
-#else
"toolkit.telemetry.enabled";
-#endif
public static final boolean MOZ_TELEMETRY_REPORTING =
#ifdef MOZ_TELEMETRY_REPORTING
diff --git a/mobile/android/base/preferences/GeckoPreferences.java b/mobile/android/base/preferences/GeckoPreferences.java
index 491fc643afb..888ca957354 100644
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -82,7 +82,7 @@ public class GeckoPreferences
private static final String PREFS_HOME_ADD_PANEL = NON_PREF_PREFIX + "home.add_panel";
private static final String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
private static final String PREFS_DATA_REPORTING_PREFERENCES = NON_PREF_PREFIX + "datareporting.preferences";
- private static final String PREFS_TELEMETRY_ENABLED = "datareporting.telemetry.enabled";
+ private static final String PREFS_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
private static final String PREFS_CRASHREPORTER_ENABLED = "datareporting.crashreporter.submitEnabled";
private static final String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
private static final String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
diff --git a/mobile/android/base/resources/xml/preferences_vendor.xml b/mobile/android/base/resources/xml/preferences_vendor.xml
index a0a96586a26..fca6f24a7ab 100644
--- a/mobile/android/base/resources/xml/preferences_vendor.xml
+++ b/mobile/android/base/resources/xml/preferences_vendor.xml
@@ -25,7 +25,7 @@
-
diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
index f8afc2198b4..0a6007ee054 100644
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1166,20 +1166,6 @@ var BrowserApp = {
#endif
}
- // Pref name translation.
- switch (prefName) {
-#ifdef MOZ_TELEMETRY_REPORTING
- // Telemetry pref differs based on build.
- case Telemetry.SHARED_PREF_TELEMETRY_ENABLED:
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
- prefName = "toolkit.telemetry.enabledPreRelease";
-#else
- prefName = "toolkit.telemetry.enabled";
-#endif
- break;
-#endif
- }
-
try {
switch (Services.prefs.getPrefType(prefName)) {
case Ci.nsIPrefBranch.PREF_BOOL:
@@ -1295,20 +1281,6 @@ var BrowserApp = {
break;
}
- // Pref name translation.
- switch (json.name) {
-#ifdef MOZ_TELEMETRY_REPORTING
- // Telemetry pref differs based on build.
- case Telemetry.SHARED_PREF_TELEMETRY_ENABLED:
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
- json.name = "toolkit.telemetry.enabledPreRelease";
-#else
- json.name = "toolkit.telemetry.enabled";
-#endif
- break;
-#endif
- }
-
switch (json.type) {
case "bool":
Services.prefs.setBoolPref(json.name, json.value);
@@ -5658,12 +5630,7 @@ let HealthReportStatusListener = {
PREF_TELEMETRY_ENABLED:
#ifdef MOZ_TELEMETRY_REPORTING
- // Telemetry pref differs based on build.
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
- "toolkit.telemetry.enabledPreRelease",
-#else
"toolkit.telemetry.enabled",
-#endif
#else
null,
#endif
@@ -7531,8 +7498,6 @@ var RemoteDebugger = {
};
var Telemetry = {
- SHARED_PREF_TELEMETRY_ENABLED: "datareporting.telemetry.enabled",
-
addData: function addData(aHistogramId, aValue) {
let histogram = Services.telemetry.getHistogramById(aHistogramId);
histogram.add(aValue);
diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp
index a85e8162e9d..5c53a27eb87 100644
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -77,6 +77,10 @@ static nsresult pref_InitInitialObjects(void);
static nsresult pref_LoadPrefsInDirList(const char *listId);
static nsresult ReadExtensionPrefs(nsIFile *aFile);
+static const char kTelemetryPref[] = "toolkit.telemetry.enabled";
+static const char kOldTelemetryPref[] = "toolkit.telemetry.enabledPreRelease";
+static const char kChannelPref[] = "app.update.channel";
+
Preferences* Preferences::sPreferences = nullptr;
nsIPrefBranch* Preferences::sRootBranch = nullptr;
nsIPrefBranch* Preferences::sDefaultRootBranch = nullptr;
@@ -589,6 +593,12 @@ Preferences::ReadUserPrefs(nsIFile *aFile)
// Ignore all errors related to it, so we retain 'rv' value :-|
(void) UseUserPrefFile();
+ // Migrate the old prerelease telemetry pref
+ if (!Preferences::GetBool(kOldTelemetryPref, true)) {
+ Preferences::SetBool(kTelemetryPref, false);
+ Preferences::ClearUser(kOldTelemetryPref);
+ }
+
NotifyServiceObservers(NS_PREFSERVICE_READ_TOPIC_ID);
} else {
rv = ReadAndOwnUserPrefFile(aFile);
@@ -1298,6 +1308,23 @@ static nsresult pref_InitInitialObjects()
rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
NS_ENSURE_SUCCESS(rv, rv);
+ // Set up the correct default for toolkit.telemetry.enabled.
+ // If this build has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta
+ // channel, telemetry is on by default, otherwise not. This is necessary
+ // so that beta users who are testing final release builds don't flipflop
+ // defaults.
+ if (Preferences::GetDefaultType(kTelemetryPref) == PREF_INVALID) {
+ bool prerelease = false;
+#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
+ prerelease = true;
+#else
+ if (Preferences::GetDefaultCString(kChannelPref).EqualsLiteral("beta")) {
+ prerelease = true;
+ }
+#endif
+ PREF_SetBoolPref(kTelemetryPref, prerelease, true);
+ }
+
NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
nullptr, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
index e0b058a8a74..3a6d1ebb24a 100644
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -534,12 +534,6 @@ pref("toolkit.scrollbox.verticalScrollDistance", 3);
pref("toolkit.scrollbox.horizontalScrollDistance", 5);
pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);
-// Telemetry
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-pref("toolkit.telemetry.enabledPreRelease", true);
-#else
-pref("toolkit.telemetry.enabled", false);
-#endif
pref("toolkit.telemetry.server", "https://incoming.telemetry.mozilla.org");
// Telemetry server owner. Please change if you set toolkit.telemetry.server to a different server
pref("toolkit.telemetry.server_owner", "Mozilla");
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index f471879c589..dffed5173ce 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -84,11 +84,7 @@ extern PRThread *gSocketThread;
#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
#define DONOTTRACK_HEADER_VALUE "privacy.donottrackheader.value"
#define DONOTTRACK_VALUE_UNSET 2
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-#define TELEMETRY_ENABLED "toolkit.telemetry.enabledPreRelease"
-#else
#define TELEMETRY_ENABLED "toolkit.telemetry.enabled"
-#endif
#define ALLOW_EXPERIMENTS "network.allow-experiments"
#define UA_PREF(_pref) UA_PREF_PREFIX _pref
diff --git a/services/healthreport/providers.jsm b/services/healthreport/providers.jsm
index 6cb3652ff12..3a8146ea2c6 100644
--- a/services/healthreport/providers.jsm
+++ b/services/healthreport/providers.jsm
@@ -57,12 +57,7 @@ const DAILY_DISCRETE_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_DISCRETE
const DAILY_LAST_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC};
const DAILY_COUNTER_FIELD = {type: Metrics.Storage.FIELD_DAILY_COUNTER};
-// Preprocess to use the correct telemetry pref.
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-const TELEMETRY_PREF = "toolkit.telemetry.enabledPreRelease";
-#else
const TELEMETRY_PREF = "toolkit.telemetry.enabled";
-#endif
/**
* Represents basic application state.
diff --git a/services/healthreport/tests/xpcshell/test_provider_appinfo.js b/services/healthreport/tests/xpcshell/test_provider_appinfo.js
index 19e105e8bd7..882e94dae90 100644
--- a/services/healthreport/tests/xpcshell/test_provider_appinfo.js
+++ b/services/healthreport/tests/xpcshell/test_provider_appinfo.js
@@ -159,15 +159,9 @@ add_task(function test_record_telemetry() {
let storage = yield Metrics.Storage("record_telemetry");
let provider;
- // We set both prefs, so we don't have to fight the preprocessor.
- function setTelemetry(bool) {
- Services.prefs.setBoolPref("toolkit.telemetry.enabled", bool);
- Services.prefs.setBoolPref("toolkit.telemetry.enabledPreRelease", bool);
- }
-
let now = new Date();
- setTelemetry(true);
+ Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
provider = new AppInfoProvider();
yield provider.init(storage);
yield provider.collectConstantData();
@@ -178,7 +172,7 @@ add_task(function test_record_telemetry() {
do_check_eq(1, d.isTelemetryEnabled);
yield provider.shutdown();
- setTelemetry(false);
+ Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
provider = new AppInfoProvider();
yield provider.init(storage);
yield provider.collectConstantData();
diff --git a/testing/mozbase/mozprofile/mozprofile/profile.py b/testing/mozbase/mozprofile/mozprofile/profile.py
index 8e9cca15210..5a5a129ee4b 100644
--- a/testing/mozbase/mozprofile/mozprofile/profile.py
+++ b/testing/mozbase/mozprofile/mozprofile/profile.py
@@ -349,7 +349,6 @@ class FirefoxProfile(Profile):
'toolkit.startup.max_resumed_crashes' : -1,
# Don't report telemetry information
'toolkit.telemetry.enabled' : False,
- 'toolkit.telemetry.enabledPreRelease' : False,
}
class MetroFirefoxProfile(Profile):
@@ -393,7 +392,6 @@ class MetroFirefoxProfile(Profile):
'toolkit.startup.max_resumed_crashes' : -1,
# Don't report telemetry information
'toolkit.telemetry.enabled' : False,
- 'toolkit.telemetry.enabledPreRelease' : False,
}
class ThunderbirdProfile(Profile):
diff --git a/toolkit/components/telemetry/TelemetryPing.jsm b/toolkit/components/telemetry/TelemetryPing.jsm
index ef7e1ff17ae..9a3edf74b13 100644
--- a/toolkit/components/telemetry/TelemetryPing.jsm
+++ b/toolkit/components/telemetry/TelemetryPing.jsm
@@ -30,11 +30,7 @@ const PAYLOAD_VERSION = 1;
const PREF_BRANCH = "toolkit.telemetry.";
const PREF_SERVER = PREF_BRANCH + "server";
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-const PREF_ENABLED = PREF_BRANCH + "enabledPreRelease";
-#else
const PREF_ENABLED = PREF_BRANCH + "enabled";
-#endif
const PREF_PREVIOUS_BUILDID = PREF_BRANCH + "previousBuildID";
// Do not gather data more than once a minute
diff --git a/toolkit/components/telemetry/UITelemetry.jsm b/toolkit/components/telemetry/UITelemetry.jsm
index fba099a26f0..48f4f10a78a 100644
--- a/toolkit/components/telemetry/UITelemetry.jsm
+++ b/toolkit/components/telemetry/UITelemetry.jsm
@@ -7,11 +7,7 @@
const Cu = Components.utils;
const PREF_BRANCH = "toolkit.telemetry.";
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-const PREF_ENABLED = PREF_BRANCH + "enabledPreRelease";
-#else
const PREF_ENABLED = PREF_BRANCH + "enabled";
-#endif
this.EXPORTED_SYMBOLS = [
"UITelemetry",
diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js
index 39e5528606a..2b57518a7f6 100644
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -22,11 +22,7 @@ const brandBundle = Services.strings.createBundle(
const MAX_BAR_HEIGHT = 18;
const MAX_BAR_CHARS = 25;
const PREF_TELEMETRY_SERVER_OWNER = "toolkit.telemetry.server_owner";
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabledPreRelease";
-#else
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
-#endif
const PREF_DEBUG_SLOW_SQL = "toolkit.telemetry.debugSlowSql";
const PREF_SYMBOL_SERVER_URI = "profiler.symbolicationUrl";
const DEFAULT_SYMBOL_SERVER_URI = "http://symbolapi.mozilla.org";
diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp
index b580fe66d57..98c4e2fb173 100644
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -36,11 +36,7 @@ volatile bool gDebugDisableHangMonitor = false;
const char kHangMonitorPrefName[] = "hangmonitor.timeout";
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-const char kTelemetryPrefName[] = "toolkit.telemetry.enabledPreRelease";
-#else
const char kTelemetryPrefName[] = "toolkit.telemetry.enabled";
-#endif
// Monitor protects gShutdown and gTimeout, but not gTimestamp which rely on
// being atomically set by the processor; synchronization doesn't really matter