Bug 1422035 - Make RegisterEvents assert on children processes. r=Dexter
authorrohan <rohan17089@iiitd.ac.in>
Thu, 11 Jan 2018 23:23:19 +0530
changeset 719794 686aaeae4c9239c508f561669a2766b8f9a02d4a
parent 719793 698ae46fa6340bfc93f5e9f212391bf8bc6feaa5
child 719795 c011bb60725113e3da91a813b8ef250cf2109b3d
push id95377
push userbmo:ttromey@mozilla.com
push dateFri, 12 Jan 2018 20:59:03 +0000
reviewersDexter
bugs1422035
milestone59.0a1
Bug 1422035 - Make RegisterEvents assert on children processes. r=Dexter MozReview-Commit-ID: AnItcTFejUH
toolkit/components/telemetry/TelemetryEvent.cpp
--- a/toolkit/components/telemetry/TelemetryEvent.cpp
+++ b/toolkit/components/telemetry/TelemetryEvent.cpp
@@ -939,16 +939,19 @@ GetArrayPropertyValues(JSContext* cx, JS
   return true;
 }
 
 nsresult
 TelemetryEvent::RegisterEvents(const nsACString& aCategory,
                                JS::Handle<JS::Value> aEventData,
                                JSContext* cx)
 {
+  MOZ_ASSERT(XRE_IsParentProcess(),
+             "Events can only be registered in the parent process");
+
   if (!IsValidIdentifierString(aCategory, 30, true, false)) {
     JS_ReportErrorASCII(cx, "Category parameter should match the identifier pattern.");
     return NS_ERROR_INVALID_ARG;
   }
 
   if (!aEventData.isObject()) {
     JS_ReportErrorASCII(cx, "Event data parameter should be an object");
     return NS_ERROR_INVALID_ARG;