Bug 1444275 - Don't set the telemetry pref in content processes. r=glandium

It'll be set via the normal parent-to-child pref setting process.

MozReview-Commit-ID: By4mG7brc55

--HG--
extra : rebase_source : 480a289edf81b36395619a3bb9f5a1e065cb33d8
This commit is contained in:
Nicholas Nethercote 2018-03-13 14:33:48 +11:00
Родитель 500ff7c746
Коммит 22b2a2e3c2
1 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -3151,6 +3151,8 @@ TelemetryPrefValue()
/* static */ void /* static */ void
Preferences::SetupTelemetryPref() Preferences::SetupTelemetryPref()
{ {
MOZ_ASSERT(XRE_IsParentProcess());
Maybe<bool> telemetryPrefValue = TelemetryPrefValue(); Maybe<bool> telemetryPrefValue = TelemetryPrefValue();
if (telemetryPrefValue.isSome()) { if (telemetryPrefValue.isSome()) {
Preferences::SetBoolInAnyProcess( Preferences::SetBoolInAnyProcess(
@ -3199,11 +3201,27 @@ TelemetryPrefValue()
/* static */ void /* static */ void
Preferences::SetupTelemetryPref() Preferences::SetupTelemetryPref()
{ {
MOZ_ASSERT(XRE_IsParentProcess());
Preferences::SetBoolInAnyProcess( Preferences::SetBoolInAnyProcess(
kTelemetryPref, TelemetryPrefValue(), PrefValueKind::Default); kTelemetryPref, TelemetryPrefValue(), PrefValueKind::Default);
Preferences::LockInAnyProcess(kTelemetryPref); Preferences::LockInAnyProcess(kTelemetryPref);
} }
static void
CheckTelemetryPref()
{
MOZ_ASSERT(!XRE_IsParentProcess());
// Make sure the children got passed the right telemetry pref details.
DebugOnly<bool> value;
MOZ_ASSERT(NS_SUCCEEDED(Preferences::GetBool(kTelemetryPref, &value)) &&
value == TelemetryPrefValue());
// njn: uncomment after bug 1436911 lands; it ensures that the locked status
// is passed correctly
// MOZ_ASSERT(Preferences::IsLocked(kTelemetryPref));
}
#endif // MOZ_WIDGET_ANDROID #endif // MOZ_WIDGET_ANDROID
/* static */ already_AddRefed<Preferences> /* static */ already_AddRefed<Preferences>
@ -3242,6 +3260,10 @@ Preferences::GetInstanceForService()
delete gChangedDomPrefs; delete gChangedDomPrefs;
gChangedDomPrefs = nullptr; gChangedDomPrefs = nullptr;
#ifndef MOZ_WIDGET_ANDROID
CheckTelemetryPref();
#endif
} else { } else {
// Check if there is a deployment configuration file. If so, set up the // Check if there is a deployment configuration file. If so, set up the
// pref config machinery, which will actually read the file. // pref config machinery, which will actually read the file.
@ -4245,7 +4267,9 @@ Preferences::InitInitialObjects()
} }
} }
SetupTelemetryPref(); if (XRE_IsParentProcess()) {
SetupTelemetryPref();
}
NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
nullptr, nullptr,