Files
sousa-gecko/toolkit/components/backgroundtasks/tests/BackgroundTask_crashReporterStatus.sys.mjs
Simon Chopin 134c06a80b Bug 2040673 - test that the crashhelper is properly disabled with the appropriate env variable r=gsvelto
We use a new process with a background task in order to get a "normal"
crash handling, as the xpcshell has its own codepaths dealing with crash
handling that force the issue.

Note that we explicitly skip Windows from PID checking in the enabled
test case. Exporting this particular piece of information is not trivial
and is likely costly performance-wise, which is likely not worth it just
for the sake of testing. Instead, correctness will have to be tested
manually.

Differential Revision: https://phabricator.services.mozilla.com/D303762
2026-07-02 07:42:03 +00:00

33 lines
896 B
JavaScript

/* 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/. */
/**
* Dump the status of crash reporting utilities.
*/
export async function runBackgroundTask() {
let testUtils = Cc[
"@mozilla.org/toolkit/crashreporter-test-utils;1"
].getService(Ci.nsICrashReporterTestUtils);
let cr = Services.appinfo;
function probe(getter) {
try {
return { value: String(getter()) };
} catch (ex) {
return { error: ex.result };
}
}
let info = {
crashReporterEnabled: cr.crashReporterEnabled,
crashHelperPid: testUtils.getCrashHelperPid(),
serverURL: probe(() => cr.serverURL?.spec),
minidumpPath: probe(() => cr.minidumpPath?.path),
};
dump("CRASH_INFO=" + JSON.stringify(info) + "\n");
return 0;
}