accessible/src/windows/msaa/IUnknownImpl.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:2312c0b8d41e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=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/. *
6 */
7
8 #include "IUnknownImpl.h"
9
10 #include "nsDebug.h"
11
12 #ifdef MOZ_CRASHREPORTER
13 #include "nsExceptionHandler.h"
14 #endif
15
16 namespace mozilla {
17 namespace a11y {
18
19 HRESULT
20 GetHRESULT(nsresult aResult)
21 {
22 switch (aResult) {
23 case NS_OK:
24 return S_OK;
25
26 case NS_ERROR_INVALID_ARG:
27 return E_INVALIDARG;
28
29 case NS_ERROR_OUT_OF_MEMORY:
30 return E_OUTOFMEMORY;
31
32 case NS_ERROR_NOT_IMPLEMENTED:
33 return E_NOTIMPL;
34
35 default:
36 return E_FAIL;
37 }
38 }
39
40 int
41 FilterExceptions(unsigned int aCode, EXCEPTION_POINTERS* aExceptionInfo)
42 {
43 if (aCode == EXCEPTION_ACCESS_VIOLATION) {
44 #ifdef MOZ_CRASHREPORTER
45 // MSAA swallows crashes (because it is COM-based) but we still need to
46 // learn about those crashes so we can fix them. Make sure to pass them to
47 // the crash reporter.
48 CrashReporter::WriteMinidumpForException(aExceptionInfo);
49 #endif
50 } else {
51 NS_NOTREACHED("We should only be catching crash exceptions");
52 }
53
54 return EXCEPTION_CONTINUE_SEARCH;
55 }
56
57 } // namespace a11y
58 } // namespace mozilla

mercurial