diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/crashreporter/test/CrashTestUtils.jsm | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/crashreporter/test/CrashTestUtils.jsm')
-rw-r--r-- | toolkit/crashreporter/test/CrashTestUtils.jsm | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/toolkit/crashreporter/test/CrashTestUtils.jsm b/toolkit/crashreporter/test/CrashTestUtils.jsm new file mode 100644 index 000000000..70162ab63 --- /dev/null +++ b/toolkit/crashreporter/test/CrashTestUtils.jsm @@ -0,0 +1,72 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +this.EXPORTED_SYMBOLS = ["CrashTestUtils"]; + +this.CrashTestUtils = { + // These will be defined using ctypes APIs below. + crash: null, + lockDir: null, + dumpHasStream: null, + dumpHasInstructionPointerMemory: null, + + // Constants for crash() + // Keep these in sync with nsTestCrasher.cpp! + CRASH_INVALID_POINTER_DEREF: 0, + CRASH_PURE_VIRTUAL_CALL: 1, + CRASH_RUNTIMEABORT: 2, + CRASH_OOM: 3, + CRASH_MOZ_CRASH: 4, + CRASH_ABORT: 5, + + // Constants for dumpHasStream() + // From google_breakpad/common/minidump_format.h + MD_THREAD_LIST_STREAM: 3, + MD_MEMORY_INFO_LIST_STREAM: 16 +}; + +// Grab APIs from the testcrasher shared library +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/ctypes.jsm"); +var dir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsILocalFile); +var file = dir.clone(); +file = file.parent; +file.append(ctypes.libraryName("testcrasher")); +var lib = ctypes.open(file.path); +CrashTestUtils.crash = lib.declare("Crash", + ctypes.default_abi, + ctypes.void_t, + ctypes.int16_t); +CrashTestUtils.saveAppMemory = lib.declare("SaveAppMemory", + ctypes.default_abi, + ctypes.uint64_t); + +CrashTestUtils.lockDir = lib.declare("LockDir", + ctypes.default_abi, + ctypes.voidptr_t, // nsILocalFile* + ctypes.voidptr_t); // nsISupports* + + +try { + CrashTestUtils.TryOverrideExceptionHandler = lib.declare("TryOverrideExceptionHandler", + ctypes.default_abi, + ctypes.void_t); +} +catch (ex) {} + +CrashTestUtils.dumpHasStream = lib.declare("DumpHasStream", + ctypes.default_abi, + ctypes.bool, + ctypes.char.ptr, + ctypes.uint32_t); + +CrashTestUtils.dumpHasInstructionPointerMemory = + lib.declare("DumpHasInstructionPointerMemory", + ctypes.default_abi, + ctypes.bool, + ctypes.char.ptr); + +CrashTestUtils.dumpCheckMemory = lib.declare("DumpCheckMemory", + ctypes.default_abi, + ctypes.bool, + ctypes.char.ptr); |