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 273443 dc33e774e56d24b4e7c4fa999da0bbc2046f137e
parent 273442 60e6b53060b9c3757a9407ce816154427249a084
child 273444 1d30e55d0c0b85c5b07399b64892c1308593cbed
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, NPOTB
bugs1170665
milestone40.0a2
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
@@ -6323,19 +6323,33 @@ MaybeOverrideOutFileFromEnv(const char* 
 
 /* Pretend we can always preserve wrappers for dummy DOM objects. */
 static bool
 DummyPreserveWrapperCallback(JSContext* cx, JSObject* obj)
 {
     return true;
 }
 
+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
     {