tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsICacheStorageService.idl (4800B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #include "nsISupports.idl"
      6 
      7 interface nsICacheStorage;
      8 interface nsILoadContextInfo;
      9 interface nsIEventTarget;
     10 interface nsICacheStorageConsumptionObserver;
     11 interface nsICacheStorageVisitor;
     12 interface nsIPrincipal;
     13 interface nsIURI;
     14 
     15 /**
     16 * Provides access to particual cache storages of the network URI cache.
     17 */
     18 [scriptable, uuid(ae29c44b-fbc3-4552-afaf-0a157ce771e7)]
     19 interface nsICacheStorageService : nsISupports
     20 {
     21  /**
     22   * Get storage where entries will only remain in memory, never written
     23   * to the disk.
     24   *
     25   * NOTE: Any existing disk entry for [URL|id-extension] will be doomed
     26   * prior opening an entry using this memory-only storage.  Result of
     27   * AsyncOpenURI will be a new and empty memory-only entry.  Using
     28   * OPEN_READONLY open flag has no effect on this behavior.
     29   *
     30   * @param aLoadContextInfo
     31   *    Information about the loading context, this focuses the storage JAR and
     32   *    respects separate storage for private browsing.
     33   */
     34  nsICacheStorage memoryCacheStorage(in nsILoadContextInfo aLoadContextInfo);
     35 
     36  /**
     37   * Get storage where entries will be written to disk when not forbidden by
     38   * response headers.
     39   */
     40  nsICacheStorage diskCacheStorage(in nsILoadContextInfo aLoadContextInfo);
     41 
     42  /**
     43   * Get storage where entries will be written to disk and marked as pinned.
     44   * These pinned entries are immune to over limit eviction and call of clear()
     45   * on this service.
     46   */
     47  nsICacheStorage pinningCacheStorage(in nsILoadContextInfo aLoadContextInfo);
     48 
     49  /**
     50   * Evict any cache entry having the same principal origin and OriginAttributes
     51   *
     52   * @param aPrincipal
     53   *   The principal to compare the entries with.
     54   */
     55  void clearOriginsByPrincipal(in nsIPrincipal aPrincipal);
     56 
     57  /**
     58   * Evict any cache entry which belongs to a base domain. This includes entries
     59   * partitioned under aBaseDomain and entries which belong to aBaseDomain, but
     60   * are partitioned under other top level sites.
     61   * @param aBaseDomain
     62   *   The base domain to clear cache for.
     63   */
     64  void clearBaseDomain(in AString aBaseDomain);
     65 
     66  /**
     67   * Evict any cache entry having the same originAttributes.
     68   *
     69   * @param aOriginAttributes
     70   *   The origin attributes in string format to compare the entries with.
     71   */
     72  void clearOriginsByOriginAttributes(in AString aOriginAttributes);
     73 
     74  /**
     75   * Evict the whole cache.
     76   */
     77  void clear();
     78 
     79  /**
     80   * Evict any Dictionary cache entry by site
     81   *
     82   * @param aURI
     83   *   The URI to compare the dictionary entries with.
     84   */
     85  void clearOriginDictionary(in nsIURI aURI);
     86 
     87  /**
     88   * Evict all Dictionary cache entries
     89   */
     90  void clearAllOriginDictionaries();
     91 
     92  /**
     93   * Purge only data of disk backed entries.  Metadata are left for
     94   * performance purposes.
     95   */
     96  const uint32_t PURGE_DISK_DATA_ONLY = 1;
     97  /**
     98   * Purge whole disk backed entries from memory.  Disk files will
     99   * be left unattended.
    100   */
    101  const uint32_t PURGE_DISK_ALL = 2;
    102  /**
    103   * Purge all entries we keep in memory, including memory-storage
    104   * entries.  This may be dangerous to use.
    105   */
    106  const uint32_t PURGE_EVERYTHING = 3;
    107  /**
    108   * Purges data we keep warmed in memory.  Use for tests and for
    109   * saving memory.
    110   */
    111  void purgeFromMemory(in uint32_t aWhat);
    112 
    113  /**
    114   * I/O thread target to use for any operations on disk
    115   */
    116  readonly attribute nsIEventTarget ioTarget;
    117 
    118  /**
    119   * Asynchronously determine how many bytes of the disk space the cache takes.
    120   * @see nsICacheStorageConsumptionObserver
    121   * @param aObserver
    122   *    A mandatory (weak referred) observer.  Documented at
    123   *    nsICacheStorageConsumptionObserver.
    124   *    NOTE: the observer MUST implement nsISupportsWeakReference.
    125   */
    126  void asyncGetDiskConsumption(in nsICacheStorageConsumptionObserver aObserver);
    127 
    128  /**
    129   * Asynchronously visits all storages of the disk cache and memory cache.
    130   * @see nsICacheStorageVisitor
    131   * @param aVisitor
    132   *   A visitor callback.
    133   * @param aVisitEntries
    134   *   A boolean indicates whether visits entries.
    135   */
    136  void asyncVisitAllStorages(in nsICacheStorageVisitor aVisitor,
    137                             in boolean aVisitEntries);
    138 };
    139 
    140 [scriptable, uuid(7728ab5b-4c01-4483-a606-32bf5b8136cb)]
    141 interface nsICacheStorageConsumptionObserver : nsISupports
    142 {
    143  /**
    144   * Callback invoked to answer asyncGetDiskConsumption call. Always triggered
    145   * on the main thread.
    146   * NOTE: implementers must also implement nsISupportsWeakReference.
    147   *
    148   * @param aDiskSize
    149   *    The disk consumption in bytes.
    150   */
    151  void onNetworkCacheDiskConsumption(in int64_t aDiskSize);
    152 };