Bug 1170665 - Disable the windows segfault popup in the shell. r=jandem, a=NPOTB
authorTerrence Cole <terrence@mozilla.com>
Tue, 02 Jun 2015 11:40:46 -0700
changeset 266194 f5030585d5c0
parent 266193 51f5d060b146
child 266195 e25fcbbd93a4
push id4783
push userryanvm@gmail.com
push date2015-06-05 16:02 +0000
treeherdermozilla-beta@e25fcbbd93a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, NPOTB
bugs1170665
milestone39.0
Bug 1170665 - Disable the windows segfault popup in the shell. r=jandem, a=NPOTB
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -6092,19 +6092,33 @@ ShellMallocSizeOf(const void* constPtr)
     return malloc_size(ptr);
 #elif HAVE__MSIZE
     return _msize(ptr);
 #else
     return 0;
 #endif
 }
 
+static void
+PreInit()
+{
+#ifdef XP_WIN
+    // Disable the segfault dialog. We want to fail the tests immediately
+    // instead of hanging automation.
+    UINT prevMode = SetErrorMode(0);
+    UINT newMode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
+    SetErrorMode(prevMode | newMode);
+#endif
+}
+
 int
 main(int argc, char** argv, char** envp)
 {
+    PreInit();
+
     sArgc = argc;
     sArgv = argv;
 
     JSRuntime* rt;
     JSContext* cx;
     int result;
 #ifdef XP_WIN
     {