Bug 1526328 - Disable Telemetry recording in FUZZING builds. r=janerik

Differential Revision: https://phabricator.services.mozilla.com/D19359

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Christian Holler 2019-02-11 13:54:28 +00:00
parent a4d10aaa50
commit 67dd5df98e
2 changed files with 12 additions and 1 deletions

View File

@ -1106,6 +1106,9 @@ TelemetryImpl::SetCanRecordBase(bool canRecord) {
if (recordreplay::IsRecordingOrReplaying()) {
return NS_OK;
}
#ifdef FUZZING
return NS_OK;
#endif
if (canRecord != mCanRecordBase) {
TelemetryHistogram::SetCanRecordBase(canRecord);
TelemetryScalar::SetCanRecordBase(canRecord);
@ -1133,6 +1136,9 @@ TelemetryImpl::SetCanRecordExtended(bool canRecord) {
if (recordreplay::IsRecordingOrReplaying()) {
return NS_OK;
}
#ifdef FUZZING
return NS_OK;
#endif
if (canRecord != mCanRecordExtended) {
TelemetryHistogram::SetCanRecordExtended(canRecord);
TelemetryScalar::SetCanRecordExtended(canRecord);
@ -1171,6 +1177,7 @@ already_AddRefed<nsITelemetry> TelemetryImpl::CreateTelemetryInstance() {
"CreateTelemetryInstance may only be called once, via GetService()");
bool useTelemetry = false;
#ifndef FUZZING
if ((XRE_IsParentProcess() || XRE_IsContentProcess() || XRE_IsGPUProcess() ||
XRE_IsSocketProcess()) &&
// Telemetry is never accumulated when recording or replaying, both
@ -1180,6 +1187,7 @@ already_AddRefed<nsITelemetry> TelemetryImpl::CreateTelemetryInstance() {
!recordreplay::IsRecordingOrReplaying()) {
useTelemetry = true;
}
#endif
// Set current product (determines Fennec/GeckoView at runtime).
SetCurrentProduct();

View File

@ -3836,7 +3836,9 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
SetShutdownChecks();
// Enable Telemetry IO Reporting on DEBUG, nightly and local builds
// Enable Telemetry IO Reporting on DEBUG, nightly and local builds,
// but disable it on FUZZING builds.
#ifndef FUZZING
#ifdef DEBUG
mozilla::Telemetry::InitIOReporting(gAppData->xreDirectory);
#else
@ -3848,6 +3850,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
}
}
#endif /* DEBUG */
#endif /* FUZZING */
#if defined(XP_WIN)
// Enable the HeapEnableTerminationOnCorruption exploit mitigation. We ignore