mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1059390 - Part 5: Add and use CrashManager.generateSubmissionID(). r=gps
This commit is contained in:
parent
19f657d3d6
commit
3dfe19eb74
@ -386,6 +386,15 @@ this.CrashManager.prototype = Object.freeze({
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Generate a submission ID for use with addSubmission{Attempt,Result}.
|
||||
*/
|
||||
generateSubmissionID() {
|
||||
return "sub-" + Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID().toString().slice(1, -1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Record the occurrence of a submission attempt for a crash.
|
||||
*
|
||||
@ -521,12 +530,8 @@ this.CrashManager.prototype = Object.freeze({
|
||||
store.addCrash(this.PROCESS_TYPE_MAIN, this.CRASH_TYPE_CRASH,
|
||||
crashID, date);
|
||||
|
||||
let submissionID = "sub-" + Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID().toString()
|
||||
.slice(1, -1);
|
||||
let submissionID = this.generateSubmissionID();
|
||||
let succeeded = result === "true";
|
||||
|
||||
store.addSubmissionAttempt(crashID, submissionID, date);
|
||||
store.addSubmissionResult(crashID, submissionID, date,
|
||||
succeeded ? this.SUBMISSION_RESULT_OK :
|
||||
|
@ -371,6 +371,15 @@ add_task(function* test_addCrash() {
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));
|
||||
});
|
||||
|
||||
add_task(function* test_generateSubmissionID() {
|
||||
let m = yield getManager();
|
||||
|
||||
const SUBMISSION_ID_REGEX =
|
||||
/^(sub-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
||||
let id = m.generateSubmissionID();
|
||||
Assert.ok(SUBMISSION_ID_REGEX.test(id));
|
||||
});
|
||||
|
||||
add_task(function* test_addSubmissionAttemptAndResult() {
|
||||
let m = yield getManager();
|
||||
|
||||
|
@ -298,10 +298,8 @@ Submitter.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
let submissionID = "sub-" + Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID().toString().slice(1, -1);
|
||||
let manager = Services.crashmanager;
|
||||
let submissionID = manager.generateSubmissionID();
|
||||
|
||||
let self = this;
|
||||
xhr.addEventListener("readystatechange", function (aEvt) {
|
||||
|
Loading…
Reference in New Issue
Block a user