mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1059940 - Part 1: Expose CrashStore.reset() to clear all data. r=bsmedberg
This commit is contained in:
parent
cf3f9993c4
commit
890e39639a
@ -706,6 +706,18 @@ CrashStore.prototype = Object.freeze({
|
||||
// ceiling on the per-type/per-day records that will be stored.
|
||||
HIGH_WATER_DAILY_THRESHOLD: 100,
|
||||
|
||||
/**
|
||||
* Reset all data.
|
||||
*/
|
||||
reset() {
|
||||
this._data = {
|
||||
v: 1,
|
||||
crashes: new Map(),
|
||||
corruptDate: null,
|
||||
};
|
||||
this._countsByDay = new Map();
|
||||
},
|
||||
|
||||
/**
|
||||
* Load data from disk.
|
||||
*
|
||||
@ -713,13 +725,8 @@ CrashStore.prototype = Object.freeze({
|
||||
*/
|
||||
load: function () {
|
||||
return Task.spawn(function* () {
|
||||
// Loading replaces data. So reset data structures.
|
||||
this._data = {
|
||||
v: 1,
|
||||
crashes: new Map(),
|
||||
corruptDate: null,
|
||||
};
|
||||
this._countsByDay = new Map();
|
||||
// Loading replaces data.
|
||||
this.reset();
|
||||
|
||||
try {
|
||||
let decoder = new TextDecoder();
|
||||
|
@ -79,6 +79,15 @@ add_task(function test_add_crash() {
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
});
|
||||
|
||||
add_task(function test_reset() {
|
||||
let s = yield getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", DUMMY_DATE));
|
||||
Assert.equal(s.crashes.length, 1);
|
||||
s.reset();
|
||||
Assert.equal(s.crashes.length, 0);
|
||||
});
|
||||
|
||||
add_task(function test_save_load() {
|
||||
let s = yield getStore();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user