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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsIClassInfoImpl.h" |
michael@0 | 6 | #include "nsIProgrammingLanguage.h" |
michael@0 | 7 | |
michael@0 | 8 | NS_IMETHODIMP_(MozExternalRefCountType) |
michael@0 | 9 | GenericClassInfo::AddRef() |
michael@0 | 10 | { |
michael@0 | 11 | return 2; |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | NS_IMETHODIMP_(MozExternalRefCountType) |
michael@0 | 15 | GenericClassInfo::Release() |
michael@0 | 16 | { |
michael@0 | 17 | return 1; |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | NS_IMPL_QUERY_INTERFACE(GenericClassInfo, nsIClassInfo) |
michael@0 | 21 | |
michael@0 | 22 | NS_IMETHODIMP |
michael@0 | 23 | GenericClassInfo::GetInterfaces(uint32_t* countp, nsIID*** array) |
michael@0 | 24 | { |
michael@0 | 25 | return mData->getinterfaces(countp, array); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | NS_IMETHODIMP |
michael@0 | 29 | GenericClassInfo::GetHelperForLanguage(uint32_t language, nsISupports** helper) |
michael@0 | 30 | { |
michael@0 | 31 | if (mData->getlanguagehelper) |
michael@0 | 32 | return mData->getlanguagehelper(language, helper); |
michael@0 | 33 | return NS_ERROR_NOT_IMPLEMENTED; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | NS_IMETHODIMP |
michael@0 | 37 | GenericClassInfo::GetContractID(char** contractid) |
michael@0 | 38 | { |
michael@0 | 39 | NS_ERROR("GetContractID not implemented"); |
michael@0 | 40 | *contractid = nullptr; |
michael@0 | 41 | return NS_ERROR_NOT_IMPLEMENTED; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | NS_IMETHODIMP |
michael@0 | 45 | GenericClassInfo::GetClassDescription(char** description) |
michael@0 | 46 | { |
michael@0 | 47 | *description = nullptr; |
michael@0 | 48 | return NS_ERROR_NOT_IMPLEMENTED; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | NS_IMETHODIMP |
michael@0 | 52 | GenericClassInfo::GetClassID(nsCID** classid) |
michael@0 | 53 | { |
michael@0 | 54 | NS_ERROR("GetClassID not implemented"); |
michael@0 | 55 | *classid = nullptr; |
michael@0 | 56 | return NS_ERROR_NOT_IMPLEMENTED; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | NS_IMETHODIMP |
michael@0 | 60 | GenericClassInfo::GetImplementationLanguage(uint32_t* language) |
michael@0 | 61 | { |
michael@0 | 62 | *language = nsIProgrammingLanguage::CPLUSPLUS; |
michael@0 | 63 | return NS_OK; |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | NS_IMETHODIMP |
michael@0 | 67 | GenericClassInfo::GetFlags(uint32_t* flags) |
michael@0 | 68 | { |
michael@0 | 69 | *flags = mData->flags; |
michael@0 | 70 | return NS_OK; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | NS_IMETHODIMP |
michael@0 | 74 | GenericClassInfo::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc) |
michael@0 | 75 | { |
michael@0 | 76 | *aClassIDNoAlloc = mData->cid; |
michael@0 | 77 | return NS_OK; |
michael@0 | 78 | } |