mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1024672 - Part 6: Allow storing multiple crash classifications. r=bsmedberg
This commit is contained in:
parent
c597993fb9
commit
fad078a5e8
@ -432,13 +432,13 @@ this.CrashManager.prototype = Object.freeze({
|
||||
* Set the classification of a crash.
|
||||
*
|
||||
* @param crashID (string) Crash ID. Likely a UUID.
|
||||
* @param classification (string) Crash classification/reason.
|
||||
* @param classifications (array) Crash classifications.
|
||||
*
|
||||
* @return boolean True if the classification was recorded and false if not.
|
||||
* @return boolean True if the data was recorded and false if not.
|
||||
*/
|
||||
setCrashClassification: Task.async(function* (crashID, classification) {
|
||||
setCrashClassifications: Task.async(function* (crashID, classifications) {
|
||||
let store = yield this._getStore();
|
||||
if (store.setCrashClassification(crashID, classification)) {
|
||||
if (store.setCrashClassifications(crashID, classifications)) {
|
||||
yield store.save();
|
||||
}
|
||||
}),
|
||||
@ -1082,7 +1082,7 @@ CrashStore.prototype = Object.freeze({
|
||||
type: type,
|
||||
crashDate: date,
|
||||
submissions: new Map(),
|
||||
classification: null,
|
||||
classifications: [],
|
||||
});
|
||||
}
|
||||
|
||||
@ -1193,15 +1193,15 @@ CrashStore.prototype = Object.freeze({
|
||||
},
|
||||
|
||||
/**
|
||||
* @return boolean True if the classification was set.
|
||||
* @return boolean True if the classifications were set.
|
||||
*/
|
||||
setCrashClassification: function (crashID, classification) {
|
||||
setCrashClassifications: function (crashID, classifications) {
|
||||
let crash = this._data.crashes.get(crashID);
|
||||
if (!crash) {
|
||||
return false;
|
||||
}
|
||||
|
||||
crash.classification = classification;
|
||||
crash.classifications = classifications;
|
||||
return true;
|
||||
},
|
||||
});
|
||||
@ -1262,8 +1262,8 @@ CrashRecord.prototype = Object.freeze({
|
||||
return this._o.submissions;
|
||||
},
|
||||
|
||||
get classification() {
|
||||
return this._o.classification;
|
||||
get classifications() {
|
||||
return this._o.classifications;
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -405,13 +405,14 @@ add_task(function* test_addSubmissionAttemptAndResult() {
|
||||
Assert.equal(submission.result, m.SUBMISSION_RESULT_OK);
|
||||
});
|
||||
|
||||
add_task(function* test_setCrashClassification() {
|
||||
add_task(function* test_setCrashClassifications() {
|
||||
let m = yield getManager();
|
||||
|
||||
yield m.addCrash(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH,
|
||||
"main-crash", DUMMY_DATE);
|
||||
yield m.setCrashClassification("main-crash", "class");
|
||||
Assert.equal((yield m.getCrashes())[0].classification, "class");
|
||||
yield m.setCrashClassifications("main-crash", ["a"]);
|
||||
let classifications = (yield m.getCrashes())[0].classifications;
|
||||
Assert.ok(classifications.indexOf("a") != -1);
|
||||
});
|
||||
|
||||
add_task(function* test_setRemoteCrashID() {
|
||||
|
@ -571,10 +571,15 @@ add_task(function* test_setCrashClassification() {
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "crash1",
|
||||
new Date()));
|
||||
Assert.equal(s.crashes[0].classification, null);
|
||||
let classifications = s.crashes[0].classifications;
|
||||
Assert.ok(!!classifications);
|
||||
Assert.equal(classifications.length, 0);
|
||||
|
||||
Assert.ok(s.setCrashClassification("crash1", "foo"));
|
||||
Assert.equal(s.crashes[0].classification, "foo");
|
||||
Assert.ok(s.setCrashClassifications("crash1", ["foo", "bar"]));
|
||||
classifications = s.crashes[0].classifications;
|
||||
Assert.equal(classifications.length, 2);
|
||||
Assert.ok(classifications.indexOf("foo") != -1);
|
||||
Assert.ok(classifications.indexOf("bar") != -1);
|
||||
});
|
||||
|
||||
add_task(function* test_setRemoteCrashID() {
|
||||
|
Loading…
Reference in New Issue
Block a user