Name Description Size Coverage
ActorsChild.cpp QuotaChild **************************************************************************** 5528 94 %
ActorsChild.h 2529 71 %
ActorsParent.cpp 348848 94 %
ActorsParent.h 546 -
ArtificialFailure.cpp 1079 94 %
ArtificialFailure.h Checks if an artificial failure should be triggered based on the specified category and the configured probability. This method evaluates if the provided failure category matches the categories set in the preferences. If a match is found, it then checks the probability of triggering an artificial failure. A random value is generated to determine if the failure should occur based on this probability. If both the category matches and the random value falls within the defined probability, the method returns an error code indicating the artificial failure. Otherwise, it returns a successful result. @param aCategory - The failure category to check against the configured categories for triggering an artificial failure. It must have only one bit set. @returns Result<Ok, nsresult> - An Ok result if no failure occurs; an Err result containing an error code if an artificial failure is triggered. Note: Consider replacing the preferences with a dedicated class with static methods for entering and leaving artificial failure mode, something like `ChaosMode`. The class would also implement an interface, for example `nsIQuotaArtificialFailure` allowing access from scripts. Example usage: This example demonstrates the usage of `ArtificialFailure` in conjunction with the `QM_TRY` macro to handle potential artificial failures gracefully. The `QM_TRY` macro will return early if an artificial failure occurs, with the corresponding error code from `ArtificialFailure`. ```cpp QM_TRY(ArtificialFailure( nsIQuotaArtificialFailure::CATEGORY_INITIALIZE_ORIGIN)); ``` 2371 -
Assertions.cpp 1089 100 %
Assertions.h 673 -
AssertionsImpl.h 1292 100 %
BackgroundThreadObject.cpp 1051 100 %
BackgroundThreadObject.h 810 100 %
CachingDatabaseConnection.cpp 5736 100 %
CachingDatabaseConnection.h 7335 100 %
CanonicalQuotaObject.cpp aTruncate 6161 87 %
CanonicalQuotaObject.h aIsRemote 2298 100 %
CheckedUnsafePtr.h 20161 54 %
CipherKeyManager.h 3074 100 %
CipherStrategy.h 1305 -
Client.cpp 6562 82 %
Client.h 5451 100 %
ClientDirectoryLock.cpp 2305 39 %
ClientDirectoryLock.h 2161 100 %
ClientDirectoryLockHandle.cpp 4205 100 %
ClientDirectoryLockHandle.h @class ClientDirectoryLockHandle @brief RAII-style wrapper for managing a ClientDirectoryLock. ClientDirectoryLockHandle is a RAII-style wrapper that manages a ClientDirectoryLock created by QuotaManager::OpenClientDirectory. This class ensures that the associated directory lock remains acquired while the handle is in scope and automatically drops it when destroyed. ## Usage: - See QuotaManager::OpenClientDirectory for details on obtaining a ClientDirectoryLockHandle. - The handle should be retained for as long as access to the directory is needed. ## Threading: - Must be used only on the thread that created it, except that it may be safely destroyed from another thread after being moved (see also Destruction). - `AssertIsOnOwningThread()` is primarily used internally to verify correct threading, but clients can use it for additional thread-safety checks if needed. ## Destruction: - If the lock has already been dropped (e.g., due to move), the destructor does nothing. - The destructor automatically drops the lock if it is still held. - Thus, it is safe to destroy a handle from any thread as long as the handle was moved beforehand on the owning thread. ## Key Features: - Move-only: Prevents accidental copies. - Implicit boolean conversion to check if the handle holds a valid `ClientDirectoryLock`. - Easy access to the underlying ClientDirectoryLock using `operator*` and `operator->`. - Moved-from handles are placed in a well-defined inert state and can be safely inspected using `IsInert()` for diagnostic purposes. 4127 -
ClientImpl.h 967 100 %
ClientStorageScope.h Represents a scope within an origin directory, currently covering either a specific client (`Client`), metadata (`Metadata`), or a match-all scope (`Null`). The use of "Storage" in the class name is intentional. Unlike `PersistenceScope` and `OriginScope`, which match only specific directories, this scope is meant to cover all entries within an origin directory. That includes client specific folders (e.g., idb/, fs/) and, in the future, files like metadata that exist alongside them. The special `Metadata` scope exists because adding the metadata type to client types would complicate other aspects of the system. A special client implementation just for working with the metadata file would be overkill. However, we need a way to lock just the metadata file. Since metadata files reside alongside client directories under the same origin directory, it makes sense to include them in the `ClientStorageScope`. This class provides operations to check the current scope type (`Client`, `Metadata`, or `Null`), set the scope type, retrieve a client type, and match it with another scope. 4845 100 %
ClientUsageArray.cpp 1480 100 %
ClientUsageArray.h 1131 60 %
CommonMetadata.h 7824 100 %
CommonMetadataArray.h 456 -
CommonMetadataArrayFwd.h 543 -
components.conf 1034 -
ConditionalCompilation.h Macros for conditional compilation based on build configuration. These macros are primarily used to inline debug or configuration specific declarations or expressions in a single line without needing explicit #ifdef blocks. This improves readability and avoids code clutter. Current macros include: - DEBUGONLY(expr) - DIAGNOSTICONLY(expr) This header may also include future macros such as: - NIGHTLYONLY(expr) - IF_NIGHTLY(expr) All macros in this file are designed for compile time control over code inclusion and should not introduce runtime behavior. 1237 -
Config.h 926 -
Constants.h 3396 -
Date.h A lightweight utility class representing a date as the number of days since the Unix epoch (1970-01-01 UTC). This class is useful when full timestamp precision is not needed and only a compact representation is required, such as when storing the value in an int32_t field. An int32_t can safely represent dates out to the year ~5.8 million, making this format ideal for tracking coarse-grained time values like origin maintenance dates, and similar use cases. Internally, the date is derived from PR_Now(), which returns microseconds since the epoch. This ensures consistency with other quota-related timestamp logic, such as origin last access time. 2159 100 %
DecryptingInputStream.cpp 3451 92 %
DecryptingInputStream.h 6238 100 %
DecryptingInputStream_impl.h aCheckAvailableBytes 17215 88 %
DirectoryLock.h 982 -
DirectoryLockCategory.h 2267 -
DirectoryLockImpl.cpp Automatically log information about a directory lock if acquiring of the directory lock takes this long. We've chosen a value that is long enough that it is unlikely for the problem to be falsely triggered by slow system I/O. We've also chosen a value long enough so that testers can notice the timeout; we want to know about the timeouts, not hide them. On the other hand this value is less than 45 seconds which is used by quota manager to crash a hung quota manager shutdown. 14388 75 %
DirectoryLockImpl.h 8229 90 %
DirectoryLockInlines.h 1623 100 %
DirectoryMetadata.cpp 4029 100 %
DirectoryMetadata.h Directory Metadata File Format (.metadata-v2) The metadata file is a binary file containing metadata information for an origin directory. It consists of a header and several additional fields, some of which are maintained only for backward compatibility. Header (OriginStateMetadata): - int64_t mLastAccessTime The last access time of the origin in microseconds since the epoch. - bool mPersisted True if the origin is marked as persisted and should survive origin eviction. - uint32_t flags A bitfield of DirectoryMetadataFlags used to store boolean state flags. This field currently maps only to mAccessed. The defined flags are: - Initialized: Always set when writing metadata; indicates that this field contains valid flag bits. Older files written before this flag was introduced will have this field set to zero. - Accessed: Indicates whether the origin has been accessed by a quota client. This maps directly to the mAccessed field in memory. If the Initialized flag is not set, the flags field is considered invalid and mAccessed is conservatively set to true to ensure a full initialization scan. - int32_t mLastMaintenanceDate The last maintenance date of the origin in days since the epoch. Legacy fields (still written and read for backward compatibility, but no longer used): - nsCString mSuffix Originally used for origin attributes. Still written to preserve compatibility. - nsCString mGroup Originally used for quota group. Still written to preserve compatibility. Storage fields: - nsCString mStorageOrigin Storage origin string (actively used for reconstructing the principal). Legacy fields (continued): - bool mIsPrivate Flag originally used for private browsing contexts or apps. Still written. Validation check: - After reading all expected fields, any additional data (even a single 32-bit value) is treated as an error. Notes: - OriginStateMetadata is loaded first and interpreted independently. This allows fast and safe updates to the metadata header on disk without rewriting the full file. - The header is intentionally designed to contain only fixed-size fields. This allows updating the header in-place without creating a temporary file. 3517 -
DummyCipherStrategy.h 1607 86 %
EncryptedBlock.h 3472 100 %
EncryptingOutputStream.cpp 1855 75 %
EncryptingOutputStream.h 3730 100 %
EncryptingOutputStream_impl.h 8442 83 %
ErrorHandling.h 1408 0 %
FileStreams.cpp aTruncate 6744 100 %
FileStreams.h 6044 97 %
FileUtils.cpp 1287 100 %
FileUtils.h 594 -
FirstInitializationAttempts.h 2332 100 %
FirstInitializationAttemptsImpl.h 1256 100 %
Flatten.h 3329 100 %
ForwardDecls.h 3744 -
gecko-trace.yaml 490 -
GroupInfo.cpp 2584 100 %
GroupInfo.h 1871 100 %
GroupInfoPair.cpp 807 67 %
GroupInfoPair.h 3047 100 %
GroupInfoPairImpl.h 1685 92 %
HashKeys.h 687 100 %
InitializationTypes.cpp 2385 77 %
InitializationTypes.h 3310 100 %
IPCQuotaObject.ipdlh 441 -
IPCStreamCipherStrategy.h 454 -
metrics.yaml 10923 -
moz.build 4801 -
MozPromiseUtils.h 3667 94 %
NormalOriginOperationBase.cpp 970 100 %
NormalOriginOperationBase.h 1681 67 %
NotifyUtils.cpp 1906 97 %
NotifyUtils.h 767 -
NotifyUtilsCommon.cpp 1303 100 %
NotifyUtilsCommon.h 617 -
nsIndexedDBProtocolHandler.cpp 1182 0 %
nsIndexedDBProtocolHandler.h 700 -
nsIQuotaArtificialFailure.idl 534 -
nsIQuotaCallbacks.idl 630 -
nsIQuotaManagerService.idl Asynchronously retrieves storage name and returns it as a plain string. If the dom.quotaManager.testing preference is not true the call will be a no-op. 18874 -
nsIQuotaManagerServiceInternal.idl This interface defines internal methods for use within Quota Manager code. It is intended strictly for internal implementation details and should not be used outside of Quota Manager internal code. 1393 -
nsIQuotaRequests.idl 1289 -
nsIQuotaResults.idl 2118 -
nsIQuotaUtilsService.idl This interface provides utility methods for storage and quota management that require information only available in JavaScript system modules. It serves as a bridge for accessing such information from C++ code where direct access is not feasible. 890 -
NSSCipherStrategy.cpp 4777 90 %
NSSCipherStrategy.h 1701 -
OpenClientDirectoryInfo.cpp 2415 100 %
OpenClientDirectoryInfo.h @class OpenClientDirectoryInfo @brief Tracks the first and last access to an origin directory. OpenClientDirectoryInfo is a lightweight internal helper used to track access to a specific origin directory after a call to QuotaManager::OpenClientDirectory. It keeps a count of active ClientDirectoryLockHandle instances associated with the origin directory and allows the QuotaManager to update the directory’s access time when the first handle is created and when the last one is released. Although this class is currently focused on tracking origin-level access, it may be extended in the future to track finer-grained access to individual client directories as well. The name reflects its connection to the broader OpenClientDirectory mechanism, which is central to how quota clients initiate access to their storage. ## Usage: - Created by QuotaManager::RegisterClientDirectoryLockHandle. - Removed by QuotaManager::UnregisterClientDirectoryLockHandle. ## Lifetime: - Exists only while at least one ClientDirectoryLockHandle is active for the origin directory. ## Threading: - Must be used only on the thread that created it. - `AssertIsOnOwningThread()` can be used to verify correct usage. 2881 -
OpenClientDirectoryUtils.h aExclusive 5960 100 %
OriginDirectoryLock.cpp aExclusive 1457 100 %
OriginDirectoryLock.h 1671 100 %
OriginInfo.cpp 11698 98 %
OriginInfo.h In some special cases like the LocalStorage client where it's possible to create a Quota-using representation but not actually write any data, we want to be able to track quota for an origin without creating its origin directory or the per-client files until they are actually needed to store data. In those cases, the OriginInfo will be created by InitQuotaForOrigin and the resulting mDirectoryExists will be false until the origin actually needs to be created. It is possible for mUsage to be greater than zero while mDirectoryExists is false, representing a state where a client like LocalStorage has reserved quota for disk writes, but has not yet flushed the data to disk. 5166 78 %
OriginOperationBase.cpp 4832 98 %
OriginOperationBase.h 1921 0 %
OriginOperationCallbacks.h 2085 64 %
OriginOperations.cpp 128753 95 %
OriginOperations.h 7741 -
OriginParser.cpp 12281 87 %
OriginParser.h Checks whether the given origin attributes suffix corresponds to a specific user context, based on the provided `userContextId` value. This function parses the input suffix into an `OriginAttributes` object and evaluates the `userContextId` attribute. If the attribute matches the given `aUserContextId`, the suffix is considered to belong to that user context. Other attributes in the suffix are ignored. @param aSuffix The origin attributes suffix to check. This must be a valid suffix; otherwise, the code will trigger an assertion failure. @param aUserContextId The `userContextId` value to compare against the attribute in the suffix. @return `true` if the `userContextId` attribute matches `aUserContextId`, `false` otherwise. @note The input must be a valid suffix. Invalid inputs will cause a diagnostic assertion failure because of `MOZ_ALWAYS_TRUE`. 4914 100 %
OriginScope.h 11447 95 %
PersistenceScope.cpp 841 100 %
PersistenceScope.h 4344 94 %
PersistenceType.cpp 7281 85 %
PersistenceType.h 2553 -
PQuota.ipdl 6111 -
PQuotaRequest.ipdl 1091 -
PQuotaUsageRequest.ipdl 459 -
PRemoteQuotaObject.ipdl 730 -
PrincipalUtils.cpp 9185 70 %
PrincipalUtils.h 1613 -
PromiseUtils.cpp 1009 86 %
PromiseUtils.h 569 -
QMResult.cpp 549 100 %
QMResult.h Propagate the result. This is used by GenericErrorResult<QMResult> to create a propagated result. 1501 100 %
QuotaCommon.cpp aStart 22589 84 %
QuotaCommon.h 70688 92 %
QuotaManager.h Ensures that all pending normal origin operations and their follow-up events are processed and completed. This is useful in cases where operations are scheduled asynchronously without a way to explicitly await their completion, and must be finalized before continuing with further checks or logic. This method asserts that gtests are currently running and must not be used outside of gtest code. 44751 99 %
QuotaManagerImpl.h 1716 100 %
QuotaManagerService.cpp aIID 52115 89 %
QuotaManagerService.h mozilla_dom_quota_QuotaManagerService_h 2572 0 %
QuotaObject.cpp 2386 100 %
QuotaObject.h 2426 100 %
QuotaParent.cpp 38447 83 %
QuotaParent.h 6680 67 %
QuotaPrefs.cpp 1449 92 %
QuotaPrefs.h The QuotaPrefs class provides static helper methods for evaluating preferences with non-trivial logic. 696 -
QuotaRequestBase.cpp 1027 83 %
QuotaRequestBase.h 1424 92 %
QuotaRequests.cpp 6230 83 %
QuotaRequests.h 2603 100 %
QuotaResults.cpp 5383 88 %
QuotaResults.h 1823 100 %
QuotaUsageRequestChild.cpp 1269 100 %
QuotaUsageRequestChild.h 1244 75 %
QuotaUsageRequestParent.cpp 1032 100 %
QuotaUsageRequestParent.h 1090 100 %
QuotaUtilsService.sys.mjs 827 100 %
RemoteQuotaObject.cpp aIsRemote 1502 90 %
RemoteQuotaObject.h 1264 20 %
RemoteQuotaObjectChild.cpp 881 100 %
RemoteQuotaObjectChild.h 963 100 %
RemoteQuotaObjectParent.cpp aTruncate 1874 100 %
RemoteQuotaObjectParent.h 1242 100 %
RemoteQuotaObjectParentTracker.h 1104 100 %
RemoveParen.h 779 -
ResolvableNormalOriginOp.h 1809 100 %
ResultExtensions.h 4891 91 %
SanitizationUtils.cpp 1006 100 %
SanitizationUtils.h 561 -
ScopedLogExtraInfo.cpp static 2544 98 %
ScopedLogExtraInfo.h 2322 100 %
scripts -
SerializationHelpers.h 7473 97 %
StorageHelpers.cpp 1894 100 %
StorageHelpers.h This class provides a RAII wrap of attaching and detaching database in a given C++ scope. It is guaranteed that an attached database will be detached even if you have an exception or return early. @param aConnection The connection to attach a database to. @param aDatabaseFile The database file to attach. @param aSchemaName The schema-name. Can be any string literal which is supported by the underlying database. For more details about schema-name, see https://www.sqlite.org/lang_attach.html 1658 -
StorageManager.cpp PersistentStoragePermissionRequest **************************************************************************** 21815 90 %
StorageManager.h 1616 100 %
StorageOriginAttributes.cpp 2648 96 %
StorageOriginAttributes.h 1889 100 %
StreamUtils.cpp 2719 94 %
StreamUtils.h 1088 -
StringifyUtils.cpp static 1591 100 %
StringifyUtils.h 1724 -
TargetPtrHolder.h 1374 100 %
test 92 %
ThreadUtils.cpp aThread 2426 87 %
ThreadUtils.h Add a temporary thread observer and listen for the "AfterProcessNextEvent" notification. Once the notification is received, remove the temporary thread observer and call aCallback. In practice, this calls aCallback immediately after the current thread is done with running and releasing recently popped event from thread's event queue. If called multiple times, all the callbacks will be executed, in the order in which RunAfterProcessingCurrentEvent() was called. Use this method if you need to dispatch the same or some other runnable to another thread in a way which prevents any race conditions (for example unpredictable releases of objects). This method should be used only in existing code which can't be easily converted to use MozPromise which doesn't have the problem with unpredictable releases of objects, see: https://searchfox.org/mozilla-central/rev/4582d908c17fbf7924f5699609fe4a12c28ddc4a/xpcom/threads/MozPromise.h#866 Note: Calling this method from a thread pool is not supported since thread pools don't fire the "AfterProcessNextEvent" notification. The method has a diagnostic assertion for that so any calls like that will be caught in builds with enabled diagnostic assertions. The callback will never get executed in other builds, such as release builds. The limitation can be removed completely when thread pool implementation gets support for firing the "AfterProcessNextEvent". 2456 -
UniversalDirectoryLock.cpp aExclusive 2911 17 %
UniversalDirectoryLock.h / 2040 100 %
UsageInfo.h 2457 100 %