Bug 1257209 - record uptime in crash metadata/pings, r?gfritzsche draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 16 Mar 2016 16:59:06 -0400
changeset 341289 31cdbc8cdae009e2fcda08648344f1f4f71ca702
parent 341141 a5ded32ae90632b88d807d40d175d23d19a0bfc5
child 516375 1d43b0d947ca50149157766c3a90ff796dcc5a99
push id13182
push userbsmedberg@mozilla.com
push dateWed, 16 Mar 2016 20:59:43 +0000
reviewersgfritzsche
bugs1257209
milestone48.0a1
Bug 1257209 - record uptime in crash metadata/pings, r?gfritzsche MozReview-Commit-ID: 8MVRwALXvW5
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/test/unit/test_event_files.js
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -921,17 +921,20 @@ bool MinidumpCallback(
 #ifdef XP_LINUX
       OpenAPIData(apiData, descriptor.path());
 #else
       OpenAPIData(apiData, dump_path, minidump_id);
 #endif
       apiData.WriteBuffer(crashReporterAPIData->get(), crashReporterAPIData->Length());
     }
     WriteAnnotation(apiData, "CrashTime", crashTimeString);
+    WriteAnnotation(eventFile, "CrashTime", crashTimeString);
+
     WriteAnnotation(apiData, "UptimeTS", uptimeTSString);
+    WriteAnnotation(eventFile, "UptimeTS", uptimeTSString);
 
     if (timeSinceLastCrash != 0) {
       WriteAnnotation(apiData, "SecondsSinceLastCrash",
                       timeSinceLastCrashString);
       WriteAnnotation(eventFile, "SecondsSinceLastCrash",
                       timeSinceLastCrashString);
     }
     if (isGarbageCollecting) {
--- a/toolkit/crashreporter/test/unit/test_event_files.js
+++ b/toolkit/crashreporter/test/unit/test_event_files.js
@@ -44,10 +44,11 @@ add_task(function* test_main_process_cra
   Assert.equal(count, 1, "A single crash event file was seen.");
   let crashes = yield cm.getCrashes();
   Assert.equal(crashes.length, 1);
   let crash = crashes[0];
   Assert.ok(crash.isOfType(cm.PROCESS_TYPE_MAIN, cm.CRASH_TYPE_CRASH));
   Assert.equal(crash.id + ".dmp", basename, "ID recorded properly");
   Assert.equal(crash.metadata.ShutdownProgress, "event-test");
   Assert.ok("TelemetrySessionId" in crash.metadata);
+  Assert.ok("UptimeTS" in crash.metadata);
   Assert.ok(/^[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}$/.test(crash.metadata.TelemetrySessionId));
 });