Bug 1341282 - Write the telemetry session id to the .extra file during a crash; r?Ted
MozReview-Commit-ID: 3xltHwV7L5x
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1108,17 +1108,17 @@ bool MinidumpCallback(
OpenAPIData(apiData, descriptor.path());
#else
OpenAPIData(apiData, dump_path, minidump_id);
#endif
apiData.WriteBuffer(crashReporterAPIData->get(), crashReporterAPIData->Length());
}
if (currentSessionId) {
- WriteAnnotation(apiData, "TelemetrySessionId", crashTimeString);
+ WriteAnnotation(apiData, "TelemetrySessionId", currentSessionId);
WriteAnnotation(eventFile, "TelemetrySessionId", currentSessionId);
}
WriteAnnotation(apiData, "CrashTime", crashTimeString);
WriteAnnotation(eventFile, "CrashTime", crashTimeString);
WriteAnnotation(apiData, "UptimeTS", uptimeTSString);
WriteAnnotation(eventFile, "UptimeTS", uptimeTSString);
--- a/toolkit/crashreporter/test/unit/test_crashreporter_crash.js
+++ b/toolkit/crashreporter/test/unit/test_crashreporter_crash.js
@@ -40,11 +40,15 @@ function run_test() {
let scope = {};
Components.utils.import("resource://gre/modules/TelemetryController.jsm", scope);
scope.TelemetryController.testSetup();
},
function(mdump, extra) {
do_check_eq(extra.TestKey, "TestValue");
do_check_eq(extra["\u2665"], "\u{1F4A9}");
do_check_eq(extra.Notes, "JunkMoreJunk");
- do_check_true("TelemetrySessionId" in extra);
+ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+ Assert.ok("TelemetrySessionId" in extra,
+ "The TelemetrySessionId field is present in the extra file");
+ Assert.ok(UUID_REGEX.test(extra.TelemetrySessionId),
+ "The TelemetrySessionId is a UUID");
});
}