From 6a2a266507769a176463db1f2a93b84f8ecc565f Mon Sep 17 00:00:00 2001 From: Georg Fritzsche Date: Wed, 18 Mar 2015 12:35:49 +0100 Subject: [PATCH] Bug 1139460 - Part 1 - Avoid Telemetry payload data changes after collection. r=vladan --- toolkit/components/telemetry/TelemetryPing.jsm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolkit/components/telemetry/TelemetryPing.jsm b/toolkit/components/telemetry/TelemetryPing.jsm index 54165177b90..bfc822c3a04 100644 --- a/toolkit/components/telemetry/TelemetryPing.jsm +++ b/toolkit/components/telemetry/TelemetryPing.jsm @@ -9,6 +9,7 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; const Cu = Components.utils; +const myScope = this; Cu.import("resource://gre/modules/Log.jsm"); Cu.import("resource://gre/modules/debug.js", this); @@ -317,6 +318,11 @@ let Impl = { this._log.trace("assemblePing - Type " + aType + ", Server " + this._server + ", aOptions " + JSON.stringify(aOptions)); + // Clone the payload data so we don't race against unexpected changes in subobjects that are + // still referenced by other code. + // We can't trust all callers to do this properly on their own. + let payload = Cu.cloneInto(aPayload, myScope); + // Fill the common ping fields. let pingData = { type: aType,