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.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsArrayUtils_h__
7 #define nsArrayUtils_h__
9 #include "nsCOMPtr.h"
10 #include "nsIArray.h"
12 // helper class for do_QueryElementAt
13 class NS_COM_GLUE nsQueryArrayElementAt : public nsCOMPtr_helper
14 {
15 public:
16 nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex,
17 nsresult* aErrorPtr)
18 : mArray(aArray),
19 mIndex(aIndex),
20 mErrorPtr(aErrorPtr)
21 {
22 // nothing else to do here
23 }
25 virtual nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const;
27 private:
28 nsIArray* mArray;
29 uint32_t mIndex;
30 nsresult* mErrorPtr;
31 };
33 inline
34 const nsQueryArrayElementAt
35 do_QueryElementAt(nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = 0)
36 {
37 return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr);
38 }
40 #endif // nsArrayUtils_h__