Bug 535802 - disable the Windows JIT crash dialog when running mochitests, r=ted

This commit is contained in:
Benjamin Smedberg 2009-12-18 16:16:38 -05:00
Родитель 1de91ec997
Коммит 061c4e65a0
4 изменённых файлов: 67 добавлений и 53 удалений

Просмотреть файл

@ -451,6 +451,7 @@ def environment(env = None, xrePath = DIST_BIN, crashreporter = True):
env['MOZ_CRASHREPORTER_DISABLE'] = '1' env['MOZ_CRASHREPORTER_DISABLE'] = '1'
env['GNOME_DISABLE_CRASH_DIALOG'] = "1" env['GNOME_DISABLE_CRASH_DIALOG'] = "1"
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
return env return env
if IS_WIN32: if IS_WIN32:

Просмотреть файл

@ -2631,20 +2631,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
nsSplashScreen *splashScreen = nsnull; nsSplashScreen *splashScreen = nsnull;
#endif #endif
#ifdef XP_WIN
/* On Windows XPSP3 and Windows Vista if DEP is configured off-by-default
we still want DEP protection: enable it explicitly and programmatically.
This function is not available on WinXPSP2 so we dynamically load it.
*/
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
SetProcessDEPPolicyFunc _SetProcessDEPPolicy =
(SetProcessDEPPolicyFunc) GetProcAddress(kernel32, "SetProcessDEPPolicy");
if (_SetProcessDEPPolicy)
_SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
#endif
nsresult rv; nsresult rv;
ArgResult ar; ArgResult ar;
NS_TIMELINE_MARK("enter main"); NS_TIMELINE_MARK("enter main");
@ -2654,33 +2640,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
NS_BREAK(); NS_BREAK();
#endif #endif
#if defined (XP_WIN32) && !defined (WINCE) SetupErrorHandling();
// Suppress the "DLL Foo could not be found" dialog, such that if dependent
// libraries (such as GDI+) are not preset, we gracefully fail to load those
// XPCOM components, instead of being ungraceful.
UINT realMode = SetErrorMode(0);
realMode |= SEM_FAILCRITICALERRORS;
// If XRE_NO_WINDOWS_CRASH_DIALOG is set, suppress displaying the "This
// application has crashed" dialog box. This is mainly useful for
// automated testing environments, e.g. tinderbox, where there's no need
// for a dozen of the dialog boxes to litter the console
if (getenv("XRE_NO_WINDOWS_CRASH_DIALOG"))
realMode |= SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
SetErrorMode(realMode);
#ifdef DEBUG
// Disable small heap allocator to get heapwalk() giving us
// accurate heap numbers. Win2k non-debug does not use small heap allocator.
// Win2k debug seems to be still using it.
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__set_sbh_threshold.asp
_set_sbh_threshold(0);
#endif
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
InstallUnixSignalHandlers(argv[0]);
#endif
#ifdef MOZ_ACCESSIBILITY_ATK #ifdef MOZ_ACCESSIBILITY_ATK
// Reset GTK_MODULES, strip atk-bridge if exists // Reset GTK_MODULES, strip atk-bridge if exists
@ -2699,18 +2659,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
PR_SetEnv("NO_AT_BRIDGE=1"); PR_SetEnv("NO_AT_BRIDGE=1");
#endif #endif
#ifndef WINCE
// Unbuffer stdout, needed for tinderbox tests.
setbuf(stdout, 0);
#endif
#if defined(FREEBSD)
// Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
// trap behavior that trips up on floating-point tests performed by
// the JS engine. See bugzilla bug 9967 details.
fpsetmask(0);
#endif
gArgc = argc; gArgc = argc;
gArgv = argv; gArgv = argv;
@ -3713,3 +3661,60 @@ XRE_GetProcessType()
#endif #endif
} }
void
SetupErrorHandling()
{
#ifdef XP_WIN
/* On Windows XPSP3 and Windows Vista if DEP is configured off-by-default
we still want DEP protection: enable it explicitly and programmatically.
This function is not available on WinXPSP2 so we dynamically load it.
*/
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
SetProcessDEPPolicyFunc _SetProcessDEPPolicy =
(SetProcessDEPPolicyFunc) GetProcAddress(kernel32, "SetProcessDEPPolicy");
if (_SetProcessDEPPolicy)
_SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
#endif
#if defined (XP_WIN32) && !defined (WINCE)
// Suppress the "DLL Foo could not be found" dialog, such that if dependent
// libraries (such as GDI+) are not preset, we gracefully fail to load those
// XPCOM components, instead of being ungraceful.
UINT realMode = SetErrorMode(0);
realMode |= SEM_FAILCRITICALERRORS;
// If XRE_NO_WINDOWS_CRASH_DIALOG is set, suppress displaying the "This
// application has crashed" dialog box. This is mainly useful for
// automated testing environments, e.g. tinderbox, where there's no need
// for a dozen of the dialog boxes to litter the console
if (getenv("XRE_NO_WINDOWS_CRASH_DIALOG"))
realMode |= SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
SetErrorMode(realMode);
#ifdef DEBUG
// Disable small heap allocator to get heapwalk() giving us
// accurate heap numbers. Win2k non-debug does not use small heap allocator.
// Win2k debug seems to be still using it.
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__set_sbh_threshold.asp
_set_sbh_threshold(0);
#endif
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
InstallUnixSignalHandlers(argv[0]);
#endif
#ifndef WINCE
// Unbuffer stdout, needed for tinderbox tests.
setbuf(stdout, 0);
#endif
#if defined(FREEBSD)
// Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
// trap behavior that trips up on floating-point tests performed by
// the JS engine. See bugzilla bug 9967 details.
fpsetmask(0);
#endif
}

Просмотреть файл

@ -190,4 +190,10 @@ extern GeckoProcessType sChildProcessType;
} }
#endif #endif
/**
* Set up platform specific error handling such as suppressing DLL load dialog
* and the JIT debugger on Windows, and install unix signal handlers.
*/
void SetupErrorHandling();
#endif // nsAppRunner_h__ #endif // nsAppRunner_h__

Просмотреть файл

@ -262,6 +262,8 @@ XRE_InitChildProcess(int aArgc,
NS_ENSURE_ARG_POINTER(aArgv); NS_ENSURE_ARG_POINTER(aArgv);
NS_ENSURE_ARG_POINTER(aArgv[0]); NS_ENSURE_ARG_POINTER(aArgv[0]);
SetupErrorHandling();
sChildProcessType = aProcess; sChildProcessType = aProcess;
#if defined(MOZ_WIDGET_GTK2) #if defined(MOZ_WIDGET_GTK2)