toolkit/crashreporter/test/CrashTestUtils.jsm

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 this.EXPORTED_SYMBOLS = ["CrashTestUtils"];
michael@0 5
michael@0 6 this.CrashTestUtils = {
michael@0 7 // These will be defined using ctypes APIs below.
michael@0 8 crash: null,
michael@0 9 lockDir: null,
michael@0 10 dumpHasStream: null,
michael@0 11 dumpHasInstructionPointerMemory: null,
michael@0 12
michael@0 13 // Constants for crash()
michael@0 14 // Keep these in sync with nsTestCrasher.cpp!
michael@0 15 CRASH_INVALID_POINTER_DEREF: 0,
michael@0 16 CRASH_PURE_VIRTUAL_CALL: 1,
michael@0 17 CRASH_RUNTIMEABORT: 2,
michael@0 18 CRASH_OOM: 3,
michael@0 19 CRASH_MOZ_CRASH: 4,
michael@0 20 CRASH_ABORT: 5,
michael@0 21
michael@0 22 // Constants for dumpHasStream()
michael@0 23 // From google_breakpad/common/minidump_format.h
michael@0 24 MD_THREAD_LIST_STREAM: 3,
michael@0 25 MD_MEMORY_INFO_LIST_STREAM: 16
michael@0 26 };
michael@0 27
michael@0 28 // Grab APIs from the testcrasher shared library
michael@0 29 Components.utils.import("resource://gre/modules/Services.jsm");
michael@0 30 Components.utils.import("resource://gre/modules/ctypes.jsm");
michael@0 31 let dir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsILocalFile);
michael@0 32 let file = dir.clone();
michael@0 33 file.append(ctypes.libraryName("testcrasher"));
michael@0 34 let lib = ctypes.open(file.path);
michael@0 35 CrashTestUtils.crash = lib.declare("Crash",
michael@0 36 ctypes.default_abi,
michael@0 37 ctypes.void_t,
michael@0 38 ctypes.int16_t);
michael@0 39 CrashTestUtils.saveAppMemory = lib.declare("SaveAppMemory",
michael@0 40 ctypes.default_abi,
michael@0 41 ctypes.uint64_t);
michael@0 42
michael@0 43 CrashTestUtils.lockDir = lib.declare("LockDir",
michael@0 44 ctypes.default_abi,
michael@0 45 ctypes.voidptr_t, // nsILocalFile*
michael@0 46 ctypes.voidptr_t); // nsISupports*
michael@0 47
michael@0 48
michael@0 49 try {
michael@0 50 CrashTestUtils.TryOverrideExceptionHandler = lib.declare("TryOverrideExceptionHandler",
michael@0 51 ctypes.default_abi,
michael@0 52 ctypes.void_t);
michael@0 53 }
michael@0 54 catch(ex) {}
michael@0 55
michael@0 56 CrashTestUtils.dumpHasStream = lib.declare("DumpHasStream",
michael@0 57 ctypes.default_abi,
michael@0 58 ctypes.bool,
michael@0 59 ctypes.char.ptr,
michael@0 60 ctypes.uint32_t);
michael@0 61
michael@0 62 CrashTestUtils.dumpHasInstructionPointerMemory =
michael@0 63 lib.declare("DumpHasInstructionPointerMemory",
michael@0 64 ctypes.default_abi,
michael@0 65 ctypes.bool,
michael@0 66 ctypes.char.ptr);
michael@0 67
michael@0 68 CrashTestUtils.dumpCheckMemory = lib.declare("DumpCheckMemory",
michael@0 69 ctypes.default_abi,
michael@0 70 ctypes.bool,
michael@0 71 ctypes.char.ptr);

mercurial