accessible/src/windows/msaa/IUnknownImpl.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/windows/msaa/IUnknownImpl.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. *
     1.9 + */
    1.10 +
    1.11 +#include "IUnknownImpl.h"
    1.12 +
    1.13 +#include "nsDebug.h"
    1.14 +
    1.15 +#ifdef MOZ_CRASHREPORTER
    1.16 +#include "nsExceptionHandler.h"
    1.17 +#endif
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace a11y {
    1.21 +
    1.22 +HRESULT
    1.23 +GetHRESULT(nsresult aResult)
    1.24 +{
    1.25 +  switch (aResult) {
    1.26 +    case NS_OK:
    1.27 +      return S_OK;
    1.28 +
    1.29 +    case NS_ERROR_INVALID_ARG:
    1.30 +      return E_INVALIDARG;
    1.31 +
    1.32 +    case NS_ERROR_OUT_OF_MEMORY:
    1.33 +      return E_OUTOFMEMORY;
    1.34 +
    1.35 +    case NS_ERROR_NOT_IMPLEMENTED:
    1.36 +      return E_NOTIMPL;
    1.37 +
    1.38 +    default:
    1.39 +      return E_FAIL;
    1.40 +  }
    1.41 +}
    1.42 +
    1.43 +int
    1.44 +FilterExceptions(unsigned int aCode, EXCEPTION_POINTERS* aExceptionInfo)
    1.45 +{
    1.46 +  if (aCode == EXCEPTION_ACCESS_VIOLATION) {
    1.47 +#ifdef MOZ_CRASHREPORTER
    1.48 +    // MSAA swallows crashes (because it is COM-based) but we still need to
    1.49 +    // learn about those crashes so we can fix them. Make sure to pass them to
    1.50 +    // the crash reporter.
    1.51 +    CrashReporter::WriteMinidumpForException(aExceptionInfo);
    1.52 +#endif
    1.53 +  } else {
    1.54 +    NS_NOTREACHED("We should only be catching crash exceptions");
    1.55 +  }
    1.56 +
    1.57 +  return EXCEPTION_CONTINUE_SEARCH;
    1.58 +}
    1.59 +
    1.60 +} // namespace a11y
    1.61 +} // namespace mozilla

mercurial