Bug 1663924 - Removed IDB_ENSURE_TRUE macro and convert its uses to IDB_TRY. r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D89622
This commit is contained in:
Simon Giesecke 2020-09-10 10:16:29 +00:00
Родитель 0d5bc68f92
Коммит 6718e32b76
2 изменённых файлов: 6 добавлений и 14 удалений

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

@ -103,9 +103,10 @@ nsresult GetJSValFromKeyPathString(
// We call JS_GetOwnUCPropertyDescriptor on purpose (as opposed to
// JS_GetUCPropertyDescriptor) to avoid searching the prototype chain.
JS::Rooted<JS::PropertyDescriptor> desc(aCx);
bool ok = JS_GetOwnUCPropertyDescriptor(aCx, obj, keyPathChars,
keyPathLen, &desc);
IDB_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
IDB_TRY(OkIf(JS_GetOwnUCPropertyDescriptor(aCx, obj, keyPathChars,
keyPathLen, &desc)),
NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
IDB_REPORT_INTERNAL_ERR_LAMBDA);
JS::Rooted<JS::Value> intermediate(aCx);
bool hasProp = false;
@ -249,7 +250,8 @@ nsresult GetJSValFromKeyPathString(
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
IDB_ENSURE_TRUE(succeeded, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
IDB_TRY(OkIf(succeeded.ok()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
IDB_REPORT_INTERNAL_ERR_LAMBDA);
}
// TODO: It would be nicer to do the cleanup using a RAII class or something.

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

@ -24,16 +24,6 @@
#define IDB_REPORT_INTERNAL_ERR_LAMBDA \
[](const auto&) { IDB_REPORT_INTERNAL_ERR(); }
// Based on NS_ENSURE_TRUE
#define IDB_ENSURE_TRUE(x, ret) \
do { \
if (MOZ_UNLIKELY(!(x))) { \
IDB_REPORT_INTERNAL_ERR(); \
NS_WARNING("IDB_ENSURE_TRUE(" #x ") failed"); \
return ret; \
} \
} while (0)
namespace mozilla {
namespace dom {
namespace indexedDB {