Bumping manifests a=b2g-bump
[gecko.git] / xpcom / base / nsCrashOnException.cpp
blob0f8042531fda31ec2c52b0f40dcc3b7dac63361c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsCrashOnException.h"
8 #include "nsCOMPtr.h"
9 #include "nsServiceManagerUtils.h"
11 #ifdef MOZ_CRASHREPORTER
12 #include "nsICrashReporter.h"
13 #endif
15 namespace mozilla {
17 static int
18 ReportException(EXCEPTION_POINTERS* aExceptionInfo)
20 #ifdef MOZ_CRASHREPORTER
21 nsCOMPtr<nsICrashReporter> cr =
22 do_GetService("@mozilla.org/toolkit/crash-reporter;1");
23 if (cr) {
24 cr->WriteMinidumpForException(aExceptionInfo);
26 #endif
27 return EXCEPTION_EXECUTE_HANDLER;
30 XPCOM_API(LRESULT)
31 CallWindowProcCrashProtected(WNDPROC aWndProc, HWND aHWnd, UINT aMsg,
32 WPARAM aWParam, LPARAM aLParam)
34 MOZ_SEH_TRY {
35 return aWndProc(aHWnd, aMsg, aWParam, aLParam);
37 MOZ_SEH_EXCEPT(ReportException(GetExceptionInformation())) {
38 ::TerminateProcess(::GetCurrentProcess(), 253);
40 return 0; // not reached