summaryrefslogtreecommitdiffstats
path: root/toolkit/components/cleardata/nsIClearDataService.idl
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/cleardata/nsIClearDataService.idl')
-rw-r--r--toolkit/components/cleardata/nsIClearDataService.idl358
1 files changed, 358 insertions, 0 deletions
diff --git a/toolkit/components/cleardata/nsIClearDataService.idl b/toolkit/components/cleardata/nsIClearDataService.idl
new file mode 100644
index 0000000000..0dff281dbe
--- /dev/null
+++ b/toolkit/components/cleardata/nsIClearDataService.idl
@@ -0,0 +1,358 @@
+/* -*- 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 local files or other hostless schemes.
+ * @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.
+ Note that not all flags will make sense (e.g. we can't clear
+ certificates for local files). Nonsensical flags will be
+ ignored.
+ * @param aCallback this callback will be executed when the operation is
+ * completed.
+ */
+ void deleteDataFromLocalFiles(in bool aIsUserRequest,
+ in uint32_t aFlags,
+ in nsIClearDataCallback aCallback);
+
+ /**
+ * 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.
+ * @deprecated Use deleteDataFromBaseDomain instead.
+ */
+ void deleteDataFromHost(in AUTF8String aHost,
+ in bool aIsUserRequest,
+ in uint32_t aFlags,
+ in nsIClearDataCallback aCallback);
+
+ /**
+ * Delete data owned by or partitioned under a baseDomain (eTLD+1). For
+ * instance: mozilla.org. Deletes data across all origin attributes. For
+ * partitioned storage we clear both, data of the baseDomain in 1st-party and
+ * 3rd-party context.
+ * When handling user requests for clearing data using this method is
+ * preferred over deleteDataFromPrincipal, since origins may share information
+ * with their site (e.g. cookies) that are not deleted by principal.
+ * @param aDomainOrHost the domain or host to be used. Will be converted to
+ * baseDomain if needed.
+ * @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.
+ * @throws Throws if base domain can't be computed from aDomainOrHost. Callers
+ * may fall back to clearing by principal or host.
+ */
+ void deleteDataFromBaseDomain(in AUTF8String aDomainOrHost,
+ 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.
+ * @param aCallback the optional callback will be executed when the operation
+ * is completed.
+ */
+ void deleteDataFromOriginAttributesPattern(in jsval aOriginAttributesPattern,
+ [optional] in nsIClearDataCallback aCallback);
+
+ /**
+ * This is a helper function to clear storageAccessAPI permissions
+ * in a way that will not result in users getting logged out by
+ * cookie purging. To that end we only clear permissions for principals
+ * whose base domain does not have any storage associated with it.
+ *
+ * The principals to be considered will need to be passed by the API consumer.
+ * It is recommended to use PrincipalsCollector.jsm for that.
+ *
+ * @param aPrincipalsWithStorage principals to be excluded from clearing
+ * @param aFrom microseconds from the epoch
+ * @param aCallback the optional callback will be executed when the operation
+ * is completed.
+ */
+ void deleteUserInteractionForClearingHistory(in Array<nsIPrincipal> aPrincipalsWithStorage,
+ [optional] in PRTime aFrom,
+ [optional] in nsIClearDataCallback aCallback);
+
+ /**
+ * Some cleaners, namely QuotaCleaner, can opt in and treat things as deleted
+ * without actually removing files at shutdown. This function will trigger
+ * actual removal of them.
+ */
+ void cleanupAfterDeletionAtShutdown(in uint32_t aFlags, in nsIClearDataCallback aCallback);
+
+ /**************************************************************************
+ * 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;
+
+ /**
+ * 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;
+
+ /**
+ * LocalStorage, IndexedDB, ServiceWorkers, DOM Cache and so on.
+ */
+ const uint32_t CLEAR_DOM_QUOTA = 1 << 7;
+
+ /**
+ * Predictor network data
+ */
+ const uint32_t CLEAR_PREDICTOR_NETWORK_DATA = 1 << 8;
+
+ /**
+ * DOM Push notifications
+ */
+ const uint32_t CLEAR_DOM_PUSH_NOTIFICATIONS = 1 << 9;
+
+ /**
+ * Places history
+ */
+ const uint32_t CLEAR_HISTORY = 1 << 10;
+
+ /**
+ * Session history
+ */
+ const uint32_t CLEAR_SESSION_HISTORY = 1 << 11;
+
+ /**
+ * Auth tokens
+ */
+ const uint32_t CLEAR_AUTH_TOKENS = 1 << 12;
+
+ /**
+ * Login cache
+ */
+ const uint32_t CLEAR_AUTH_CACHE = 1 << 13;
+
+ /**
+ * Site permissions
+ */
+ const uint32_t CLEAR_PERMISSIONS = 1 << 14;
+
+ /**
+ * Site preferences
+ */
+ const uint32_t CLEAR_CONTENT_PREFERENCES = 1 << 15;
+
+ /**
+ * Clear HSTS data
+ */
+ const uint32_t CLEAR_HSTS = 1 << 16;
+
+ /**
+ * Media plugin data
+ */
+ const uint32_t CLEAR_EME = 1 << 17;
+
+ /**
+ * Reporting API reports.
+ */
+ const uint32_t CLEAR_REPORTS = 1 << 18;
+
+ /**
+ * StorageAccessAPI flag, which indicates user interaction.
+ */
+ const uint32_t CLEAR_STORAGE_ACCESS = 1 << 19;
+
+ /**
+ * Clear Cert Exceptions.
+ */
+ const uint32_t CLEAR_CERT_EXCEPTIONS = 1 << 20;
+
+ /**
+ * Clear entries in the content blocking database.
+ */
+ const uint32_t CLEAR_CONTENT_BLOCKING_RECORDS = 1 << 21;
+
+ /**
+ * Clear the in-memory CSS cache.
+ */
+ const uint32_t CLEAR_CSS_CACHE = 1 << 22;
+
+ /**
+ * Clear the CORS preflight cache.
+ */
+ const uint32_t CLEAR_PREFLIGHT_CACHE = 1 << 23;
+
+ /**
+ * Forget descision about clients authentification certificate
+ */
+ const uint32_t CLEAR_CLIENT_AUTH_REMEMBER_SERVICE = 1 << 24;
+
+ /**
+ * Clear state associated with FedCM
+ */
+ const uint32_t CLEAR_CREDENTIAL_MANAGER_STATE = 1 << 24;
+
+ /**
+ * Clear the per-site exception for cookie banner handling.
+ */
+ const uint32_t CLEAR_COOKIE_BANNER_EXCEPTION = 1 << 25;
+
+ /**
+ * Clear the site executed record for cookie banner handling.
+ */
+ const uint32_t CLEAR_COOKIE_BANNER_EXECUTED_RECORD = 1 << 26;
+
+ /**
+ * Clear state associated with the fingerprinting protection.
+ */
+ const uint32_t CLEAR_FINGERPRINTING_PROTECTION_STATE = 1 << 27;
+
+ /**
+ * Clear the bounce tracking protection state.
+ */
+ const uint32_t CLEAR_BOUNCE_TRACKING_PROTECTION_STATE = 1 << 28;
+
+ /**
+ * Use this value to delete all the data.
+ */
+ const uint32_t CLEAR_ALL = 0xFFFFFFFF;
+
+ /**************************************************************************
+ * 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 |
+ CLEAR_CSS_CACHE | CLEAR_PREFLIGHT_CACHE | CLEAR_HSTS;
+
+ /**
+ * Delete all DOM storages
+ */
+ const uint32_t CLEAR_DOM_STORAGES = 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_ALL_CACHES |
+ CLEAR_COOKIES | CLEAR_EME | CLEAR_DOWNLOADS |
+ CLEAR_PERMISSIONS | CLEAR_DOM_STORAGES | CLEAR_CONTENT_PREFERENCES |
+ CLEAR_PREDICTOR_NETWORK_DATA | CLEAR_DOM_PUSH_NOTIFICATIONS |
+ CLEAR_CLIENT_AUTH_REMEMBER_SERVICE | CLEAR_REPORTS | CLEAR_CERT_EXCEPTIONS |
+ CLEAR_CREDENTIAL_MANAGER_STATE | CLEAR_COOKIE_BANNER_EXCEPTION |
+ CLEAR_COOKIE_BANNER_EXECUTED_RECORD | CLEAR_FINGERPRINTING_PROTECTION_STATE |
+ CLEAR_BOUNCE_TRACKING_PROTECTION_STATE;
+};
+
+/**
+ * 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);
+};