xpcom/base/nsCrashOnException.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsCrashOnException.h"
     7 #include "nsCOMPtr.h"
     8 #include "nsServiceManagerUtils.h"
    10 #ifdef MOZ_CRASHREPORTER
    11 #include "nsICrashReporter.h"
    12 #endif
    14 namespace mozilla {
    16 static int ReportException(EXCEPTION_POINTERS *aExceptionInfo)
    17 {
    18 #ifdef MOZ_CRASHREPORTER
    19   nsCOMPtr<nsICrashReporter> cr =
    20     do_GetService("@mozilla.org/toolkit/crash-reporter;1");
    21   if (cr)
    22     cr->WriteMinidumpForException(aExceptionInfo);
    23 #endif
    24   return EXCEPTION_EXECUTE_HANDLER;
    25 }
    27 XPCOM_API(LRESULT)
    28 CallWindowProcCrashProtected(WNDPROC wndProc, HWND hWnd, UINT msg,
    29                             WPARAM wParam, LPARAM lParam)
    30 {
    31   MOZ_SEH_TRY {
    32     return wndProc(hWnd, msg, wParam, lParam);
    33   }
    34   MOZ_SEH_EXCEPT(ReportException(GetExceptionInformation())) {
    35     ::TerminateProcess(::GetCurrentProcess(), 253);
    36   }
    37   return 0; // not reached
    38 }
    40 }

mercurial