From 113846d47de7384704b62f4f2fe400c4107a60e8 Mon Sep 17 00:00:00 2001 From: Jan Varga Date: Thu, 19 Nov 2020 15:42:03 +0000 Subject: [PATCH] Bug 1619592 - Replace EnsureStorageAndOriginIsInitialized with EnsurePersistentOriginIsInitialized and EnsureTemporaryOriginIsInitialized in dom/simpledb; r=dom-workers-and-storage-reviewers,sg Differential Revision: https://phabricator.services.mozilla.com/D97259 --- dom/simpledb/ActorsParent.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/dom/simpledb/ActorsParent.cpp b/dom/simpledb/ActorsParent.cpp index 3150ce8d9b3d..be31beb3c686 100644 --- a/dom/simpledb/ActorsParent.cpp +++ b/dom/simpledb/ActorsParent.cpp @@ -1201,9 +1201,23 @@ nsresult OpenOp::DatabaseWork() { QuotaManager* quotaManager = QuotaManager::Get(); MOZ_ASSERT(quotaManager); - SDB_TRY_INSPECT(const auto& dbDirectory, - quotaManager->EnsureStorageAndOriginIsInitialized( - GetConnection()->GetPersistenceType(), mQuotaInfo)); + SDB_TRY(quotaManager->EnsureStorageIsInitialized()); + + SDB_TRY_INSPECT( + const auto& dbDirectory, + ([persistenceType = GetConnection()->GetPersistenceType(), "aManager, + this]() + -> mozilla::Result, bool>, nsresult> { + if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) { + SDB_TRY_RETURN( + quotaManager->EnsurePersistentOriginIsInitialized(mQuotaInfo)); + } + + SDB_TRY(quotaManager->EnsureTemporaryStorageIsInitialized()); + SDB_TRY_RETURN(quotaManager->EnsureTemporaryOriginIsInitialized( + persistenceType, mQuotaInfo)); + }() + .map([](const auto& res) { return res.first; }))); nsresult rv = dbDirectory->Append(NS_LITERAL_STRING_FROM_CSTRING(SDB_DIRECTORY_NAME));