Bug 976863 - Prevent tests from using CrashTestUtils.CRASH_ABORT on Windows; r=bsmedberg

--HG--
extra : rebase_source : 4f121bbe6b9ca87b2f4d6e2cbad4bb7a2ecb509a
This commit is contained in:
Gregory Szorc 2014-02-25 16:46:41 -08:00
parent cd70980d39
commit 5ab6772712

View File

@ -32,7 +32,22 @@ 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);