Bug 1871799 - Fix relevant quota clients to always use QuotaVFS for database access; r=dom-storage-reviewers,asuth

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
This commit is contained in:
Jan Varga 2024-01-10 21:10:14 +00:00
parent c8d644cead
commit 8ca630b297
3 changed files with 6 additions and 12 deletions

View File

@ -160,10 +160,8 @@ Result<nsCOMPtr<mozIStorageConnection>, nsresult> OpenDBConnection(
NewFileURIMutator, &aDBFile));
const nsCString directoryLockIdClause =
aDirectoryMetadata.mDirectoryLockId >= 0
? "&directoryLockId="_ns +
IntToCString(aDirectoryMetadata.mDirectoryLockId)
: EmptyCString();
"&directoryLockId="_ns +
IntToCString(aDirectoryMetadata.mDirectoryLockId);
const auto keyClause = [&aMaybeCipherKey] {
nsAutoCString keyClause;

View File

@ -243,10 +243,8 @@ Result<nsCOMPtr<nsIFileURL>, QMResult> GetDatabaseFileURL(
// initialized yet. At that time, the in-memory objects (e.g. OriginInfo) are
// only being created so it doesn't make sense to tunnel quota information to
// QuotaVFS to get corresponding QuotaObject instances for SQLite files.
const auto directoryLockIdClause =
aDirectoryLockId >= 0
? "&directoryLockId="_ns + IntToCString(aDirectoryLockId)
: EmptyCString();
const nsCString directoryLockIdClause =
"&directoryLockId="_ns + IntToCString(aDirectoryLockId);
nsCOMPtr<nsIFileURL> result;
QM_TRY(QM_TO_RESULT(NS_MutateURI(mutator)

View File

@ -586,10 +586,8 @@ Result<nsCOMPtr<nsIFileURL>, nsresult> GetDatabaseFileURL(
// - from DeleteDatabaseOp::LoadPreviousVersion, since this might require
// temporarily exceeding the quota limit before the database can be
// deleted.
const auto directoryLockIdClause =
aDirectoryLockId >= 0
? "&directoryLockId="_ns + IntToCString(aDirectoryLockId)
: EmptyCString();
const nsCString directoryLockIdClause =
"&directoryLockId="_ns + IntToCString(aDirectoryLockId);
const auto keyClause = [&aMaybeKey] {
nsAutoCString keyClause;