summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/test/unit/test_crash_modules.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/crashreporter/test/unit/test_crash_modules.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/crashreporter/test/unit/test_crash_modules.js')
-rw-r--r--toolkit/crashreporter/test/unit/test_crash_modules.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/toolkit/crashreporter/test/unit/test_crash_modules.js b/toolkit/crashreporter/test/unit/test_crash_modules.js
new file mode 100644
index 0000000000..89eae2d202
--- /dev/null
+++ b/toolkit/crashreporter/test/unit/test_crash_modules.js
@@ -0,0 +1,46 @@
+add_task(async function run_test() {
+ if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
+ dump(
+ "INFO | test_crash_modules.js | Can't test crashreporter in a non-libxul build.\n"
+ );
+ return;
+ }
+
+ await do_crash(
+ function() {
+ const { ctypes } = ChromeUtils.import(
+ "resource://gre/modules/ctypes.jsm"
+ );
+ // Load and unload a DLL so that it will show up as unloaded in the minidump
+ let lib = ctypes.open("wininet");
+ lib.close();
+ },
+ async function(mdump, extra, extraFile) {
+ runMinidumpAnalyzer(mdump);
+
+ // Refresh updated extra data
+ let data = await OS.File.read(extraFile.path);
+ let decoder = new TextDecoder();
+ extra = JSON.parse(decoder.decode(data));
+
+ // Check unloaded modules
+ const unloadedModules = extra.StackTraces.unloaded_modules;
+ Assert.ok(!!unloadedModules, "The unloaded_modules field exists");
+ Assert.notEqual(unloadedModules.find(e => e.filename == "wininet.DLL"));
+
+ // Check the module signature information
+ const sigInfo = JSON.parse(extra.ModuleSignatureInfo);
+ Assert.ok(
+ !!sigInfo["Microsoft Windows"],
+ "The module signature info contains valid data"
+ );
+ Assert.greater(
+ sigInfo["Microsoft Windows"].length,
+ 0,
+ "Multiple signed binaries were found"
+ );
+ },
+ // process will exit with a zero exit status
+ true
+ );
+});