зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1744533 - Fix nsICrashService refactoring regarding telemetry data r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D132956
This commit is contained in:
Родитель
b372b43e3c
Коммит
cf8d9d8d7e
|
@ -39,7 +39,7 @@ add_task(async function() {
|
|||
var crash = crashes[0];
|
||||
ok(
|
||||
crash.isOfType(
|
||||
crashMan.PROCESS_TYPE_CONTENT,
|
||||
crashMan.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
crashMan.CRASH_TYPE_CRASH
|
||||
),
|
||||
"Record should be a content crash"
|
||||
|
|
|
@ -440,6 +440,14 @@ CrashManager.prototype = Object.freeze({
|
|||
*/
|
||||
addCrash(processType, crashType, id, date, metadata) {
|
||||
let promise = (async () => {
|
||||
if (!this.isValidProcessType(processType)) {
|
||||
Cu.reportError(
|
||||
"Unhandled process type. Please file a bug: '" + processType +
|
||||
"'. Ignore in the context of " +
|
||||
"test_crash_manager.js:test_addCrashWrong().");
|
||||
return;
|
||||
}
|
||||
|
||||
let store = await this._getStore();
|
||||
if (store.addCrash(processType, crashType, id, date, metadata)) {
|
||||
await store.save();
|
||||
|
@ -452,9 +460,7 @@ CrashManager.prototype = Object.freeze({
|
|||
deferred.resolve();
|
||||
}
|
||||
|
||||
if (
|
||||
this.isValidProcessType(processType) && this.isPingAllowed(processType)
|
||||
) {
|
||||
if (this.isPingAllowed(processType)) {
|
||||
this._sendCrashPing(id, processType, date, metadata);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -174,7 +174,7 @@ CrashService.prototype = Object.freeze({
|
|||
return;
|
||||
}
|
||||
|
||||
processType = Services.crashmanager[processType];
|
||||
processType = Services.crashmanager.processTypes[processType];
|
||||
|
||||
let allThreads = false;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ def main(output):
|
|||
string_name = p.string_name
|
||||
if p.string_name == "default":
|
||||
string_name = "main"
|
||||
if p.string_name == "tab":
|
||||
string_name = "content"
|
||||
output.write(
|
||||
"""
|
||||
// A crash in the %(procname)s process.
|
||||
|
|
|
@ -12,6 +12,8 @@ def main(output):
|
|||
string_name = p.string_name
|
||||
if p.string_name == "default":
|
||||
string_name = "main"
|
||||
if p.string_name == "tab":
|
||||
string_name = "content"
|
||||
output.write(
|
||||
"""
|
||||
"%(proctype)s": %(crashping)s,"""
|
||||
|
|
|
@ -79,7 +79,7 @@ add_task(async function test_process_ping() {
|
|||
Assert.ok(!m.isPingAllowed("remotesandboxbroker"));
|
||||
Assert.ok(!m.isPingAllowed("forkserver"));
|
||||
|
||||
Assert.ok(m.isPingAllowed("tab"));
|
||||
Assert.ok(m.isPingAllowed("content"));
|
||||
Assert.ok(m.isPingAllowed("gpu"));
|
||||
});
|
||||
|
||||
|
@ -893,6 +893,23 @@ add_task(async function test_setRemoteCrashID() {
|
|||
Assert.equal((await m.getCrashes())[0].remoteID, "bp-1");
|
||||
});
|
||||
|
||||
add_task(async function test_addCrashWrong() {
|
||||
let m = await getManager();
|
||||
|
||||
let crashes = await m.getCrashes();
|
||||
Assert.equal(crashes.length, 0);
|
||||
|
||||
await m.addCrash(
|
||||
m.processTypes[-1], // passing a wrong type to force 'undefined', it should
|
||||
m.CRASH_TYPE_CRASH, // fail in the end and not record it
|
||||
"wrong-content-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
|
||||
crashes = await m.getCrashes();
|
||||
Assert.equal(crashes.length, 0);
|
||||
});
|
||||
|
||||
add_task(async function test_telemetryHistogram() {
|
||||
let Telemetry = Services.telemetry;
|
||||
let h = Telemetry.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_ATTEMPT");
|
||||
|
@ -903,11 +920,16 @@ add_task(async function test_telemetryHistogram() {
|
|||
let processTypes = [];
|
||||
let crashTypes = [];
|
||||
|
||||
// Gather all process and crash types
|
||||
// Gather all process types
|
||||
for (let field in m.processTypes) {
|
||||
if (m.isPingAllowed(m.processTypes[field])) {
|
||||
processTypes.push(m.processTypes[field]);
|
||||
}
|
||||
}
|
||||
|
||||
// Gather all crash types
|
||||
for (let field in m) {
|
||||
if (field.startsWith("PROCESS_TYPE_")) {
|
||||
processTypes.push(m[field]);
|
||||
} else if (field.startsWith("CRASH_TYPE_")) {
|
||||
if (field.startsWith("CRASH_TYPE_")) {
|
||||
crashTypes.push(m[field]);
|
||||
}
|
||||
}
|
||||
|
@ -925,6 +947,10 @@ add_task(async function test_telemetryHistogram() {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure that we have generated some crash, otherwise it could indicate
|
||||
// something silently regressing
|
||||
Assert.greater(keysCount, 2);
|
||||
|
||||
// Check that we have the expected keys.
|
||||
let snap = h.snapshot();
|
||||
Assert.equal(
|
||||
|
|
Загрузка…
Ссылка в новой задаче