Suppresses QM_TRY warning output in expected LSNG preloading scenarios by
introducing a new error code (NS_ERROR_DOM_QM_CLIENT_INIT_ORIGIN_UNINITIALIZED)
and ensuring it is processed without logging. This prevents terminal/system
console noise during normal fallback behavior when an origin directory has not
been initialized yet.
This patch also introduces a dedicated error module for QuotaManager, which has
been planned for some time and now provides a clean way to define and isolate
QuotaManager specific error codes.
These changes finalize the preparation for adding client initialization to
QuotaManager::OpenClientDirectory, while preserving LSNG’s delayed origin
initialization strategy.
Differential Revision: https://phabricator.services.mozilla.com/D246567
Aligns the signatures of client initialization methods with those used for
origin initialization, primarily by adding the aCreateIfNonExistent parameter.
This change prepares the way for supporting delayed creation of client
directories in QuotaManager::OpenClientDirectory, as required by the LSNG quota
client. LSNG delays creation of origin and client directories for performance
reasons, and this refactoring ensures that behavior can be preserved when
client initialization is added to OpenClientDirectory.
Differential Revision: https://phabricator.services.mozilla.com/D246563
Refactors client initialization methods to take ClientMetadata instead of
PrincipalInfo and other individual arguments, and updates relevant client
initialization operations to use pre-acquired directory locks. These are both
necessary steps for integrating client initialization into
QuotaManager::OpenClientDirectory.
Behavior remains unchanged for now.
Differential Revision: https://phabricator.services.mozilla.com/D246559
Introduce methods SaveOriginAccessTimeCount/SaveOriginAccessTimeCountInternal
and IncreaseSaveOriginAccessTimeCount/IncreaseSaveOriginAccessTimeCountInternal
to track SaveOriginAccessTime metadata updates.
This is mainly preparation for more complex testing related to the planned
transition from directory lock based to handle based access time tracking,
which will be handled by QuotaManager::OpenClientDirectory.
Currently, access time updates may be skipped in some edge cases. The
transition and follow-up patches will address those cases, and these new
counters will help test that updates are applied consistently.
Differential Revision: https://phabricator.services.mozilla.com/D244776
Saving of origin access time currently uses a directory lock over the entire
origin directory, which unnecessarily blocks exclusive directory locks for
individual clients.
This patch scopes SaveOriginAccessTime to metadata only by using a dedicated
ClientStorageScope, so that it no longer conflicts with client level exclusive
locks. This improves concurrency and prevents unrelated client operations from
being blocked by metadata access.
A previously disabled gtest has been enabled to verify that
SaveOriginAccessTime resolves correctly even when an exclusive client lock is
held.
Differential Revision: https://phabricator.services.mozilla.com/D243646
`Nullable<ClientType>` currently allows specifying either a concrete client
type or all client types, but does not support more flexible scoping options.
`ClientStorageScope` is designed to address that limitation, with future
support planned for special purpose scopes, such as locking the metadata file
shared by client directories.
This patch updates existing code, particularly around directory locks, to use
`ClientStorageScope` in place of `Nullable<ClientType>`.
Support for additional scope types will be added in a follow-up patch. This
patch focuses on transitioning to the new abstraction.
Differential Revision: https://phabricator.services.mozilla.com/D243630
This patch introduces a `SaveOriginAccessTime` method in `QuotaManager`,
enabling code to directly trigger origin access time updates.
While this functionality is currently needed only for writing new gtests to
verify directory locking behavior, it is also a preparatory step toward
integrating access time saving into the `QuotaManager::OpenClientDirectory`
promise chain in the future.
The method is not yet exposed to xpcshell tests. Doing so would require
extending `nsIQuotaManagerService` and implementing the necessary IPC plumbing,
which may be done in a future patch if needed.
Differential Revision: https://phabricator.services.mozilla.com/D243074
This patch improves the performance of ClearDataOp::DoDirectoryWork by
introducing a conditional optimization for thumbnail private identity patterns.
If the thumbnail private identity id is known, and the pattern matches the
thumbnail private identity pattern, and temporary storage is initialized, and
there are no thumbnail private identity temporary origins, the operation skips
iterating over all temporary storage repositories (only persistent repository
is traversed).
This optimization is especially important during shutdown, where reducing
unnecessary operations can help minimize delays and improve performance.
Differential Revision: https://phabricator.services.mozilla.com/D230183
A sub actor is no longer created. Actual result is now returned as an
asynchronous response to an asynchronous message.
Although this modernizes the code, the primary motivation is to enable calling
QuotaManager::ListOrigins in gtests.
Differential Revision: https://phabricator.services.mozilla.com/D230137
Introduce mTotalDirectoryIterations and methods TotalDirectoryIterations and
IncreaseTotalDirectoryIterations to track directory traversal count. Currently,
only clearing operations increase this counter, with full support to be added
later.
Differential Revision: https://phabricator.services.mozilla.com/D230094
This is not strictly required to get rid of PrincipalMetadataToPrincipalInfo,
but it's better for consistency and readability.
Differential Revision: https://phabricator.services.mozilla.com/D229646
This is not strictly required to get rid of PrincipalMetadataToPrincipalInfo,
but it's better for consistency and readability.
Differential Revision: https://phabricator.services.mozilla.com/D229596
This patch also extends ResolvableNormalOriginOp to enable debug-only checks in
UnwrapResolveValue overrides, ensuring that the method is called no more than
once.
Differential Revision: https://phabricator.services.mozilla.com/D227198
This is finally the patch which fundamentally changes the way how temporary
origins are initialized. Currently, when temporary storage is accessed for the
first time, all temporary origins need to be synchronously initialized. This
causes two major problems. First, large temporary storage can block first page
load for long time. Second, one broken origin breaks entire temporary storage.
These two problems can be mitigated in a big way by making the initialization
asynchronous. A lot of stuff had to be refactored, new infrastructure had to be
added and the support for conditional lazy initialization of origins had to be
implemented. This patch adds support for continuous background initialization
of all temporary origins collected during temporary storage initialization. So
if a page needs to access temporary storage, only origins for given group are
initialized. Origins for other groups are initialized in the background.
The background origin initialization is still considered to be experimental,
not recommended for normal use (disabled by default).
Differential Revision: https://phabricator.services.mozilla.com/D199082
The list will be initially only used for starting asynchronous initialization
of origins in the background, but it can be later also used for optimizing more
complex clearing operations to avoid traversing all origin directories on disk.
Differential Revision: https://phabricator.services.mozilla.com/D198990
The planned asynchronous temporary origin initialization in the background
will initialize temporary origins in groups to prevent situations when an
already initialized temporary origin would cause that group usage exceeds the
group limit (this could happen because the final/precise group usage would not
be known until all temporary origins for the group are initialized). So this
patch adds initial support for initializing temporary groups.
Differential Revision: https://phabricator.services.mozilla.com/D196826
The planned group (eTLD+1 domain) support in OriginScope will require access to
the group of a particular origin. PrincipalMetadata will not only allow easy
access to the group, but it will also allow further DirectoryLockImpl cleanup.
Differential Revision: https://phabricator.services.mozilla.com/D196034
IndexedDB still calls QuotaManager::EnsurePersistentOriginIsInitializedInternal
from its idle database maintenance. However, we want to get rid of that so the
method can be made private. The idle database maintenance should only rely on
QuotaManager::OpenStorageDirectory method to do all necessary initialization.
Before we can do that, we need a method dedicated for initialization of entire
persistent storage.
Differential Revision: https://phabricator.services.mozilla.com/D195653
LSNG already uses some QuotaManager APIs to achieve that origin directories are
not created if they don't exist during datastore preparation, but the feature
is not easy to use and it's also not generalized enough for use in other quota
clients. Besides that, the way how it's currently done in LSNG complicates
removal of QuotaManager::EnsureTemporaryOriginIsInitializedInternal calls from
LSNG. This patch is about generalizing of the feature, making it available to
all quota clients.
Differential Revision: https://phabricator.services.mozilla.com/D195551
Currently, the cached value is updated before creation of the metadata file
which can lead to a mismatch between the metadata file and the cached value if
creation of the metadata file fails. It will be safer to update the cached
value only after successful creation of the metadata file.
Differential Revision: https://phabricator.services.mozilla.com/D198670
Currently, we call QuotaManager::PersistOrigin even when the origin was already
persisted. QuotaManager::PersistOrigin won't try to update the value again,
but it will have to do a hash lookup. We can easilly avoid this by calling
QuotaManager::PersistOrigin only when the value changed in the metadata file.
Differential Revision: https://phabricator.services.mozilla.com/D198668
If temporary storage is already initialized, we can use the cached value and
avoid reading it from the metadata file (which was used for loading the cached
value).
Differential Revision: https://phabricator.services.mozilla.com/D198664
LSNG already uses some QuotaManager APIs to achieve that origin directories are
not created if they don't exist during datastore preparation, but the feature
is not easy to use and it's also not generalized enough for use in other quota
clients. Besides that, the way how it's currently done in LSNG complicates
removal of QuotaManager::EnsureTemporaryOriginIsInitializedInternal calls from
LSNG. This patch is about generalizing of the feature, making it available to
all quota clients.
Differential Revision: https://phabricator.services.mozilla.com/D195551
Currently, the cached value is updated before creation of the metadata file
which can lead to a mismatch between the metadata file and the cached value if
creation of the metadata file fails. It will be safer to update the cached
value only after successful creation of the metadata file.
Differential Revision: https://phabricator.services.mozilla.com/D198670
Currently, we call QuotaManager::PersistOrigin even when the origin was already
persisted. QuotaManager::PersistOrigin won't try to update the value again,
but it will have to do a hash lookup. We can easilly avoid this by calling
QuotaManager::PersistOrigin only when the value changed in the metadata file.
Differential Revision: https://phabricator.services.mozilla.com/D198668
If temporary storage is already initialized, we can use the cached value and
avoid reading it from the metadata file (which was used for loading the cached
value).
Differential Revision: https://phabricator.services.mozilla.com/D198664
The new category is needed for implementing an optimization in
QuotaManager::InitializePersistentOrigin,
QuotaManager::InitializeTemporaryOrigin and
QuotaManager::OpenClientDirectory to avoid creating a new origin initialization
operations when a given origin is already initialized.
Differential Revision: https://phabricator.services.mozilla.com/D195543
Origin initialization tracking on the owning thread is needed for covering
origin initialization in QuotaManager::OpenClientDirectory.
Differential Revision: https://phabricator.services.mozilla.com/D195535
Client storages can be currently reset by using the optional argument of
nsIQuotaManagerService::ResetStoragesForPrincipal. However, supporting
resetting storages for both a principal and a client is not ideal for several
reasons. Resetting of origins will have to unset some flags which is
problematic when a client type is specified and resetting of clients will
eventually need to unset some other flags as well.
Differential Revision: https://phabricator.services.mozilla.com/D195508
Client storages can be currently cleared by using the optional argument of
nsIQuotaManagerService::ClearStoragesForPrincipal. However, supporting clearing
storages for both a principal and a client is not ideal for several reasons.
Clearing of origins will have to unset some flags which is problematic when
a client type is specified and clearing of clients will eventually need to
unset some other flags as well.
Differential Revision: https://phabricator.services.mozilla.com/D195403
QuotaManager::OpenStorageDirectory already makes sure that temporary storage
is initialized so all these calls are now redundant.
Differential Revision: https://phabricator.services.mozilla.com/D195395
QuotaManager::OpenStorageDirectory can now detect the requested persistence
scope and initialize temporary storage if it's needed.
Differential Revision: https://phabricator.services.mozilla.com/D195393