Bug 976863 - Prevent tests from using CrashTestUtils.CRASH_ABORT on Windows; r=bsmedberg
☠☠ backed out by 1ed55c9d92a8 ☠ ☠
authorGregory Szorc <gps@mozilla.com>
Tue, 25 Feb 2014 16:46:41 -0800
changeset 189294 6cc5a05281c35d02cc198d6056dda8f259893ff5
parent 189293 ac4f9ca4fb27e57db7b27108ab6664130da9357f
child 189295 25bbf68caed4ff7bbd5fb66f952d5333928fe79e
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs976863
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 976863 - Prevent tests from using CrashTestUtils.CRASH_ABORT on Windows; r=bsmedberg
toolkit/crashreporter/test/CrashTestUtils.jsm
--- a/toolkit/crashreporter/test/CrashTestUtils.jsm
+++ b/toolkit/crashreporter/test/CrashTestUtils.jsm
@@ -27,17 +27,32 @@ this.CrashTestUtils = {
 
 // Grab APIs from the testcrasher shared library
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/ctypes.jsm");
 let dir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsILocalFile);
 let file = dir.clone();
 file.append(ctypes.libraryName("testcrasher"));
 let lib = ctypes.open(file.path);
-CrashTestUtils.crash = lib.declare("Crash",
+
+CrashTestUtils.crash = (crashType) => {
+  // CRASH_ABORT on Windows will bring up a dialog and hang until a user
+  // clicks a dialog. Tests are useless here. Detect that scenario and
+  // fail fast.
+  if (crashType == CrashTestUtils.CRASH_ABORT) {
+    if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS == "WINNT") {
+      throw new Error("CRASH_ABORT cannot be used on Windows because it " +
+                      "launches a dialog that requires user interaction.");
+    }
+  }
+
+  return CrashTestUtils._crash(crashType);
+};
+
+CrashTestUtils._crash = lib.declare("Crash",
                                    ctypes.default_abi,
                                    ctypes.void_t,
                                    ctypes.int16_t);
 CrashTestUtils.saveAppMemory = lib.declare("SaveAppMemory",
                                            ctypes.default_abi,
                                            ctypes.uint64_t);
 
 CrashTestUtils.lockDir = lib.declare("LockDir",