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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 nsPersistentProperties_h___
7 #define nsPersistentProperties_h___
9 #include "nsIPersistentProperties2.h"
10 #include "pldhash.h"
11 #include "plarena.h"
12 #include "nsString.h"
13 #include "nsCOMPtr.h"
14 #include "mozilla/Attributes.h"
16 class nsIUnicharInputStream;
18 class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
19 {
20 public:
21 nsPersistentProperties();
23 NS_DECL_THREADSAFE_ISUPPORTS
24 NS_DECL_NSIPROPERTIES
25 NS_DECL_NSIPERSISTENTPROPERTIES
27 static nsresult
28 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
30 private:
31 ~nsPersistentProperties();
33 protected:
34 nsCOMPtr<nsIUnicharInputStream> mIn;
36 nsIPersistentProperties* mSubclass;
37 struct PLDHashTable mTable;
38 PLArenaPool mArena;
39 };
41 class nsPropertyElement MOZ_FINAL : public nsIPropertyElement
42 {
43 public:
44 nsPropertyElement()
45 {
46 }
48 nsPropertyElement(const nsACString& aKey, const nsAString& aValue)
49 : mKey(aKey), mValue(aValue)
50 {
51 }
53 NS_DECL_ISUPPORTS
54 NS_DECL_NSIPROPERTYELEMENT
56 static NS_METHOD
57 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
59 private:
60 ~nsPropertyElement() {}
62 protected:
63 nsCString mKey;
64 nsString mValue;
65 };
67 #endif /* nsPersistentProperties_h___ */