bug 792850 - add an xpcshell test for our SetUnhandledExceptionFilter hook. r=ehsan

--HG--
extra : rebase_source : f289d7d8214bcfdd90baeae8c47e2747de806426
This commit is contained in:
Ted Mielczarek 2012-09-20 10:57:08 -04:00
parent ced2e35a6b
commit 2aaaf25f58
4 changed files with 35 additions and 0 deletions

View File

@ -42,6 +42,13 @@ CrashTestUtils.lockDir = lib.declare("LockDir",
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,

View File

@ -104,3 +104,17 @@ uint64_t SaveAppMemory()
return (int64_t)testData;
}
#ifdef XP_WIN32
static LONG WINAPI HandleException(EXCEPTION_POINTERS* exinfo)
{
TerminateProcess(GetCurrentProcess(), 0);
return 0;
}
extern "C" NS_EXPORT
void TryOverrideExceptionHandler()
{
SetUnhandledExceptionFilter(HandleException);
}
#endif

View File

@ -0,0 +1,12 @@
function run_test()
{
// Ensure that attempting to override the exception handler doesn't cause
// us to lose our exception handler.
do_crash(
function() {
CrashTestUtils.TryOverrideExceptionHandler();
},
function(mdump, extra) {
},
true);
}

View File

@ -11,6 +11,8 @@ skip-if = os == 'win' && debug
[test_crashreporter.js]
[test_crashreporter_crash.js]
[test_crashreporter_crash_profile_lock.js]
[test_override_exception_handler.js]
run-if = os == 'win'
[test_crashreporter_appmem.js]
run-if = os == 'win' || os == 'linux'