Bug 1662087 - Replace explicit error handling involving `mozilla::Result::isErr` with IDB_TRY/IDB_TRY_VAR in IDBDatabase.cpp; r=dom-workers-and-storage-reviewers,sg,ttung

Differential Revision: https://phabricator.services.mozilla.com/D88829
This commit is contained in:
Jan Varga 2020-09-07 15:52:27 +00:00
Родитель 2620d5fb0d
Коммит 87245d7d42
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -16,9 +16,11 @@
#include "IDBFactory.h" #include "IDBFactory.h"
#include "IndexedDatabaseInlines.h" #include "IndexedDatabaseInlines.h"
#include "IndexedDatabaseManager.h" #include "IndexedDatabaseManager.h"
#include "IndexedDBCommon.h"
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"
#include "mozilla/EventDispatcher.h" #include "mozilla/EventDispatcher.h"
#include "MainThreadUtils.h" #include "MainThreadUtils.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/storage.h" #include "mozilla/storage.h"
#include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/BindingDeclarations.h"
@ -881,12 +883,8 @@ nsresult IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
return NS_OK; return NS_OK;
case PrincipalInfo::TContentPrincipalInfo: { case PrincipalInfo::TContentPrincipalInfo: {
auto principalOrErr = PrincipalInfoToPrincipal(*principalInfo); IDB_TRY_VAR(auto principal, PrincipalInfoToPrincipal(*principalInfo));
if (NS_WARN_IF(principalOrErr.isErr())) {
return principalOrErr.unwrapErr();
}
nsCOMPtr<nsIPrincipal> principal = principalOrErr.unwrap();
nsresult rv = QuotaManager::GetInfoFromPrincipal(principal, nullptr, nsresult rv = QuotaManager::GetInfoFromPrincipal(principal, nullptr,
nullptr, &aOrigin); nullptr, &aOrigin);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {