DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b6d82b1a6b02)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIPrincipal;
interface nsIClearDataCallback;

/**
 * nsIClearDataService
 *
 * Provides methods for cleaning data from a nsIPrincipal and/or from a time
 * range.
 */
[scriptable, uuid(6ef3ef16-a502-4576-9fb4-919f1c40bf61)]
interface nsIClearDataService : nsISupports
{
  /**
   * Delete data owned by a host. For instance: mozilla.org. Data from any
   * possible originAttributes will be deleted.
   * @param aHost the host to be used.
   * @param aIsUserRequest true if this request comes from a user interaction.
   *        This information is important because if true, it's probably better
   *        to remove more than less, for privacy reason. If false (e.g.
   *        Clear-Site-Data header), we don't want to delete more than what is
   *        strictly required.
   * @param aFlags List of flags. See below the accepted values.
   * @param aCallback this callback will be executed when the operation is
   *                  completed.
   */
  void deleteDataFromHost(in AUTF8String aHost,
                          in bool aIsUserRequest,
                          in uint32_t aFlags,
                          in nsIClearDataCallback aCallback);

  /**
   * Delete data owned by a principal.
   * @param aPrincipal the nsIPrincipal to be used.
   * @param aIsUserRequest true if this request comes from a user interaction.
   *        This information is important because if true, it's probably better
   *        to remove more than less, for privacy reason. If false (e.g.
   *        Clear-Site-Data header), we don't want to delete more than what is
   *        strictly required.
   * @param aFlags List of flags. See below the accepted values.
   * @param aCallback ths callback will be executed when the operation is
   *                  completed.
   */
  void deleteDataFromPrincipal(in nsIPrincipal aPrincipal,
                               in bool aIsUserRequest,
                               in uint32_t aFlags,
                               in nsIClearDataCallback aCallback);

  /**
   * Delete all data in a time range. Limit excluded.
   * @param aFrom microseconds from the epoch
   * @param aTo microseconds from the epoch
   * @param aIsUserRequest true if this request comes from a user interaction.
   *        This information is important because if true, it's probably better
   *        to remove more than less, for privacy reason. If false (e.g.
   *        Clear-Site-Data header), we don't want to delete more than what is
   *        strictly required.
   * @param aFlags List of flags. See below the accepted values.
   * @param aCallback ths callback will be executed when the operation is
   *                  completed.
   */
  void deleteDataInTimeRange(in PRTime aFrom, in PRTime aTo,
                             in bool aIsUserRequest,
                             in uint32_t aFlags,
                             in nsIClearDataCallback aCallback);

  /**
   * Delete all data from any host, in any time range.
   * @param aFlags List of flags. See below the accepted values.
   * @param aCallback ths callback will be executed when the operation is
   *                  completed.
   */
  void deleteData(in uint32_t aFlags,
                  in nsIClearDataCallback aCallback);

  /**
   * Delete all data from an OriginAttributesPatternDictionary.
   * @param aOriginAttributesPattern the originAttributes dictionary.
   */
  void deleteDataFromOriginAttributesPattern(in jsval aOriginAttributesPattern);

  /**************************************************************************
   * Listed below are the various flags which may be or'd together.
   */

  /**
   * Delete cookies.
   */
  const uint32_t CLEAR_COOKIES = 1 << 0;

  /**
   * Network Cache.
   */
  const uint32_t CLEAR_NETWORK_CACHE = 1 << 1;

  /**
   * Image cache.
   */
  const uint32_t CLEAR_IMAGE_CACHE = 1 << 2;

  /**
   * Data stored by external plugins.
   */
  const uint32_t CLEAR_PLUGIN_DATA = 1 << 3;

  /**
   * Completed downloads.
   */
  const uint32_t CLEAR_DOWNLOADS = 1 << 4;

  /**
   * Stored passwords.
   */
  const uint32_t CLEAR_PASSWORDS = 1 << 5;

  /**
   * Media devices.
   */
  const uint32_t CLEAR_MEDIA_DEVICES = 1 << 6;

  /**
   * AppCache.
   */
  const uint32_t CLEAR_APPCACHE = 1 << 7;

  /**
   * LocalStorage, IndexedDB, ServiceWorkers, DOM Cache and so on.
   */
  const uint32_t CLEAR_DOM_QUOTA = 1 << 8;

  /**
   * Predictor network data
   */
  const uint32_t CLEAR_PREDICTOR_NETWORK_DATA = 1 << 9;

  /**
   * DOM Push notifications
   */
  const uint32_t CLEAR_DOM_PUSH_NOTIFICATIONS = 1 << 10;

  /**
   * Places history
   */
  const uint32_t CLEAR_HISTORY = 1 << 11;

  /**
   * Session history
   */
  const uint32_t CLEAR_SESSION_HISTORY = 1 << 12;

  /**
   * Auth tokens
   */
  const uint32_t CLEAR_AUTH_TOKENS = 1 << 13;

  /**
   * Login cache
   */
  const uint32_t CLEAR_AUTH_CACHE = 1 << 14;

  /**
   * Site permissions
   */
  const uint32_t CLEAR_PERMISSIONS = 1 << 15;

  /**
   * Site preferences
   */
  const uint32_t CLEAR_CONTENT_PREFERENCES = 1 << 16;

  /**
   * Secure site settings
   */
  const uint32_t CLEAR_SECURITY_SETTINGS = 1 << 17;

  /**
   * Media plugin data
   */
  const uint32_t CLEAR_EME = 1 << 18;

  /**
   * Reporting API reports.
   */
  const uint32_t CLEAR_REPORTS = 1 << 19;

  /**
   * StorageAccessAPI flag, which indicates user interaction.
   */
  const uint32_t CLEAR_STORAGE_ACCESS = 1 << 20;

  /**
   * Clear Cert Exceptions.
   */
  const uint32_t CLEAR_CERT_EXCEPTIONS = 1 << 21;

  /**
   * Clear entries in the content blocking database.
   */
  const uint32_t CLEAR_CONTENT_BLOCKING_RECORDS = 1 << 22;

  /**
   * Use this value to delete all the data.
   */
  const uint32_t CLEAR_ALL = 0xFFFFFF;

  /**************************************************************************
   * The following flags are helpers: they combine some of the previous flags
   * in a more convenient way.
   */

  /**
   * Delete all the possible caches.
   */
  const uint32_t CLEAR_ALL_CACHES = CLEAR_NETWORK_CACHE | CLEAR_IMAGE_CACHE;

  /**
   * Delete all DOM storages
   */
  const uint32_t CLEAR_DOM_STORAGES = CLEAR_APPCACHE | CLEAR_DOM_QUOTA |
    CLEAR_DOM_PUSH_NOTIFICATIONS | CLEAR_REPORTS;

  /**
   * Helper flag for forget about site
   */
  const uint32_t CLEAR_FORGET_ABOUT_SITE =
    CLEAR_HISTORY | CLEAR_SESSION_HISTORY | CLEAR_NETWORK_CACHE | CLEAR_IMAGE_CACHE |
    CLEAR_COOKIES | CLEAR_EME | CLEAR_PLUGIN_DATA | CLEAR_DOWNLOADS | CLEAR_PASSWORDS |
    CLEAR_PERMISSIONS | CLEAR_DOM_STORAGES | CLEAR_CONTENT_PREFERENCES |
    CLEAR_PREDICTOR_NETWORK_DATA | CLEAR_DOM_PUSH_NOTIFICATIONS |
    CLEAR_SECURITY_SETTINGS | CLEAR_REPORTS | CLEAR_CERT_EXCEPTIONS;
};

/**
 * This is a companion interface for
 * nsIClearDataService::deleteDataFromPrincipal().
 */
[function, scriptable, uuid(e225517b-24c5-498a-b9fb-9993e341a398)]
interface nsIClearDataCallback : nsISupports
{
  /**
   * Called to indicate that the data cleaning is completed.
   * @param aFailedFlags this value contains the flags that failed during the
   *                     cleanup. If nothing failed, aFailedFlags will be 0.
   */
  void onDataDeleted(in uint32_t aFailedFlags);
};