mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1651016 - Convert remaining NS_ENSURE_SUCCESS to IDB_TRY in dom/indexedDB; r=dom-workers-and-storage-reviewers,ttung,sg
Differential Revision: https://phabricator.services.mozilla.com/D84315
This commit is contained in:
parent
bb5054fefb
commit
39831220cc
@ -15,6 +15,7 @@
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "mozilla/dom/ErrorEventBinding.h"
|
||||
@ -32,6 +33,7 @@
|
||||
#include "IDBFactory.h"
|
||||
#include "IDBKeyRange.h"
|
||||
#include "IDBRequest.h"
|
||||
#include "IndexedDBCommon.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ScriptErrorHelper.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
@ -253,8 +255,7 @@ IndexedDatabaseManager* IndexedDatabaseManager::GetOrCreate() {
|
||||
|
||||
RefPtr<IndexedDatabaseManager> instance(new IndexedDatabaseManager());
|
||||
|
||||
nsresult rv = instance->Init();
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
IDB_TRY(instance->Init(), nullptr);
|
||||
|
||||
if (gInitialized.exchange(true)) {
|
||||
NS_ERROR("Initialized more than once?!");
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdint.h> // for UINT32_MAX, uintptr_t
|
||||
#include "IndexedDBCommon.h"
|
||||
#include "IndexedDatabase.h"
|
||||
#include "IndexedDatabaseInlines.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
@ -21,6 +22,7 @@
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
#include "mozIStorageStatement.h"
|
||||
#include "mozIStorageValueArray.h"
|
||||
@ -483,9 +485,8 @@ nsresult Key::DecodeJSValInternal(const EncodedDataType*& aPos,
|
||||
uint32_t index = 0;
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
while (aPos < aEnd && *aPos - aTypeOffset != eTerminator) {
|
||||
nsresult rv = DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset, &val,
|
||||
aRecursionDepth + 1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
IDB_TRY(DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset, &val,
|
||||
aRecursionDepth + 1));
|
||||
|
||||
aTypeOffset = 0;
|
||||
|
||||
|
@ -5,21 +5,22 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "KeyPath.h"
|
||||
|
||||
#include "IDBObjectStore.h"
|
||||
#include "IndexedDBCommon.h"
|
||||
#include "Key.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "js/Array.h" // JS::NewArrayObject
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Blob.h"
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/IDBObjectStoreBinding.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -251,8 +252,10 @@ nsresult GetJSValFromKeyPathString(
|
||||
IDB_ENSURE_TRUE(succeeded, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return rv;
|
||||
// TODO: It would be nicer to do the cleanup using a RAII class or something.
|
||||
// This last IDB_TRY could be removed then.
|
||||
IDB_TRY(rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user