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: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
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 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | /* XXX we should define device and entry info as well (stats, etc) */ |
michael@0 | 10 | |
michael@0 | 11 | interface nsICacheDeviceInfo; |
michael@0 | 12 | interface nsICacheEntryInfo; |
michael@0 | 13 | |
michael@0 | 14 | |
michael@0 | 15 | [scriptable, uuid(f8c08c4b-d778-49d1-a59b-866fdc500d95)] |
michael@0 | 16 | interface nsICacheVisitor : nsISupports |
michael@0 | 17 | { |
michael@0 | 18 | /** |
michael@0 | 19 | * Called to provide information about a cache device. |
michael@0 | 20 | * |
michael@0 | 21 | * @param deviceID - specifies the device being visited. |
michael@0 | 22 | * @param deviceInfo - specifies information about this device. |
michael@0 | 23 | * |
michael@0 | 24 | * @return true to start visiting all entries for this device. |
michael@0 | 25 | * @return false to advance to the next device. |
michael@0 | 26 | */ |
michael@0 | 27 | boolean visitDevice(in string deviceID, |
michael@0 | 28 | in nsICacheDeviceInfo deviceInfo); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Called to provide information about a cache entry. |
michael@0 | 32 | * |
michael@0 | 33 | * @param deviceID - specifies the device being visited. |
michael@0 | 34 | * @param entryInfo - specifies information about this entry. |
michael@0 | 35 | * |
michael@0 | 36 | * @return true to visit the next entry on the current device, or if the |
michael@0 | 37 | * end of the device has been reached, advance to the next device. |
michael@0 | 38 | * @return false to advance to the next device. |
michael@0 | 39 | */ |
michael@0 | 40 | boolean visitEntry(in string deviceID, |
michael@0 | 41 | in nsICacheEntryInfo entryInfo); |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | [scriptable, uuid(31d1c294-1dd2-11b2-be3a-c79230dca297)] |
michael@0 | 46 | interface nsICacheDeviceInfo : nsISupports |
michael@0 | 47 | { |
michael@0 | 48 | /** |
michael@0 | 49 | * Get a human readable description of the cache device. |
michael@0 | 50 | */ |
michael@0 | 51 | readonly attribute string description; |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Get a usage report, statistics, miscellaneous data about |
michael@0 | 55 | * the cache device. |
michael@0 | 56 | */ |
michael@0 | 57 | readonly attribute string usageReport; |
michael@0 | 58 | |
michael@0 | 59 | /** |
michael@0 | 60 | * Get the number of stored cache entries. |
michael@0 | 61 | */ |
michael@0 | 62 | readonly attribute unsigned long entryCount; |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * Get the total size of the stored cache entries. |
michael@0 | 66 | */ |
michael@0 | 67 | readonly attribute unsigned long totalSize; |
michael@0 | 68 | |
michael@0 | 69 | /** |
michael@0 | 70 | * Get the upper limit of the size of the data the cache can store. |
michael@0 | 71 | */ |
michael@0 | 72 | readonly attribute unsigned long maximumSize; |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | |
michael@0 | 76 | [scriptable, uuid(fab51c92-95c3-4468-b317-7de4d7588254)] |
michael@0 | 77 | interface nsICacheEntryInfo : nsISupports |
michael@0 | 78 | { |
michael@0 | 79 | /** |
michael@0 | 80 | * Get the client id associated with this cache entry. |
michael@0 | 81 | */ |
michael@0 | 82 | readonly attribute string clientID; |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Get the id for the device that stores this cache entry. |
michael@0 | 86 | */ |
michael@0 | 87 | readonly attribute string deviceID; |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Get the key identifying the cache entry. |
michael@0 | 91 | */ |
michael@0 | 92 | readonly attribute ACString key; |
michael@0 | 93 | |
michael@0 | 94 | /** |
michael@0 | 95 | * Get the number of times the cache entry has been opened. |
michael@0 | 96 | */ |
michael@0 | 97 | readonly attribute long fetchCount; |
michael@0 | 98 | |
michael@0 | 99 | /** |
michael@0 | 100 | * Get the last time the cache entry was opened (in seconds since the Epoch). |
michael@0 | 101 | */ |
michael@0 | 102 | readonly attribute uint32_t lastFetched; |
michael@0 | 103 | |
michael@0 | 104 | /** |
michael@0 | 105 | * Get the last time the cache entry was modified (in seconds since the Epoch). |
michael@0 | 106 | */ |
michael@0 | 107 | readonly attribute uint32_t lastModified; |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Get the expiration time of the cache entry (in seconds since the Epoch). |
michael@0 | 111 | */ |
michael@0 | 112 | readonly attribute uint32_t expirationTime; |
michael@0 | 113 | |
michael@0 | 114 | /** |
michael@0 | 115 | * Get the cache entry data size. |
michael@0 | 116 | */ |
michael@0 | 117 | readonly attribute unsigned long dataSize; |
michael@0 | 118 | |
michael@0 | 119 | /** |
michael@0 | 120 | * Find out whether or not the cache entry is stream based. |
michael@0 | 121 | */ |
michael@0 | 122 | boolean isStreamBased(); |
michael@0 | 123 | }; |