diff --git a/services/healthreport/providers.jsm b/services/healthreport/providers.jsm index 2e5b0036c3f..4258c9405d9 100644 --- a/services/healthreport/providers.jsm +++ b/services/healthreport/providers.jsm @@ -1145,6 +1145,32 @@ CrashesProvider.prototype = Object.freeze({ this._log.info("Grabbing crash counts from crash manager."); let crashCounts = yield this._manager.getCrashCountsByDay(); + // TODO: CrashManager no longer stores submissions as crashes, but we still + // want to send the submission data to FHR. As a temporary workaround, we + // populate |crashCounts| with the submission data to match past behaviour. + // See bug 1056160. + let crashes = yield this._manager.getCrashes(); + for (let crash of crashes) { + for (let [submissionID, submission] of crash.submissions) { + if (!submission.responseDate) { + continue; + } + + let day = Metrics.dateToDays(submission.responseDate); + if (!crashCounts.has(day)) { + crashCounts.set(day, new Map()); + } + + let succeeded = + submission.result == this._manager.SUBMISSION_RESULT_OK; + let type = crash.type + "-submission-" + (succeeded ? "succeeded" : + "failed"); + + let count = (crashCounts.get(day).get(type) || 0) + 1; + crashCounts.get(day).set(type, count); + } + } + let m = this.getMeasurement("crashes", 5); let fields = DailyCrashesMeasurement5.prototype.fields; diff --git a/services/healthreport/tests/xpcshell/test_provider_crashes.js b/services/healthreport/tests/xpcshell/test_provider_crashes.js index edf2c2b1fda..94f752512df 100644 --- a/services/healthreport/tests/xpcshell/test_provider_crashes.js +++ b/services/healthreport/tests/xpcshell/test_provider_crashes.js @@ -60,6 +60,19 @@ add_task(function* test_collect() { manager.CRASH_TYPE_CRASH, "pc", day1); + yield manager.addSubmissionAttempt("mc1", "sub1", day1); + yield manager.addSubmissionResult("mc1", "sub1", day1, + manager.SUBMISSION_RESULT_OK); + yield manager.addSubmissionAttempt("ch", "sub1", day1); + yield manager.addSubmissionResult("ch", "sub1", day1, + manager.SUBMISSION_RESULT_FAILED); + yield manager.addSubmissionAttempt("ch", "sub2", day1); + yield manager.addSubmissionResult("ch", "sub2", day1, + manager.SUBMISSION_RESULT_FAILED); + yield manager.addSubmissionAttempt("ch", "sub3", day1); + yield manager.addSubmissionResult("ch", "sub3", day1, + manager.SUBMISSION_RESULT_OK); + yield manager.addCrash(manager.PROCESS_TYPE_MAIN, manager.CRASH_TYPE_HANG, "mh", day2); @@ -89,6 +102,13 @@ add_task(function* test_collect() { do_check_true(value.has("plugin-crash")); do_check_eq(value.get("plugin-crash"), 1); + do_check_true(value.has("main-crash-submission-succeeded")); + do_check_eq(value.get("main-crash-submission-succeeded"), 1); + do_check_true(value.has("content-hang-submission-failed")); + do_check_eq(value.get("content-hang-submission-failed"), 2); + do_check_true(value.has("content-hang-submission-succeeded")); + do_check_eq(value.get("content-hang-submission-succeeded"), 1); + value = values.days.getDay(day2); do_check_true(value.has("main-hang")); do_check_eq(value.get("main-hang"), 1);