зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726804 - Refactor PROCESS_TYPE_* from nsICrashService r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D121389
This commit is contained in:
Родитель
60d10601bb
Коммит
a9b9bae961
|
@ -221,5 +221,8 @@ tools/update-packaging/**/*refs.js
|
|||
# Ignore backgroundtasks preferences files.
|
||||
toolkit/components/backgroundtasks/defaults
|
||||
|
||||
# Uses preprocessing
|
||||
toolkit/components/crashes/CrashManager.jsm
|
||||
|
||||
# Ignore pre-generated webpack and typescript transpiled files for translations
|
||||
browser/extensions/translations/extension/
|
||||
|
|
|
@ -14,44 +14,6 @@
|
|||
#include "nsXULAppAPI.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
// Consistency checking for nsICrashService constants. We depend on the
|
||||
// equivalence between nsICrashService values and GeckoProcessType values
|
||||
// in the code below. Making them equal also ensures that if new process
|
||||
// types are added, people will know they may need to add crash reporting
|
||||
// support in various places because compilation errors will be triggered here.
|
||||
static_assert(nsICrashService::PROCESS_TYPE_MAIN ==
|
||||
(int)GeckoProcessType_Default,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_CONTENT ==
|
||||
(int)GeckoProcessType_Content,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_IPDLUNITTEST ==
|
||||
(int)GeckoProcessType_IPDLUnitTest,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_GMPLUGIN ==
|
||||
(int)GeckoProcessType_GMPlugin,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_GPU == (int)GeckoProcessType_GPU,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_VR == (int)GeckoProcessType_VR,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_RDD == (int)GeckoProcessType_RDD,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_SOCKET ==
|
||||
(int)GeckoProcessType_Socket,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_SANDBOX_BROKER ==
|
||||
(int)GeckoProcessType_RemoteSandboxBroker,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
static_assert(nsICrashService::PROCESS_TYPE_FORKSERVER ==
|
||||
(int)GeckoProcessType_ForkServer,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
// Add new static asserts here if you add more process types.
|
||||
// Update this static assert as well.
|
||||
static_assert(nsICrashService::PROCESS_TYPE_FORKSERVER + 1 ==
|
||||
(int)GeckoProcessType_End,
|
||||
"GeckoProcessType enum is out of sync with nsICrashService!");
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
|
|
|
@ -160,26 +160,7 @@ var CrashManager = function(options) {
|
|||
};
|
||||
|
||||
CrashManager.prototype = Object.freeze({
|
||||
// A crash in the main process.
|
||||
PROCESS_TYPE_MAIN: "main",
|
||||
|
||||
// A crash in a content process.
|
||||
PROCESS_TYPE_CONTENT: "content",
|
||||
|
||||
// A crash in a Gecko media plugin process.
|
||||
PROCESS_TYPE_GMPLUGIN: "gmplugin",
|
||||
|
||||
// A crash in the GPU process.
|
||||
PROCESS_TYPE_GPU: "gpu",
|
||||
|
||||
// A crash in the VR process.
|
||||
PROCESS_TYPE_VR: "vr",
|
||||
|
||||
// A crash in the RDD process.
|
||||
PROCESS_TYPE_RDD: "rdd",
|
||||
|
||||
// A crash in the socket process.
|
||||
PROCESS_TYPE_SOCKET: "socket",
|
||||
#includesubst @OBJDIR@/GeckoProcessTypes_CrashManager_map.js
|
||||
|
||||
// A real crash.
|
||||
CRASH_TYPE_CRASH: "crash",
|
||||
|
@ -471,13 +452,8 @@ CrashManager.prototype = Object.freeze({
|
|||
deferred.resolve();
|
||||
}
|
||||
|
||||
// Send a telemetry ping for each non-main process crash
|
||||
if (
|
||||
processType === this.PROCESS_TYPE_CONTENT ||
|
||||
processType === this.PROCESS_TYPE_GPU ||
|
||||
processType === this.PROCESS_TYPE_VR ||
|
||||
processType === this.PROCESS_TYPE_RDD ||
|
||||
processType === this.PROCESS_TYPE_SOCKET
|
||||
this.isValidProcessType(processType) && this.isPingAllowed(processType)
|
||||
) {
|
||||
this._sendCrashPing(id, processType, date, metadata);
|
||||
}
|
||||
|
@ -486,6 +462,48 @@ CrashManager.prototype = Object.freeze({
|
|||
return promise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Check that the processType parameter is a valid one:
|
||||
* - it is a string
|
||||
* - it is listed in this.processTypes
|
||||
*
|
||||
* @param processType (string) Process type to evaluate
|
||||
*
|
||||
* @return boolean True or false depending whether it is a legit one
|
||||
*/
|
||||
isValidProcessType(processType) {
|
||||
if (typeof(processType) !== "string") {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const pt of Object.values(this.processTypes)) {
|
||||
if (pt === processType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Check that processType is allowed to send a ping
|
||||
*
|
||||
* @param processType (string) Process type to check for
|
||||
*
|
||||
* @return boolean True or False depending on whether ping is allowed
|
||||
**/
|
||||
isPingAllowed(processType) {
|
||||
#includesubst @OBJDIR@/GeckoProcessTypes_CrashManager_pings.js
|
||||
|
||||
// Should not even reach this because of isValidProcessType() but just in
|
||||
// case we try to be cautious
|
||||
if (!(processType in processPings)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return processPings[processType];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a promise that is resolved only the crash with the specified id
|
||||
* has been fully recorded.
|
||||
|
@ -727,7 +745,7 @@ CrashManager.prototype = Object.freeze({
|
|||
let crashID = lines[0];
|
||||
let metadata = JSON.parse(lines[1]);
|
||||
store.addCrash(
|
||||
this.PROCESS_TYPE_MAIN,
|
||||
this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
this.CRASH_TYPE_CRASH,
|
||||
crashID,
|
||||
date,
|
||||
|
@ -738,7 +756,7 @@ CrashManager.prototype = Object.freeze({
|
|||
// If CrashPingUUID is not present then a ping was not generated
|
||||
// by the crashreporter for this crash so we need to send one from
|
||||
// here.
|
||||
this._sendCrashPing(crashID, this.PROCESS_TYPE_MAIN, date, metadata);
|
||||
this._sendCrashPing(crashID, this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT], date, metadata);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -747,7 +765,7 @@ CrashManager.prototype = Object.freeze({
|
|||
if (lines.length == 3) {
|
||||
let [crashID, result, remoteID] = lines;
|
||||
store.addCrash(
|
||||
this.PROCESS_TYPE_MAIN,
|
||||
this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
this.CRASH_TYPE_CRASH,
|
||||
crashID,
|
||||
date
|
||||
|
@ -1286,7 +1304,7 @@ CrashStore.prototype = Object.freeze({
|
|||
|
||||
if (
|
||||
count > this.HIGH_WATER_DAILY_THRESHOLD &&
|
||||
processType != CrashManager.prototype.PROCESS_TYPE_MAIN
|
||||
processType != CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT]
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1351,6 +1369,12 @@ CrashStore.prototype = Object.freeze({
|
|||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param processType (string) One of the PROCESS_TYPE constants.
|
||||
* @param crashType (string) One of the CRASH_TYPE constants.
|
||||
*
|
||||
* @return array of crashes
|
||||
*/
|
||||
getCrashesOfType(processType, crashType) {
|
||||
let crashes = [];
|
||||
for (let crash of this.crashes) {
|
||||
|
|
|
@ -170,35 +170,12 @@ CrashService.prototype = Object.freeze({
|
|||
QueryInterface: ChromeUtils.generateQI(["nsICrashService", "nsIObserver"]),
|
||||
|
||||
async addCrash(processType, crashType, id) {
|
||||
switch (processType) {
|
||||
case Ci.nsICrashService.PROCESS_TYPE_MAIN:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_MAIN;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_CONTENT:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_CONTENT;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_GMPLUGIN:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_GMPLUGIN;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_GPU:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_GPU;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_VR:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_VR;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_RDD:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_RDD;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_SOCKET:
|
||||
processType = Services.crashmanager.PROCESS_TYPE_SOCKET;
|
||||
break;
|
||||
case Ci.nsICrashService.PROCESS_TYPE_IPDLUNITTEST:
|
||||
// We'll never send crash reports for this type of process.
|
||||
if (processType === Ci.nsIXULRuntime.PROCESS_TYPE_IPDLUNITTEST) {
|
||||
return;
|
||||
default:
|
||||
throw new Error("Unrecognized PROCESS_TYPE: " + processType);
|
||||
}
|
||||
|
||||
processType = Services.crashmanager[processType];
|
||||
|
||||
let allThreads = false;
|
||||
|
||||
switch (crashType) {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from geckoprocesstypes import process_types
|
||||
|
||||
|
||||
def main(output):
|
||||
output.write(
|
||||
"""
|
||||
processTypes: {"""
|
||||
)
|
||||
|
||||
for p in process_types:
|
||||
string_name = p.string_name
|
||||
if p.string_name == "default":
|
||||
string_name = "main"
|
||||
output.write(
|
||||
"""
|
||||
// A crash in the %(procname)s process.
|
||||
%(proctype)d: "%(procname)s","""
|
||||
% {
|
||||
"proctype": p.enum_value,
|
||||
"procname": string_name,
|
||||
}
|
||||
)
|
||||
output.write(
|
||||
"""
|
||||
},"""
|
||||
)
|
|
@ -0,0 +1,27 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from geckoprocesstypes import process_types
|
||||
|
||||
|
||||
def main(output):
|
||||
output.write(""" let processPings = {""")
|
||||
|
||||
for p in process_types:
|
||||
string_name = p.string_name
|
||||
if p.string_name == "default":
|
||||
string_name = "main"
|
||||
output.write(
|
||||
"""
|
||||
"%(proctype)s": %(crashping)s,"""
|
||||
% {
|
||||
"proctype": string_name,
|
||||
"crashping": "true" if p.crash_ping else "false",
|
||||
}
|
||||
)
|
||||
output.write(
|
||||
"""
|
||||
};
|
||||
"""
|
||||
)
|
|
@ -9,6 +9,8 @@ SPHINX_TREES["crash-manager"] = "docs"
|
|||
with Files("docs/**"):
|
||||
SCHEDULES.exclusive = ["docs"]
|
||||
|
||||
DEFINES["OBJDIR"] = OBJDIR
|
||||
|
||||
XPIDL_MODULE = "toolkit_crashservice"
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
|
@ -16,8 +18,22 @@ XPIDL_SOURCES += [
|
|||
]
|
||||
|
||||
if CONFIG["MOZ_CRASHREPORTER"]:
|
||||
EXTRA_JS_MODULES += [
|
||||
GeneratedFile(
|
||||
"GeckoProcessTypes_CrashManager_map.js",
|
||||
script="gen_process_map.py",
|
||||
entry_point="main",
|
||||
)
|
||||
GeneratedFile(
|
||||
"GeckoProcessTypes_CrashManager_pings.js",
|
||||
script="gen_process_pings.py",
|
||||
entry_point="main",
|
||||
)
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
"CrashManager.jsm",
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"CrashService.jsm",
|
||||
]
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ interface nsICrashService : nsISupports
|
|||
* Records the occurrence of a crash.
|
||||
*
|
||||
* @param processType
|
||||
* One of the PROCESS_TYPE constants defined below.
|
||||
* One of the PROCESS_TYPE constants defined in nsIXULRuntime.
|
||||
* @param crashType
|
||||
* One of the CRASH_TYPE constants defined below.
|
||||
* @param id
|
||||
|
@ -21,19 +21,6 @@ interface nsICrashService : nsISupports
|
|||
*/
|
||||
Promise addCrash(in long processType, in long crashType, in AString id);
|
||||
|
||||
// This list should be kept in sync with GeckoProcessTypes.h
|
||||
const long PROCESS_TYPE_MAIN = 0;
|
||||
const long PROCESS_TYPE_CONTENT = 2;
|
||||
const long PROCESS_TYPE_IPDLUNITTEST = 3;
|
||||
const long PROCESS_TYPE_GMPLUGIN = 4;
|
||||
const long PROCESS_TYPE_GPU = 5;
|
||||
const long PROCESS_TYPE_VR = 6;
|
||||
const long PROCESS_TYPE_RDD = 7;
|
||||
const long PROCESS_TYPE_SOCKET = 8;
|
||||
const long PROCESS_TYPE_SANDBOX_BROKER = 9;
|
||||
const long PROCESS_TYPE_FORKSERVER = 10;
|
||||
// New process types should be added at the end of the above list.
|
||||
|
||||
const long CRASH_TYPE_CRASH = 0;
|
||||
const long CRASH_TYPE_HANG = 1;
|
||||
};
|
||||
|
|
|
@ -54,6 +54,35 @@ add_task(async function test_get_manager() {
|
|||
await m.createDummyDump(false);
|
||||
});
|
||||
|
||||
add_task(async function test_valid_process() {
|
||||
let m = await getManager();
|
||||
Assert.ok(m, "CrashManager obtained.");
|
||||
|
||||
Assert.ok(!m.isValidProcessType(42));
|
||||
Assert.ok(!m.isValidProcessType(null));
|
||||
Assert.ok(!m.isValidProcessType("default"));
|
||||
|
||||
Assert.ok(m.isValidProcessType("main"));
|
||||
});
|
||||
|
||||
add_task(async function test_process_ping() {
|
||||
let m = await getManager();
|
||||
Assert.ok(m, "CrashManager obtained.");
|
||||
|
||||
Assert.ok(!m.isPingAllowed(42));
|
||||
Assert.ok(!m.isPingAllowed(null));
|
||||
Assert.ok(!m.isPingAllowed("default"));
|
||||
|
||||
Assert.ok(!m.isPingAllowed("main"));
|
||||
Assert.ok(!m.isPingAllowed("ipdlunittest"));
|
||||
Assert.ok(!m.isPingAllowed("gmplugin"));
|
||||
Assert.ok(!m.isPingAllowed("remotesandboxbroker"));
|
||||
Assert.ok(!m.isPingAllowed("forkserver"));
|
||||
|
||||
Assert.ok(m.isPingAllowed("tab"));
|
||||
Assert.ok(m.isPingAllowed("gpu"));
|
||||
});
|
||||
|
||||
// Unsubmitted dump files on disk are detected properly.
|
||||
add_task(async function test_pending_dumps() {
|
||||
let m = await getManager();
|
||||
|
@ -186,7 +215,12 @@ add_task(async function test_prune_old() {
|
|||
let oldDate = new Date(Date.now() - 86400000);
|
||||
let newDate = new Date(Date.now() - 10000);
|
||||
await m.createEventsFile("1", "crash.main.3", oldDate, "id1", "{}");
|
||||
await m.addCrash(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_CRASH, "id2", newDate);
|
||||
await m.addCrash(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"id2",
|
||||
newDate
|
||||
);
|
||||
|
||||
await m.aggregateEventsFiles();
|
||||
|
||||
|
@ -432,68 +466,68 @@ add_task(async function test_addCrash() {
|
|||
Assert.equal(crashes.length, 0);
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"main-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_HANG,
|
||||
"main-hang",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_CONTENT,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"content-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_CONTENT,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_HANG,
|
||||
"content-hang",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_GMPLUGIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GMPLUGIN],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"gmplugin-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_GPU,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GPU],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"gpu-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_VR,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_VR],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"vr-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_RDD,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_RDD],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"rdd-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_SOCKET,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_SOCKET],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"socket-crash",
|
||||
DUMMY_DATE
|
||||
);
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"changing-item",
|
||||
DUMMY_DATE
|
||||
);
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_CONTENT,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_HANG,
|
||||
"changing-item",
|
||||
DUMMY_DATE_2
|
||||
|
@ -507,76 +541,170 @@ add_task(async function test_addCrash() {
|
|||
let crash = map.get("main-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("main-hang");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_HANG);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_HANG));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_HANG
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_HANG
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("content-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("content-hang");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_HANG
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_HANG
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("gmplugin-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_GMPLUGIN + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GMPLUGIN, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GMPLUGIN] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GMPLUGIN],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("gpu-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_GPU + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GPU, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GPU] + "-" + m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GPU],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("vr-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_VR + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_VR, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_VR] + "-" + m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_VR],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("rdd-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_RDD + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_RDD, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_RDD] + "-" + m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_RDD],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("socket-crash");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_SOCKET + "-" + m.CRASH_TYPE_CRASH);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_SOCKET, m.CRASH_TYPE_CRASH));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_SOCKET] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_SOCKET],
|
||||
m.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
|
||||
crash = map.get("changing-item");
|
||||
Assert.ok(!!crash);
|
||||
Assert.equal(crash.crashDate, DUMMY_DATE_2);
|
||||
Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG);
|
||||
Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));
|
||||
Assert.equal(
|
||||
crash.type,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT] +
|
||||
"-" +
|
||||
m.CRASH_TYPE_HANG
|
||||
);
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.CRASH_TYPE_HANG
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_child_process_crash_ping() {
|
||||
let m = await getManager();
|
||||
const EXPECTED_PROCESSES = [
|
||||
m.PROCESS_TYPE_CONTENT,
|
||||
m.PROCESS_TYPE_GPU,
|
||||
m.PROCESS_TYPE_VR,
|
||||
m.PROCESS_TYPE_RDD,
|
||||
m.PROCESS_TYPE_SOCKET,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GPU],
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_VR],
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_RDD],
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_SOCKET],
|
||||
];
|
||||
|
||||
const UNEXPECTED_PROCESSES = [
|
||||
m.PROCESS_TYPE_GMPLUGIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_GMPLUGIN],
|
||||
null,
|
||||
12, // non-string process type
|
||||
];
|
||||
|
@ -587,7 +715,10 @@ add_task(async function test_child_process_crash_ping() {
|
|||
// Add a child-process crash for each allowed process type.
|
||||
for (let p of EXPECTED_PROCESSES) {
|
||||
// Generate a ping.
|
||||
const remoteType = p === m.PROCESS_TYPE_CONTENT ? "web" : undefined;
|
||||
const remoteType =
|
||||
p === m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT]
|
||||
? "web"
|
||||
: undefined;
|
||||
let id = await m.createDummyDump();
|
||||
await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {
|
||||
RemoteType: remoteType,
|
||||
|
@ -668,7 +799,7 @@ add_task(async function test_addSubmissionAttemptAndResult() {
|
|||
Assert.equal(crashes.length, 0);
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"main-crash",
|
||||
DUMMY_DATE
|
||||
|
@ -715,7 +846,7 @@ add_task(async function test_addSubmissionAttemptEarlyCall() {
|
|||
});
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"main-crash",
|
||||
DUMMY_DATE
|
||||
|
@ -739,7 +870,7 @@ add_task(async function test_setCrashClassifications() {
|
|||
let m = await getManager();
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"main-crash",
|
||||
DUMMY_DATE
|
||||
|
@ -753,7 +884,7 @@ add_task(async function test_setRemoteCrashID() {
|
|||
let m = await getManager();
|
||||
|
||||
await m.addCrash(
|
||||
m.PROCESS_TYPE_MAIN,
|
||||
m.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
m.CRASH_TYPE_CRASH,
|
||||
"main-crash",
|
||||
DUMMY_DATE
|
||||
|
|
|
@ -65,7 +65,7 @@ async function teardown() {
|
|||
|
||||
async function addCrash(id, type = Ci.nsICrashService.CRASH_TYPE_CRASH) {
|
||||
let cs = Cc["@mozilla.org/crashservice;1"].getService(Ci.nsICrashService);
|
||||
return cs.addCrash(Ci.nsICrashService.PROCESS_TYPE_CONTENT, type, id);
|
||||
return cs.addCrash(Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT, type, id);
|
||||
}
|
||||
|
||||
async function getCrash(crashId) {
|
||||
|
|
|
@ -19,13 +19,6 @@ const DUMMY_DATE_2 = new Date(Date.now() - 5 * 24 * 60 * 60 * 1000);
|
|||
DUMMY_DATE_2.setMilliseconds(0);
|
||||
|
||||
const {
|
||||
PROCESS_TYPE_MAIN,
|
||||
PROCESS_TYPE_CONTENT,
|
||||
PROCESS_TYPE_GMPLUGIN,
|
||||
PROCESS_TYPE_GPU,
|
||||
PROCESS_TYPE_VR,
|
||||
PROCESS_TYPE_RDD,
|
||||
PROCESS_TYPE_SOCKET,
|
||||
CRASH_TYPE_CRASH,
|
||||
CRASH_TYPE_HANG,
|
||||
SUBMISSION_RESULT_OK,
|
||||
|
@ -58,7 +51,16 @@ add_task(async function test_add_crash() {
|
|||
|
||||
Assert.equal(s.crashesCount, 0);
|
||||
let d = new Date(Date.now() - 5000);
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", d));
|
||||
Assert.ok(
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"id1",
|
||||
d
|
||||
)
|
||||
);
|
||||
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
|
@ -69,14 +71,32 @@ add_task(async function test_add_crash() {
|
|||
Assert.equal(c.id, "id1", "ID set properly.");
|
||||
Assert.equal(c.crashDate.getTime(), d.getTime(), "Date set.");
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.ok(
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"id2",
|
||||
new Date()
|
||||
)
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_reset() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", DUMMY_DATE));
|
||||
Assert.ok(
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"id1",
|
||||
DUMMY_DATE
|
||||
)
|
||||
);
|
||||
Assert.equal(s.crashes.length, 1);
|
||||
s.reset();
|
||||
Assert.equal(s.crashes.length, 0);
|
||||
|
@ -89,8 +109,26 @@ add_task(async function test_save_load() {
|
|||
|
||||
let d1 = new Date();
|
||||
let d2 = new Date(d1.getTime() - 10000);
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", d1));
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", d2));
|
||||
Assert.ok(
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"id1",
|
||||
d1
|
||||
)
|
||||
);
|
||||
Assert.ok(
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"id2",
|
||||
d2
|
||||
)
|
||||
);
|
||||
Assert.ok(s.addSubmissionAttempt("id1", "sub1", d1));
|
||||
Assert.ok(s.addSubmissionResult("id1", "sub1", d2, SUBMISSION_RESULT_OK));
|
||||
Assert.ok(s.setRemoteCrashID("id1", "bp-1"));
|
||||
|
@ -131,259 +169,115 @@ add_task(async function test_corrupt_json() {
|
|||
Assert.equal(date.getTime(), s.corruptDate.getTime());
|
||||
});
|
||||
|
||||
add_task(async function test_add_main_crash() {
|
||||
async function test_add_process_crash(processType) {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
const ptName = CrashManager.prototype.processTypes[processType];
|
||||
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH));
|
||||
Assert.equal(c.type, ptName + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(ptName, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
// Duplicate.
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id3", new Date(), {
|
||||
s.addCrash(ptName, CRASH_TYPE_CRASH, "id3", new Date(), {
|
||||
OOMAllocationSize: 1048576,
|
||||
})
|
||||
);
|
||||
Assert.equal(s.crashesCount, 3);
|
||||
Assert.deepEqual(s.crashes[2].metadata, { OOMAllocationSize: 1048576 });
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH);
|
||||
let crashes = s.getCrashesOfType(ptName, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 3);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_add_main_hang() {
|
||||
async function test_add_process_hang(processType) {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id1", new Date()));
|
||||
const ptName = CrashManager.prototype.processTypes[processType];
|
||||
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_HANG, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_HANG);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG));
|
||||
Assert.equal(c.type, ptName + "-" + CRASH_TYPE_HANG);
|
||||
Assert.ok(c.isOfType(ptName, CRASH_TYPE_HANG));
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id2", new Date()));
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_HANG, "id2", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id1", new Date()));
|
||||
Assert.ok(s.addCrash(ptName, CRASH_TYPE_HANG, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG);
|
||||
let crashes = s.getCrashesOfType(ptName, CRASH_TYPE_HANG);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_add_content_crash() {
|
||||
let s = await getStore();
|
||||
function iterate_over_processTypes(fn1, fn2) {
|
||||
for (const pt in CrashManager.prototype.processTypes) {
|
||||
const ptName = CrashManager.prototype.processTypes[pt];
|
||||
if (pt !== Ci.nsIXULRuntime.PROCESS_TYPE_IPDLUNITTEST) {
|
||||
fn1(pt, ptName);
|
||||
if (
|
||||
pt === Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT ||
|
||||
pt === Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
) {
|
||||
fn2(pt, ptName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id2", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_content_hang() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_HANG);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG));
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id2", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_gmplugin_crash() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_GMPLUGIN + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id2", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_gpu_crash() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_GPU + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_vr_crash() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_VR + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_VR, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_VR, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_rdd_crash() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_RDD + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id2", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id1", new Date()));
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
|
||||
add_task(async function test_add_socket_crash() {
|
||||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 1);
|
||||
|
||||
let c = s.crashes[0];
|
||||
Assert.ok(c.crashDate);
|
||||
Assert.equal(c.type, PROCESS_TYPE_SOCKET + "-" + CRASH_TYPE_CRASH);
|
||||
Assert.ok(c.isOfType(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH));
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH, "id2", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH, "id1", new Date())
|
||||
);
|
||||
Assert.equal(s.crashesCount, 2);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 2);
|
||||
});
|
||||
iterate_over_processTypes(
|
||||
(pt, _) => {
|
||||
add_task(test_add_process_crash.bind(null, pt));
|
||||
},
|
||||
(pt, _) => {
|
||||
add_task(test_add_process_hang.bind(null, pt));
|
||||
}
|
||||
);
|
||||
|
||||
add_task(async function test_add_mixed_types() {
|
||||
let s = await getStore();
|
||||
let allAdd = true;
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "mcrash", new Date()) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "mhang", new Date()) &&
|
||||
iterate_over_processTypes(
|
||||
(_, ptName) => {
|
||||
allAdd =
|
||||
allAdd &&
|
||||
s.addCrash(ptName, CRASH_TYPE_CRASH, ptName + "crash", new Date());
|
||||
},
|
||||
(_, ptName) => {
|
||||
allAdd =
|
||||
allAdd &&
|
||||
s.addCrash(
|
||||
PROCESS_TYPE_CONTENT,
|
||||
CRASH_TYPE_CRASH,
|
||||
"ccrash",
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"mhang",
|
||||
new Date()
|
||||
) &&
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "chang", new Date()) &&
|
||||
s.addCrash(
|
||||
PROCESS_TYPE_GMPLUGIN,
|
||||
CRASH_TYPE_CRASH,
|
||||
"gmpcrash",
|
||||
new Date()
|
||||
) &&
|
||||
s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "gpucrash", new Date()) &&
|
||||
s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "vrcrash", new Date()) &&
|
||||
s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "rddcrash", new Date()) &&
|
||||
s.addCrash(
|
||||
PROCESS_TYPE_SOCKET,
|
||||
CRASH_TYPE_CRASH,
|
||||
"socketcrash",
|
||||
new Date()
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Assert.equal(s.crashesCount, 9);
|
||||
const expectedCrashes = Object.keys(CrashManager.prototype.processTypes)
|
||||
.length;
|
||||
|
||||
Assert.ok(allAdd);
|
||||
|
||||
Assert.equal(s.crashesCount, expectedCrashes);
|
||||
|
||||
await s.save();
|
||||
|
||||
|
@ -392,26 +286,18 @@ add_task(async function test_add_mixed_types() {
|
|||
|
||||
await s.load();
|
||||
|
||||
Assert.equal(s.crashesCount, 9);
|
||||
Assert.equal(s.crashesCount, expectedCrashes);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_VR, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH);
|
||||
iterate_over_processTypes(
|
||||
(_, ptName) => {
|
||||
const crashes = s.getCrashesOfType(ptName, CRASH_TYPE_CRASH);
|
||||
Assert.equal(crashes.length, 1);
|
||||
},
|
||||
(_, ptName) => {
|
||||
const hangs = s.getCrashesOfType(ptName, CRASH_TYPE_HANG);
|
||||
Assert.equal(hangs.length, 1);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Crashes added beyond the high water mark behave properly.
|
||||
|
@ -424,41 +310,173 @@ add_task(async function test_high_water() {
|
|||
let i = 0;
|
||||
for (; i < s.HIGH_WATER_DAILY_THRESHOLD; i++) {
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "mc1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "mc2" + i, d2) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "mh1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "mh2" + i, d2) &&
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "cc1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "cc2" + i, d2) &&
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "ch1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "ch2" + i, d2)
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"mc1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"mc2" + i,
|
||||
d2
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"mh1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"mh2" + i,
|
||||
d2
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"cc1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"cc2" + i,
|
||||
d2
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"ch1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"ch2" + i,
|
||||
d2
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "mc1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "mc2" + i, d2) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "mh1" + i, d1) &&
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "mh2" + i, d2)
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"mc1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"mc2" + i,
|
||||
d2
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"mh1" + i,
|
||||
d1
|
||||
) &&
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"mh2" + i,
|
||||
d2
|
||||
)
|
||||
);
|
||||
|
||||
Assert.ok(!s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "cc1" + i, d1));
|
||||
Assert.ok(!s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "cc2" + i, d2));
|
||||
Assert.ok(!s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "ch1" + i, d1));
|
||||
Assert.ok(!s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "ch2" + i, d2));
|
||||
Assert.ok(
|
||||
!s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"cc1" + i,
|
||||
d1
|
||||
)
|
||||
);
|
||||
Assert.ok(
|
||||
!s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"cc2" + i,
|
||||
d2
|
||||
)
|
||||
);
|
||||
Assert.ok(
|
||||
!s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"ch1" + i,
|
||||
d1
|
||||
)
|
||||
);
|
||||
Assert.ok(
|
||||
!s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
],
|
||||
CRASH_TYPE_HANG,
|
||||
"ch2" + i,
|
||||
d2
|
||||
)
|
||||
);
|
||||
|
||||
// We preserve main process crashes and hangs. Content crashes and
|
||||
// hangs beyond should be discarded.
|
||||
Assert.equal(s.crashesCount, 8 * s.HIGH_WATER_DAILY_THRESHOLD + 4);
|
||||
|
||||
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH);
|
||||
let crashes = s.getCrashesOfType(
|
||||
CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.equal(crashes.length, 2 * s.HIGH_WATER_DAILY_THRESHOLD + 2);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG);
|
||||
crashes = s.getCrashesOfType(
|
||||
CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
CRASH_TYPE_HANG
|
||||
);
|
||||
Assert.equal(crashes.length, 2 * s.HIGH_WATER_DAILY_THRESHOLD + 2);
|
||||
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH);
|
||||
crashes = s.getCrashesOfType(
|
||||
CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
CRASH_TYPE_CRASH
|
||||
);
|
||||
Assert.equal(crashes.length, 2 * s.HIGH_WATER_DAILY_THRESHOLD);
|
||||
crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG);
|
||||
crashes = s.getCrashesOfType(
|
||||
CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT],
|
||||
CRASH_TYPE_HANG
|
||||
);
|
||||
Assert.equal(crashes.length, 2 * s.HIGH_WATER_DAILY_THRESHOLD);
|
||||
|
||||
// But raw counts should be preserved.
|
||||
|
@ -468,20 +486,52 @@ add_task(async function test_high_water() {
|
|||
Assert.ok(s._countsByDay.has(day2));
|
||||
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_CRASH
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_HANG),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_HANG
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_CRASH),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_CRASH
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_HANG),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_HANG
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
|
||||
|
@ -492,20 +542,52 @@ add_task(async function test_high_water() {
|
|||
Assert.ok(s._countsByDay.has(day2));
|
||||
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_CRASH
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_HANG),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_HANG
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_CRASH),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_CRASH
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
Assert.equal(
|
||||
s._countsByDay.get(day1).get(PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_HANG),
|
||||
s._countsByDay
|
||||
.get(day1)
|
||||
.get(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
] +
|
||||
"-" +
|
||||
CRASH_TYPE_HANG
|
||||
),
|
||||
s.HIGH_WATER_DAILY_THRESHOLD + 1
|
||||
);
|
||||
});
|
||||
|
@ -514,7 +596,14 @@ add_task(async function test_addSubmission() {
|
|||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "crash1", DUMMY_DATE)
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"crash1",
|
||||
DUMMY_DATE
|
||||
)
|
||||
);
|
||||
|
||||
Assert.ok(s.addSubmissionAttempt("crash1", "sub1", DUMMY_DATE));
|
||||
|
@ -558,7 +647,14 @@ add_task(async function test_setCrashClassification() {
|
|||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "crash1", new Date())
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"crash1",
|
||||
new Date()
|
||||
)
|
||||
);
|
||||
let classifications = s.crashes[0].classifications;
|
||||
Assert.ok(!!classifications);
|
||||
|
@ -575,7 +671,14 @@ add_task(async function test_setRemoteCrashID() {
|
|||
let s = await getStore();
|
||||
|
||||
Assert.ok(
|
||||
s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "crash1", new Date())
|
||||
s.addCrash(
|
||||
CrashManager.prototype.processTypes[
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
|
||||
],
|
||||
CRASH_TYPE_CRASH,
|
||||
"crash1",
|
||||
new Date()
|
||||
)
|
||||
);
|
||||
Assert.equal(s.crashes[0].remoteID, null);
|
||||
Assert.ok(s.setRemoteCrashID("crash1", "bp-1"));
|
||||
|
|
|
@ -38,7 +38,12 @@ add_task(async function test_main_process_crash() {
|
|||
let crashes = await cm.getCrashes();
|
||||
Assert.equal(crashes.length, 1);
|
||||
let crash = crashes[0];
|
||||
Assert.ok(crash.isOfType(cm.PROCESS_TYPE_MAIN, cm.CRASH_TYPE_CRASH));
|
||||
Assert.ok(
|
||||
crash.isOfType(
|
||||
cm.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
|
||||
cm.CRASH_TYPE_CRASH
|
||||
)
|
||||
);
|
||||
Assert.equal(crash.id + ".dmp", basename, "ID recorded properly");
|
||||
Assert.equal(crash.metadata.ShutdownProgress, "event-test");
|
||||
Assert.ok("TelemetrySessionId" in crash.metadata);
|
||||
|
|
|
@ -102,6 +102,7 @@ inline void CommandLineArg<uint64_t>::Put(uint64_t aValue,
|
|||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
|
@ -125,6 +126,10 @@ static CommandLineArg<bool> sSafeMode{"-safeMode", "safemode"};
|
|||
static CommandLineArg<bool> sIsForBrowser{"-isForBrowser", "isforbrowser"};
|
||||
static CommandLineArg<bool> sNotForBrowser{"-notForBrowser", "notforbrowser"};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace geckoargs
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -154,6 +154,7 @@ from collections import namedtuple
|
|||
# procinfo-typename,
|
||||
# webidl-typename,
|
||||
# allcaps-name,
|
||||
# crash-ping,
|
||||
# )
|
||||
#
|
||||
# enum-value:
|
||||
|
@ -191,6 +192,9 @@ from collections import namedtuple
|
|||
#
|
||||
# allcaps-name:
|
||||
# Used as NAME for checking SYNC_ENUM in nsXULAppAPI.h
|
||||
#
|
||||
# crash-ping:
|
||||
# Boolean reflecting if the process is allowed to send crash ping.
|
||||
|
||||
|
||||
GeckoProcessType = namedtuple(
|
||||
|
@ -204,6 +208,7 @@ GeckoProcessType = namedtuple(
|
|||
"procinfo_typename",
|
||||
"webidl_typename",
|
||||
"allcaps_name",
|
||||
"crash_ping",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -217,6 +222,7 @@ process_types = [
|
|||
"Browser",
|
||||
"Browser",
|
||||
"DEFAULT",
|
||||
False,
|
||||
),
|
||||
GeckoProcessType(
|
||||
2,
|
||||
|
@ -227,6 +233,7 @@ process_types = [
|
|||
"Content",
|
||||
"Content",
|
||||
"CONTENT",
|
||||
True,
|
||||
),
|
||||
GeckoProcessType(
|
||||
3,
|
||||
|
@ -237,6 +244,7 @@ process_types = [
|
|||
"IPDLUnitTest",
|
||||
"IpdlUnitTest",
|
||||
"IPDLUNITTEST",
|
||||
False,
|
||||
),
|
||||
GeckoProcessType(
|
||||
4,
|
||||
|
@ -247,6 +255,7 @@ process_types = [
|
|||
"GMPlugin",
|
||||
"GmpPlugin",
|
||||
"GMPLUGIN",
|
||||
False,
|
||||
),
|
||||
GeckoProcessType(
|
||||
5,
|
||||
|
@ -257,6 +266,7 @@ process_types = [
|
|||
"GPU",
|
||||
"Gpu",
|
||||
"GPU",
|
||||
True,
|
||||
),
|
||||
GeckoProcessType(
|
||||
6,
|
||||
|
@ -267,6 +277,7 @@ process_types = [
|
|||
"VR",
|
||||
"Vr",
|
||||
"VR",
|
||||
True,
|
||||
),
|
||||
GeckoProcessType(
|
||||
7,
|
||||
|
@ -277,6 +288,7 @@ process_types = [
|
|||
"RDD",
|
||||
"Rdd",
|
||||
"RDD",
|
||||
True,
|
||||
),
|
||||
GeckoProcessType(
|
||||
8,
|
||||
|
@ -287,6 +299,7 @@ process_types = [
|
|||
"Socket",
|
||||
"Socket",
|
||||
"SOCKET",
|
||||
True,
|
||||
),
|
||||
GeckoProcessType(
|
||||
9,
|
||||
|
@ -297,6 +310,7 @@ process_types = [
|
|||
"RemoteSandboxBroker",
|
||||
"RemoteSandboxBroker",
|
||||
"REMOTESANDBOXBROKER",
|
||||
False,
|
||||
),
|
||||
GeckoProcessType(
|
||||
10,
|
||||
|
@ -307,5 +321,6 @@ process_types = [
|
|||
"ForkServer",
|
||||
"ForkServer",
|
||||
"FORKSERVER",
|
||||
False,
|
||||
),
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче