michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. * michael@0: */ michael@0: michael@0: #include "IUnknownImpl.h" michael@0: michael@0: #include "nsDebug.h" michael@0: michael@0: #ifdef MOZ_CRASHREPORTER michael@0: #include "nsExceptionHandler.h" michael@0: #endif michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: HRESULT michael@0: GetHRESULT(nsresult aResult) michael@0: { michael@0: switch (aResult) { michael@0: case NS_OK: michael@0: return S_OK; michael@0: michael@0: case NS_ERROR_INVALID_ARG: michael@0: return E_INVALIDARG; michael@0: michael@0: case NS_ERROR_OUT_OF_MEMORY: michael@0: return E_OUTOFMEMORY; michael@0: michael@0: case NS_ERROR_NOT_IMPLEMENTED: michael@0: return E_NOTIMPL; michael@0: michael@0: default: michael@0: return E_FAIL; michael@0: } michael@0: } michael@0: michael@0: int michael@0: FilterExceptions(unsigned int aCode, EXCEPTION_POINTERS* aExceptionInfo) michael@0: { michael@0: if (aCode == EXCEPTION_ACCESS_VIOLATION) { michael@0: #ifdef MOZ_CRASHREPORTER michael@0: // MSAA swallows crashes (because it is COM-based) but we still need to michael@0: // learn about those crashes so we can fix them. Make sure to pass them to michael@0: // the crash reporter. michael@0: CrashReporter::WriteMinidumpForException(aExceptionInfo); michael@0: #endif michael@0: } else { michael@0: NS_NOTREACHED("We should only be catching crash exceptions"); michael@0: } michael@0: michael@0: return EXCEPTION_CONTINUE_SEARCH; michael@0: } michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla