accessible/src/windows/msaa/IUnknownImpl.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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  */
     8 #include "IUnknownImpl.h"
    10 #include "nsDebug.h"
    12 #ifdef MOZ_CRASHREPORTER
    13 #include "nsExceptionHandler.h"
    14 #endif
    16 namespace mozilla {
    17 namespace a11y {
    19 HRESULT
    20 GetHRESULT(nsresult aResult)
    21 {
    22   switch (aResult) {
    23     case NS_OK:
    24       return S_OK;
    26     case NS_ERROR_INVALID_ARG:
    27       return E_INVALIDARG;
    29     case NS_ERROR_OUT_OF_MEMORY:
    30       return E_OUTOFMEMORY;
    32     case NS_ERROR_NOT_IMPLEMENTED:
    33       return E_NOTIMPL;
    35     default:
    36       return E_FAIL;
    37   }
    38 }
    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   }
    54   return EXCEPTION_CONTINUE_SEARCH;
    55 }
    57 } // namespace a11y
    58 } // namespace mozilla

mercurial