Tue, 06 Jan 2015 21:39:09 +0100
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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. * |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #include "IUnknownImpl.h" |
michael@0 | 9 | |
michael@0 | 10 | #include "nsDebug.h" |
michael@0 | 11 | |
michael@0 | 12 | #ifdef MOZ_CRASHREPORTER |
michael@0 | 13 | #include "nsExceptionHandler.h" |
michael@0 | 14 | #endif |
michael@0 | 15 | |
michael@0 | 16 | namespace mozilla { |
michael@0 | 17 | namespace a11y { |
michael@0 | 18 | |
michael@0 | 19 | HRESULT |
michael@0 | 20 | GetHRESULT(nsresult aResult) |
michael@0 | 21 | { |
michael@0 | 22 | switch (aResult) { |
michael@0 | 23 | case NS_OK: |
michael@0 | 24 | return S_OK; |
michael@0 | 25 | |
michael@0 | 26 | case NS_ERROR_INVALID_ARG: |
michael@0 | 27 | return E_INVALIDARG; |
michael@0 | 28 | |
michael@0 | 29 | case NS_ERROR_OUT_OF_MEMORY: |
michael@0 | 30 | return E_OUTOFMEMORY; |
michael@0 | 31 | |
michael@0 | 32 | case NS_ERROR_NOT_IMPLEMENTED: |
michael@0 | 33 | return E_NOTIMPL; |
michael@0 | 34 | |
michael@0 | 35 | default: |
michael@0 | 36 | return E_FAIL; |
michael@0 | 37 | } |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | int |
michael@0 | 41 | FilterExceptions(unsigned int aCode, EXCEPTION_POINTERS* aExceptionInfo) |
michael@0 | 42 | { |
michael@0 | 43 | if (aCode == EXCEPTION_ACCESS_VIOLATION) { |
michael@0 | 44 | #ifdef MOZ_CRASHREPORTER |
michael@0 | 45 | // MSAA swallows crashes (because it is COM-based) but we still need to |
michael@0 | 46 | // learn about those crashes so we can fix them. Make sure to pass them to |
michael@0 | 47 | // the crash reporter. |
michael@0 | 48 | CrashReporter::WriteMinidumpForException(aExceptionInfo); |
michael@0 | 49 | #endif |
michael@0 | 50 | } else { |
michael@0 | 51 | NS_NOTREACHED("We should only be catching crash exceptions"); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | return EXCEPTION_CONTINUE_SEARCH; |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | } // namespace a11y |
michael@0 | 58 | } // namespace mozilla |