2013-03-26 15:13:17 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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"
|
|
|
|
|
2015-07-04 00:36:28 +03:00
|
|
|
interface nsIPrincipal;
|
2015-11-22 12:43:55 +03:00
|
|
|
interface nsIQuotaRequest;
|
2019-03-20 20:54:08 +03:00
|
|
|
interface nsIQuotaCallback;
|
2015-11-22 12:43:55 +03:00
|
|
|
interface nsIQuotaUsageCallback;
|
|
|
|
interface nsIQuotaUsageRequest;
|
2013-03-26 15:13:17 +04:00
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
[scriptable, builtinclass, uuid(1b3d0a38-8151-4cf9-89fa-4f92c2ef0e7e)]
|
|
|
|
interface nsIQuotaManagerService : nsISupports
|
2013-03-26 15:13:17 +04:00
|
|
|
{
|
2017-03-06 20:39:21 +03:00
|
|
|
/**
|
|
|
|
* Initializes storage directory. This can be used in tests to verify
|
|
|
|
* upgrade methods.
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
init();
|
|
|
|
|
2018-10-02 17:08:43 +03:00
|
|
|
/**
|
|
|
|
* Initializes temporary storage. This can be used in tests to verify
|
|
|
|
* temporary storage initialization.
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
initTemporaryStorage();
|
|
|
|
|
2017-03-06 20:39:33 +03:00
|
|
|
/**
|
|
|
|
* Initializes storages for the given principal. This can be used in tests to
|
|
|
|
* verify origin initialization.
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*
|
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin whose storages are to be initialized.
|
|
|
|
* @param aPersistenceType
|
|
|
|
* A string that tells what persistence type of storages will be
|
|
|
|
* initialized.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
initStoragesForPrincipal(in nsIPrincipal aPrincipal,
|
|
|
|
in ACString aPersistenceType);
|
|
|
|
|
2017-03-22 14:14:04 +03:00
|
|
|
/**
|
|
|
|
* Schedules an asynchronous callback that will inspect all origins and
|
|
|
|
* return the total amount of disk space being used by storages for each
|
|
|
|
* origin separately.
|
|
|
|
*
|
|
|
|
* @param aCallback
|
|
|
|
* The callback that will be called when the usage is available.
|
|
|
|
* @param aGetAll
|
|
|
|
* An optional boolean to indicate inspection of all origins,
|
|
|
|
* including internal ones.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaUsageRequest
|
|
|
|
getUsage(in nsIQuotaUsageCallback aCallback,
|
|
|
|
[optional] in boolean aGetAll);
|
|
|
|
|
2013-03-26 15:13:17 +04:00
|
|
|
/**
|
|
|
|
* Schedules an asynchronous callback that will return the total amount of
|
|
|
|
* disk space being used by storages for the given origin.
|
|
|
|
*
|
2015-07-04 00:36:28 +03:00
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin whose usage is being queried.
|
2013-03-26 15:13:17 +04:00
|
|
|
* @param aCallback
|
|
|
|
* The callback that will be called when the usage is available.
|
2016-06-24 05:24:06 +03:00
|
|
|
* @param aGetGroupUsage
|
|
|
|
* An optional flag to indicate whether getting group usage and limit
|
|
|
|
* or origin usage and file usage. The default value is false.
|
|
|
|
* Note: Origin usage here represents total usage of an origin. However,
|
|
|
|
* group usage here represents only non-persistent usage of a group.
|
2013-03-26 15:13:17 +04:00
|
|
|
*/
|
2016-08-23 03:03:25 +03:00
|
|
|
[must_use] nsIQuotaUsageRequest
|
2015-07-04 00:36:28 +03:00
|
|
|
getUsageForPrincipal(in nsIPrincipal aPrincipal,
|
2016-06-24 05:24:06 +03:00
|
|
|
in nsIQuotaUsageCallback aCallback,
|
|
|
|
[optional] in boolean aGetGroupUsage);
|
2013-03-26 15:13:17 +04:00
|
|
|
|
2019-03-20 20:54:08 +03:00
|
|
|
/**
|
|
|
|
* Schedules an asynchronous callback that will inspect all origins and
|
|
|
|
* just returns the origin strings of initialized origins.
|
|
|
|
*
|
|
|
|
* @param aCallback
|
|
|
|
* The callback that will be called when the origin is collected.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
listInitializedOrigins(in nsIQuotaCallback aCallback);
|
|
|
|
|
2013-09-11 08:18:36 +04:00
|
|
|
/**
|
|
|
|
* Removes all storages. The files may not be deleted immediately depending
|
|
|
|
* on prohibitive concurrent operations.
|
|
|
|
* Be careful, this removes *all* the data that has ever been stored!
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*/
|
2016-08-23 03:03:25 +03:00
|
|
|
[must_use] nsIQuotaRequest
|
2013-09-11 08:18:36 +04:00
|
|
|
clear();
|
|
|
|
|
2018-11-29 23:49:52 +03:00
|
|
|
/**
|
|
|
|
* Removes all storages stored for the given pattern. The files may not be
|
|
|
|
* deleted immediately depending on prohibitive concurrent operations.
|
|
|
|
* In terms of locks, it will get an exclusive multi directory lock for given
|
|
|
|
* pattern. For example, given pattern {"appId":1007} and set of 3 origins
|
|
|
|
* ["http://www.mozilla.org^appId=1007", "http://www.example.org^appId=1007",
|
|
|
|
* "http://www.example.org^appId=1008"], the method will only lock 2 origins
|
|
|
|
* ["http://www.mozilla.org^appId=1007", "http://www.example.org^appId=1007"].
|
|
|
|
*
|
|
|
|
* @param aPattern
|
|
|
|
* A pattern for the origins whose storages are to be cleared.
|
|
|
|
* Currently this is expected to be a JSON representation of the
|
|
|
|
* OriginAttributesPatternDictionary defined in ChromeUtils.webidl.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
clearStoragesForOriginAttributesPattern(in AString aPattern);
|
|
|
|
|
2013-03-26 15:13:17 +04:00
|
|
|
/**
|
2017-03-06 20:39:25 +03:00
|
|
|
* Removes all storages stored for the given principal. The files may not be
|
2013-03-26 15:13:17 +04:00
|
|
|
* deleted immediately depending on prohibitive concurrent operations.
|
|
|
|
*
|
2015-07-04 00:36:28 +03:00
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin whose storages are to be cleared.
|
2016-08-17 09:46:16 +03:00
|
|
|
* @param aPersistenceType
|
|
|
|
* An optional string that tells what persistence type of storages
|
2018-11-29 23:47:58 +03:00
|
|
|
* will be cleared. If omitted (or void), all persistence types will
|
|
|
|
* be cleared for the principal. If a single persistence type
|
|
|
|
* ("persistent", "temporary", or "default") is provided, then only
|
|
|
|
* that persistence directory will be considered. Note that
|
|
|
|
* "persistent" is different than being "persisted" via persist() and
|
|
|
|
* is only for chrome principals. See bug 1354500 for more info.
|
|
|
|
* In general, null is the right thing to pass here.
|
|
|
|
* @param aClientType
|
|
|
|
* An optional string that tells what client type of storages
|
|
|
|
* will be cleared. If omitted (or void), all client types will be
|
|
|
|
* cleared for the principal. If a single client type is provided
|
|
|
|
* from Client.h, then only that client's storage will be cleared.
|
|
|
|
* If you want to clear multiple client types (but not all), then you
|
|
|
|
* must call this method multiple times.
|
2016-08-17 09:46:16 +03:00
|
|
|
* @param aClearAll
|
|
|
|
* An optional boolean to indicate clearing all storages under the
|
|
|
|
* given origin.
|
2013-03-26 15:13:17 +04:00
|
|
|
*/
|
2016-08-23 03:03:25 +03:00
|
|
|
[must_use] nsIQuotaRequest
|
2015-07-04 00:36:28 +03:00
|
|
|
clearStoragesForPrincipal(in nsIPrincipal aPrincipal,
|
2016-08-17 09:46:16 +03:00
|
|
|
[optional] in ACString aPersistenceType,
|
2018-11-29 23:47:58 +03:00
|
|
|
[optional] in AString aClientType,
|
2016-08-17 09:46:16 +03:00
|
|
|
[optional] in boolean aClearAll);
|
2013-09-11 08:18:36 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets quota and storage management. This can be used to force
|
|
|
|
* reinitialization of the temp storage, for example when the pref for
|
|
|
|
* overriding the temp storage limit has changed.
|
|
|
|
* Be carefull, this invalidates all live storages!
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*/
|
2016-08-23 03:03:25 +03:00
|
|
|
[must_use] nsIQuotaRequest
|
2013-09-11 08:18:36 +04:00
|
|
|
reset();
|
2016-08-25 05:19:31 +03:00
|
|
|
|
2018-11-29 23:48:11 +03:00
|
|
|
/**
|
|
|
|
* Resets all storages stored for the given principal.
|
|
|
|
*
|
|
|
|
* If the dom.quotaManager.testing preference is not true the call will be
|
|
|
|
* a no-op.
|
|
|
|
*
|
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin whose storages are to be reset.
|
|
|
|
* @param aPersistenceType
|
|
|
|
* An optional string that tells what persistence type of storages
|
|
|
|
* will be reset. If omitted (or void), all persistence types will
|
|
|
|
* be cleared for the principal. If a single persistence type
|
|
|
|
* ("persistent", "temporary", or "default") is provided, then only
|
|
|
|
* that persistence directory will be considered. Note that
|
|
|
|
* "persistent" is different than being "persisted" via persist() and
|
|
|
|
* is only for chrome principals. See bug 1354500 for more info.
|
|
|
|
* In general, null is the right thing to pass here.
|
|
|
|
* @param aClientType
|
|
|
|
* An optional string that tells what client type of storages
|
|
|
|
* will be reset. If omitted (or void), all client types will be
|
|
|
|
* cleared for the principal. If a single client type is provided
|
|
|
|
* from Client.h, then only that client's storage will be cleared.
|
|
|
|
* If you want to clear multiple client types (but not all), then you
|
|
|
|
* must call this method multiple times.
|
|
|
|
* @param aResetAll
|
|
|
|
* An optional boolean to indicate resetting all storages under the
|
|
|
|
* given origin.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
resetStoragesForPrincipal(in nsIPrincipal aPrincipal,
|
|
|
|
[optional] in ACString aPersistenceType,
|
|
|
|
[optional] in AString aClientType,
|
|
|
|
[optional] in boolean aResetAll);
|
|
|
|
|
2016-08-25 05:19:31 +03:00
|
|
|
/**
|
|
|
|
* Check if given origin is persisted.
|
|
|
|
*
|
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin which we want to check.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
persisted(in nsIPrincipal aPrincipal);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Persist given origin.
|
|
|
|
*
|
|
|
|
* @param aPrincipal
|
|
|
|
* A principal for the origin which we want to persist.
|
|
|
|
*/
|
|
|
|
[must_use] nsIQuotaRequest
|
|
|
|
persist(in nsIPrincipal aPrincipal);
|
2013-03-26 15:13:17 +04:00
|
|
|
};
|