FileSystemQuotaClient::InitOrigin shouldn't be called when temporary storage is
already initialized. It shouldn't be called when there's already active storage
connection for the OPFS database either.
Differential Revision: https://phabricator.services.mozilla.com/D194467
The new test suite is intended for integration tests which verify usage
tracking without any restart in between. The suite is based on the existing
TestFileSystemQuotaClient suite except the test which in theory request a
restart in between: TrackedFilesOnInitOriginShouldCauseRescan.
TestFileSystemQuotaClient.cpp will get removed after some additional
refactoring.
Differential Revision: https://phabricator.services.mozilla.com/D194465
One of the goals of the asynchronous temporary storage initialization is to
call Ensure(Persistent|Temporary)OriginIsInitialized only from
Initialize(Persistent|Temporary)OriginOp. Calling from other places including
quota clients will be disallowed by changing the method to a private method.
The private nature of the method should be emphasized by adding the Internal
suffix.
Differential Revision: https://phabricator.services.mozilla.com/D192150
Until now, directory locks were dropped when the last strong reference was
removed or after calling Drop explicitly. The dependency on ref-counting makes
it less obvious when directory locks are dropped for real and it's also
difficult to release them asynchronously eventually. This patch removes the
directory lock unregistration from the destructor, so from now on, directory
locks must be always dropped explicitly.
Differential Revision: https://phabricator.services.mozilla.com/D197294
All present uses of the call-site arguments to MozPromise's methods
supply static strings. However, this is nowhere enforced. Do so.
Additionally, since this is the third or fourth time the present author
alone has personally implemented such an enforcement mechanism, create a
helper class to simplify doing so.
No functional changes.
Differential Revision: https://phabricator.services.mozilla.com/D207462
Both use cases of the getter of the WritableFileStream pointer are already handling the case where the result is null. In the debug-only check of whether all streams are closed, null result is possible, as evidenced by the bug. When the streams are closed at shutdown, we assume that closing takes place only once and the result is not null but since the second closing can be handled as a no-op, it is not necessary enforce this expectation, following declarative API design.
Differential Revision: https://phabricator.services.mozilla.com/D202589
Some quota clients currently use the BaseVFS (instead of QuotaVFS) during
origin initialization which makes sense at first glance (there's no need to
track usage when temporary storage is only being initialized).
However, QuotaVFS provides other important functionality besides quota checks
which is the overridden xFullPathname method. The overridden implementation is
needed to avoid file path normalization on Windows.
This patch changes relevant quota clients to always use QuotaVFS, even during
origin initialization to take advantage of the overriden xFullPathname method.
There will be no quota checks during origin initialization just like before
because the passed directory lock id is -1. GetQuotaObject will return nullptr
in that case.
Depends on D198187
Differential Revision: https://phabricator.services.mozilla.com/D198188
There are two similar GetStorageConnection overloads. The only difference is
that they use different mozIStorageService methods for database opening.
The overloads can be easilly merged into just one method, so database opening
will be done using mozIStorageService::GetDatabaseFileURL even when called
from FileSystemQuotaClient::InitOrigin.
Depends on D194519
Differential Revision: https://phabricator.services.mozilla.com/D198186
One of the goals of the asynchronous temporary storage initialization is to
call EnsureTemporaryStorageIsInitialized only from InitTemporaryStorageOp.
Calling from other places including quota clients will be disallowed by
changing the method to a private method. The private nature of the method
should be emphasized by adding the Internal suffix.
Differential Revision: https://phabricator.services.mozilla.com/D188332