Bug 1366147 - SetTarget() should be called once only after the timer is created.
MozReview-Commit-ID: 9kmxzZX8Zfc
--- a/toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp
+++ b/toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp
@@ -76,19 +76,21 @@ DoArmIPCTimerMainThread(const StaticMute
{
MOZ_ASSERT(NS_IsMainThread());
gIPCTimerArming = false;
if (gIPCTimerArmed) {
return;
}
if (!gIPCTimer) {
CallCreateInstance(NS_TIMER_CONTRACTID, &gIPCTimer);
+ if (gIPCTimer) {
+ gIPCTimer->SetTarget(SystemGroup::EventTargetFor(TaskCategory::Other));
+ }
}
if (gIPCTimer) {
- gIPCTimer->SetTarget(SystemGroup::EventTargetFor(TaskCategory::Other));
gIPCTimer->InitWithNamedFuncCallback(TelemetryIPCAccumulator::IPCTimerFired,
nullptr, kBatchTimeoutMs,
nsITimer::TYPE_ONE_SHOT,
"TelemetryIPCAccumulator::IPCTimerFired");
gIPCTimerArmed = true;
}
}