Bug 1709067 - IDB: Remove module specific QM_TRY macros; r=dom-storage-reviewers,jstutte
authorJan Varga <jvarga@mozilla.com>
Mon, 03 May 2021 19:44:38 +0000
changeset 578369 6d0d00d6ee458a336111651c15fdd38c7937ece6
parent 578368 6518ee4ceeb4d6eb607819f41545e8a7d139f239
child 578370 5acd53fb30033afb78ce6b0514448121565b3514
push id142429
push userjvarga@mozilla.com
push dateMon, 03 May 2021 19:47:14 +0000
treeherderautoland@aad326665558 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-storage-reviewers, jstutte
bugs1709067
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1709067 - IDB: Remove module specific QM_TRY macros; r=dom-storage-reviewers,jstutte Differential Revision: https://phabricator.services.mozilla.com/D114080
dom/indexedDB/ActorsChild.cpp
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/ActorsParentCommon.cpp
dom/indexedDB/DBSchema.cpp
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IndexedDBCommon.cpp
dom/indexedDB/IndexedDBCommon.h
dom/indexedDB/IndexedDatabaseManager.cpp
dom/indexedDB/Key.cpp
dom/indexedDB/KeyPath.cpp
dom/indexedDB/PermissionRequestBase.cpp
dom/indexedDB/SchemaUpgrades.cpp
dom/quota/CheckedUnsafePtr.h
--- a/dom/indexedDB/ActorsChild.cpp
+++ b/dom/indexedDB/ActorsChild.cpp
@@ -778,32 +778,31 @@ class WorkerPermissionChallenge final : 
       wp = wp->GetParent();
     }
 
     nsPIDOMWindowInner* const window = wp->GetWindow();
     if (!window) {
       return true;
     }
 
-    IDB_TRY_UNWRAP(auto principal,
-                   mozilla::ipc::PrincipalInfoToPrincipal(mPrincipalInfo),
-                   true);
+    QM_TRY_UNWRAP(auto principal,
+                  mozilla::ipc::PrincipalInfoToPrincipal(mPrincipalInfo), true);
 
     if (XRE_IsParentProcess()) {
       const nsCOMPtr<Element> ownerElement =
           do_QueryInterface(window->GetChromeEventHandler());
       if (NS_WARN_IF(!ownerElement)) {
         return true;
       }
 
       RefPtr<WorkerPermissionRequest> helper =
           new WorkerPermissionRequest(ownerElement, principal, this);
 
-      IDB_TRY_INSPECT(const PermissionRequestBase::PermissionValue& permission,
-                      helper->PromptIfNeeded(), true);
+      QM_TRY_INSPECT(const PermissionRequestBase::PermissionValue& permission,
+                     helper->PromptIfNeeded(), true);
 
       MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed ||
                  permission == PermissionRequestBase::kPermissionDenied ||
                  permission == PermissionRequestBase::kPermissionPrompt);
 
       return permission != PermissionRequestBase::kPermissionPrompt;
     }
 
@@ -1465,19 +1464,19 @@ mozilla::ipc::IPCResult BackgroundFactor
     RefPtr<WorkerPermissionChallenge> challenge = new WorkerPermissionChallenge(
         workerPrivate, this, mFactory.clonePtr(), std::move(aPrincipalInfo));
     if (!challenge->Dispatch()) {
       return IPC_FAIL_NO_REASON(this);
     }
     return IPC_OK();
   }
 
-  IDB_TRY_UNWRAP(auto principal,
-                 mozilla::ipc::PrincipalInfoToPrincipal(aPrincipalInfo),
-                 IPC_FAIL_NO_REASON(this));
+  QM_TRY_UNWRAP(auto principal,
+                mozilla::ipc::PrincipalInfoToPrincipal(aPrincipalInfo),
+                IPC_FAIL_NO_REASON(this));
 
   if (XRE_IsParentProcess()) {
     nsCOMPtr<nsIGlobalObject> global = mFactory->GetParentObject();
     nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(global);
     MOZ_ASSERT(window);
 
     nsCOMPtr<Element> ownerElement =
         do_QueryInterface(window->GetChromeEventHandler());
@@ -1489,18 +1488,18 @@ mozilla::ipc::IPCResult BackgroundFactor
       }
       return IPC_OK();
     }
 
     RefPtr<PermissionRequestMainProcessHelper> helper =
         new PermissionRequestMainProcessHelper(this, mFactory.clonePtr(),
                                                ownerElement, principal);
 
-    IDB_TRY_INSPECT(const PermissionRequestBase::PermissionValue& permission,
-                    helper->PromptIfNeeded(), IPC_FAIL_NO_REASON(this));
+    QM_TRY_INSPECT(const PermissionRequestBase::PermissionValue& permission,
+                   helper->PromptIfNeeded(), IPC_FAIL_NO_REASON(this));
 
     MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed ||
                permission == PermissionRequestBase::kPermissionDenied ||
                permission == PermissionRequestBase::kPermissionPrompt);
 
     if (permission != PermissionRequestBase::kPermissionPrompt) {
       SendPermissionRetry();
     }
@@ -2435,26 +2434,26 @@ void BackgroundRequestChild::HandleRespo
 }
 
 void BackgroundRequestChild::HandleResponse(
     nsTArray<SerializedStructuredCloneReadInfo>&& aResponse) {
   AssertIsOnOwningThread();
 
   nsTArray<StructuredCloneReadInfoChild> cloneReadInfos;
 
-  IDB_TRY(OkIf(cloneReadInfos.SetCapacity(aResponse.Length(), fallible)),
-          QM_VOID, ([&aResponse, this](const auto) {
-            // Since we are under memory pressure, release aResponse early.
-            aResponse.Clear();
-
-            DispatchErrorEvent(mRequest, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-                               AcquireTransaction());
-
-            MOZ_ASSERT(mTransaction->IsAborted());
-          }));
+  QM_TRY(OkIf(cloneReadInfos.SetCapacity(aResponse.Length(), fallible)),
+         QM_VOID, ([&aResponse, this](const auto) {
+           // Since we are under memory pressure, release aResponse early.
+           aResponse.Clear();
+
+           DispatchErrorEvent(mRequest, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+                              AcquireTransaction());
+
+           MOZ_ASSERT(mTransaction->IsAborted());
+         }));
 
   std::transform(std::make_move_iterator(aResponse.begin()),
                  std::make_move_iterator(aResponse.end()),
                  MakeBackInserter(cloneReadInfos),
                  [database = mTransaction->Database(), this](
                      SerializedStructuredCloneReadInfo&& serializedCloneInfo) {
                    return DeserializeStructuredCloneReadInfo(
                        std::move(serializedCloneInfo), database,
@@ -2789,22 +2788,22 @@ nsresult BackgroundRequestChild::Preproc
   nsCOMPtr<mozIRemoteLazyInputStream> blobInputStream =
       do_QueryInterface(mStream);
   MOZ_ASSERT(blobInputStream);
 
   nsCOMPtr<nsIInputStream> internalInputStream =
       blobInputStream->GetInternalStream();
   MOZ_ASSERT(internalInputStream);
 
-  IDB_TRY(
+  QM_TRY(
       SnappyUncompressStructuredCloneData(*internalInputStream, *mCloneData));
 
   mState = State::Finishing;
 
-  IDB_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
+  QM_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 void BackgroundRequestChild::PreprocessHelper::Finish() {
   AssertIsOnOwningThread();
 
   if (mActor) {
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -446,24 +446,25 @@ struct FullObjectStoreMetadata {
  private:
   ~FullObjectStoreMetadata() = default;
 };
 
 typedef nsTHashMap<nsUint64HashKey, SafeRefPtr<FullObjectStoreMetadata>>
     ObjectStoreTable;
 
 static_assert(
+    std::is_same_v<IndexOrObjectStoreId,
+                   std::remove_cv_t<std::remove_reference_t<
+                       decltype(std::declval<const ObjectStoreGetParams&>()
+                                    .objectStoreId())>>>);
+static_assert(
     std::is_same_v<
         IndexOrObjectStoreId,
-        std::remove_cv_t<std::remove_reference_t<decltype(
-            std::declval<const ObjectStoreGetParams&>().objectStoreId())>>>);
-static_assert(std::is_same_v<
-              IndexOrObjectStoreId,
-              std::remove_cv_t<std::remove_reference_t<decltype(
-                  std::declval<const IndexGetParams&>().objectStoreId())>>>);
+        std::remove_cv_t<std::remove_reference_t<
+            decltype(std::declval<const IndexGetParams&>().objectStoreId())>>>);
 
 struct FullDatabaseMetadata final : AtomicSafeRefCounted<FullDatabaseMetadata> {
   DatabaseMetadata mCommonMetadata;
   nsCString mDatabaseId;
   nsString mFilePath;
   ObjectStoreTable mObjectStores;
 
   IndexOrObjectStoreId mNextObjectStoreId = 0;
@@ -586,28 +587,28 @@ nsAutoString GetDatabaseFilenameBase(con
   return databaseFilenameBase;
 }
 
 Result<nsCOMPtr<nsIFileURL>, nsresult> GetDatabaseFileURL(
     nsIFile& aDatabaseFile, const int64_t aDirectoryLockId,
     const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(aDirectoryLockId >= -1);
 
-  IDB_TRY_INSPECT(const auto& protocolHandler,
-                  ToResultGet<nsCOMPtr<nsIProtocolHandler>>(
-                      MOZ_SELECT_OVERLOAD(do_GetService),
-                      NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file"));
-
-  IDB_TRY_INSPECT(const auto& fileHandler,
-                  ToResultGet<nsCOMPtr<nsIFileProtocolHandler>>(
-                      MOZ_SELECT_OVERLOAD(do_QueryInterface), protocolHandler));
-
-  IDB_TRY_INSPECT(const auto& mutator, MOZ_TO_RESULT_INVOKE_TYPED(
-                                           nsCOMPtr<nsIURIMutator>, fileHandler,
-                                           NewFileURIMutator, &aDatabaseFile));
+  QM_TRY_INSPECT(const auto& protocolHandler,
+                 ToResultGet<nsCOMPtr<nsIProtocolHandler>>(
+                     MOZ_SELECT_OVERLOAD(do_GetService),
+                     NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file"));
+
+  QM_TRY_INSPECT(const auto& fileHandler,
+                 ToResultGet<nsCOMPtr<nsIFileProtocolHandler>>(
+                     MOZ_SELECT_OVERLOAD(do_QueryInterface), protocolHandler));
+
+  QM_TRY_INSPECT(const auto& mutator, MOZ_TO_RESULT_INVOKE_TYPED(
+                                          nsCOMPtr<nsIURIMutator>, fileHandler,
+                                          NewFileURIMutator, &aDatabaseFile));
 
   // aDirectoryLockId should only be -1 when we are called
   // - from FileManager::InitDirectory when the temporary storage hasn't been
   //    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 TelemetryVFS to get corresponding QuotaObject instances
   //    for SQLite files.
   // - from DeleteDatabaseOp::LoadPreviousVersion, since this might require
@@ -623,26 +624,26 @@ Result<nsCOMPtr<nsIFileURL>, nsresult> G
       keyClause.AssignLiteral("&key=");
       for (uint8_t byte : IndexedDBCipherStrategy::SerializeKey(*aMaybeKey)) {
         keyClause.AppendPrintf("%02x", byte);
       }
     }
     return keyClause;
   }();
 
-  IDB_TRY_UNWRAP(
-      auto result, ([&mutator, &directoryLockIdClause, &keyClause] {
-        nsCOMPtr<nsIFileURL> result;
-        nsresult rv = NS_MutateURI(mutator)
-                          .SetQuery("cache=private"_ns + directoryLockIdClause +
-                                    keyClause)
-                          .Finalize(result);
-        return NS_SUCCEEDED(rv) ? Result<nsCOMPtr<nsIFileURL>, nsresult>{result}
-                                : Err(rv);
-      }()));
+  QM_TRY_UNWRAP(auto result, ([&mutator, &directoryLockIdClause, &keyClause] {
+                  nsCOMPtr<nsIFileURL> result;
+                  nsresult rv = NS_MutateURI(mutator)
+                                    .SetQuery("cache=private"_ns +
+                                              directoryLockIdClause + keyClause)
+                                    .Finalize(result);
+                  return NS_SUCCEEDED(rv)
+                             ? Result<nsCOMPtr<nsIFileURL>, nsresult>{result}
+                             : Err(rv);
+                }()));
 
   return result;
 }
 
 nsresult SetDefaultPragmas(mozIStorageConnection& aConnection) {
   MOZ_ASSERT(!NS_IsMainThread());
 
   static constexpr auto kBuiltInPragmas =
@@ -662,95 +663,94 @@ nsresult SetDefaultPragmas(mozIStorageCo
       // triggers, so the statement fires the delete trigger first and then the
       // insert trigger.
       "PRAGMA recursive_triggers = ON;"
 
       // We aggressively truncate the database file when idle so don't bother
       // overwriting the WAL with 0 during active periods.
       "PRAGMA secure_delete = OFF;"_ns;
 
-  IDB_TRY(aConnection.ExecuteSimpleSQL(kBuiltInPragmas));
-
-  IDB_TRY(aConnection.ExecuteSimpleSQL(nsAutoCString{
+  QM_TRY(aConnection.ExecuteSimpleSQL(kBuiltInPragmas));
+
+  QM_TRY(aConnection.ExecuteSimpleSQL(nsAutoCString{
       "PRAGMA synchronous = "_ns +
       (IndexedDatabaseManager::FullSynchronous() ? "FULL"_ns : "NORMAL"_ns) +
       ";"_ns}));
 
 #ifndef IDB_MOBILE
   if (kSQLiteGrowthIncrement) {
     // This is just an optimization so ignore the failure if the disk is
     // currently too full.
-    IDB_TRY(QM_OR_ELSE_WARN(
+    QM_TRY(QM_OR_ELSE_WARN(
         ToResult(aConnection.SetGrowthIncrement(kSQLiteGrowthIncrement, ""_ns)),
         (ErrToDefaultOkOrErr<NS_ERROR_FILE_TOO_BIG, Ok>)));
   }
 #endif  // IDB_MOBILE
 
   return NS_OK;
 }
 
 nsresult SetJournalMode(mozIStorageConnection& aConnection) {
   MOZ_ASSERT(!NS_IsMainThread());
 
   // Try enabling WAL mode. This can fail in various circumstances so we have to
   // check the results here.
   constexpr auto journalModeQueryStart = "PRAGMA journal_mode = "_ns;
   constexpr auto journalModeWAL = "wal"_ns;
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  CreateAndExecuteSingleStepStatement(
-                      aConnection, journalModeQueryStart + journalModeWAL));
-
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(const auto& stmt,
+                 CreateAndExecuteSingleStepStatement(
+                     aConnection, journalModeQueryStart + journalModeWAL));
+
+  QM_TRY_INSPECT(
       const auto& journalMode,
       MOZ_TO_RESULT_INVOKE_TYPED(nsCString, *stmt, GetUTF8String, 0));
 
   if (journalMode.Equals(journalModeWAL)) {
     // WAL mode successfully enabled. Maybe set limits on its size here.
     if (kMaxWALPages >= 0) {
-      IDB_TRY(aConnection.ExecuteSimpleSQL("PRAGMA wal_autocheckpoint = "_ns +
-                                           IntToCString(kMaxWALPages)));
+      QM_TRY(aConnection.ExecuteSimpleSQL("PRAGMA wal_autocheckpoint = "_ns +
+                                          IntToCString(kMaxWALPages)));
     }
   } else {
     NS_WARNING("Failed to set WAL mode, falling back to normal journal mode.");
 #ifdef IDB_MOBILE
-    IDB_TRY(
-        aConnection.ExecuteSimpleSQL(journalModeQueryStart + "truncate"_ns));
+    QM_TRY(aConnection.ExecuteSimpleSQL(journalModeQueryStart + "truncate"_ns));
 #endif
   }
 
   return NS_OK;
 }
 
 Result<MovingNotNull<nsCOMPtr<mozIStorageConnection>>, nsresult> OpenDatabase(
     mozIStorageService& aStorageService, nsIFileURL& aFileURL,
     const uint32_t aTelemetryId = 0) {
   const nsAutoCString telemetryFilename =
       aTelemetryId ? "indexedDB-"_ns + IntToCString(aTelemetryId) +
                          NS_ConvertUTF16toUTF8(kSQLiteSuffix)
                    : nsAutoCString();
 
-  IDB_TRY_UNWRAP(auto connection,
-                 MOZ_TO_RESULT_INVOKE_TYPED(
-                     nsCOMPtr<mozIStorageConnection>, aStorageService,
-                     OpenDatabaseWithFileURL, &aFileURL, telemetryFilename));
+  QM_TRY_UNWRAP(auto connection,
+                MOZ_TO_RESULT_INVOKE_TYPED(
+                    nsCOMPtr<mozIStorageConnection>, aStorageService,
+                    OpenDatabaseWithFileURL, &aFileURL, telemetryFilename));
 
   return WrapMovingNotNull(std::move(connection));
 }
 
 Result<MovingNotNull<nsCOMPtr<mozIStorageConnection>>, nsresult>
 OpenDatabaseAndHandleBusy(mozIStorageService& aStorageService,
                           nsIFileURL& aFileURL,
                           const uint32_t aTelemetryId = 0) {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   using ConnectionType = Maybe<MovingNotNull<nsCOMPtr<mozIStorageConnection>>>;
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       auto connection,
       QM_OR_ELSE_WARN(
           OpenDatabase(aStorageService, aFileURL, aTelemetryId)
               .map([](auto connection) -> ConnectionType {
                 return Some(std::move(connection));
               }),
           (ErrToDefaultOkOrErr<NS_ERROR_STORAGE_BUSY, ConnectionType>)));
 
@@ -770,17 +770,17 @@ OpenDatabaseAndHandleBusy(mozIStorageSer
 
     // Another thread must be checkpointing the WAL. Wait up to 10 seconds for
     // that to complete.
     const TimeStamp start = TimeStamp::NowLoRes();
 
     do {
       PR_Sleep(PR_MillisecondsToInterval(100));
 
-      IDB_TRY_UNWRAP(
+      QM_TRY_UNWRAP(
           connection,
           QM_OR_ELSE_WARN(
               OpenDatabase(aStorageService, aFileURL, aTelemetryId)
                   .map([](auto connection) -> ConnectionType {
                     return Some(std::move(connection));
                   }),
               ([&start](nsresult aValue) -> Result<ConnectionType, nsresult> {
                 if (aValue != NS_ERROR_STORAGE_BUSY ||
@@ -796,23 +796,23 @@ OpenDatabaseAndHandleBusy(mozIStorageSer
 
   return connection.extract();
 }
 
 // Returns true if a given nsIFile exists and is a directory. Returns false if
 // it doesn't exist. Returns an error if it exists, but is not a directory, or
 // any other error occurs.
 Result<bool, nsresult> ExistsAsDirectory(nsIFile& aDirectory) {
-  IDB_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
 
   if (exists) {
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(aDirectory, IsDirectory));
-
-    IDB_TRY(OkIf(isDirectory), Err(NS_ERROR_FAILURE));
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(aDirectory, IsDirectory));
+
+    QM_TRY(OkIf(isDirectory), Err(NS_ERROR_FAILURE));
   }
 
   return exists;
 }
 
 constexpr nsresult mapNoDeviceSpaceError(nsresult aRv) {
   if (aRv == NS_ERROR_FILE_NO_DEVICE_SPACE) {
     // mozstorage translates SQLITE_FULL to
@@ -829,25 +829,25 @@ CreateStorageConnection(nsIFile& aDBFile
                         const int64_t aDirectoryLockId,
                         const uint32_t aTelemetryId,
                         const Maybe<CipherKey>& aMaybeKey) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectoryLockId >= -1);
 
   AUTO_PROFILER_LABEL("CreateStorageConnection", DOM);
 
-  IDB_TRY_INSPECT(const auto& dbFileUrl,
-                  GetDatabaseFileURL(aDBFile, aDirectoryLockId, aMaybeKey));
-
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(const auto& dbFileUrl,
+                 GetDatabaseFileURL(aDBFile, aDirectoryLockId, aMaybeKey));
+
+  QM_TRY_INSPECT(
       const auto& storageService,
       ToResultGet<nsCOMPtr<mozIStorageService>>(
           MOZ_SELECT_OVERLOAD(do_GetService), MOZ_STORAGE_SERVICE_CONTRACTID));
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       auto connection,
       QM_OR_ELSE_WARN(
           OpenDatabaseAndHandleBusy(*storageService, *dbFileUrl, aTelemetryId)
               .map([](auto connection) -> nsCOMPtr<mozIStorageConnection> {
                 return std::move(connection).unwrapBasePtr();
               }),
           ([&aName](nsresult aValue)
                -> Result<nsCOMPtr<mozIStorageConnection>, nsresult> {
@@ -860,261 +860,258 @@ CreateStorageConnection(nsIFile& aDBFile
 
             return nsCOMPtr<mozIStorageConnection>();
           })));
 
   if (!connection) {
     // XXX Shouldn't we also update quota usage?
 
     // Nuke the database file.
-    IDB_TRY(aDBFile.Remove(false));
-    IDB_TRY_INSPECT(const bool& existsAsDirectory,
-                    ExistsAsDirectory(aFMDirectory));
+    QM_TRY(aDBFile.Remove(false));
+    QM_TRY_INSPECT(const bool& existsAsDirectory,
+                   ExistsAsDirectory(aFMDirectory));
 
     if (existsAsDirectory) {
-      IDB_TRY(aFMDirectory.Remove(true));
-    }
-
-    IDB_TRY_UNWRAP(connection, OpenDatabaseAndHandleBusy(
-                                   *storageService, *dbFileUrl, aTelemetryId));
-  }
-
-  IDB_TRY(SetDefaultPragmas(*connection));
-  IDB_TRY(connection->EnableModule("filesystem"_ns));
+      QM_TRY(aFMDirectory.Remove(true));
+    }
+
+    QM_TRY_UNWRAP(connection, OpenDatabaseAndHandleBusy(
+                                  *storageService, *dbFileUrl, aTelemetryId));
+  }
+
+  QM_TRY(SetDefaultPragmas(*connection));
+  QM_TRY(connection->EnableModule("filesystem"_ns));
 
   // Check to make sure that the database schema is correct.
-  IDB_TRY_INSPECT(const int32_t& schemaVersion,
-                  MOZ_TO_RESULT_INVOKE(connection, GetSchemaVersion));
+  QM_TRY_INSPECT(const int32_t& schemaVersion,
+                 MOZ_TO_RESULT_INVOKE(connection, GetSchemaVersion));
 
   // Unknown schema will fail origin initialization too.
-  IDB_TRY(
-      OkIf(schemaVersion || !aName.IsVoid()),
-      Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR), [](const auto&) {
-        IDB_WARNING("Unable to open IndexedDB database, schema is not set!");
-      });
-
-  IDB_TRY(
+  QM_TRY(OkIf(schemaVersion || !aName.IsVoid()),
+         Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR), [](const auto&) {
+           IDB_WARNING("Unable to open IndexedDB database, schema is not set!");
+         });
+
+  QM_TRY(
       OkIf(schemaVersion <= kSQLiteSchemaVersion),
       Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR), [](const auto&) {
         IDB_WARNING("Unable to open IndexedDB database, schema is too high!");
       });
 
   bool journalModeSet = false;
 
   if (schemaVersion != kSQLiteSchemaVersion) {
     const bool newDatabase = !schemaVersion;
 
     if (newDatabase) {
       // Set the page size first.
       const auto sqlitePageSizeOverride =
           aMaybeKey ? 8192 : kSQLitePageSizeOverride;
       if (sqlitePageSizeOverride) {
-        IDB_TRY(connection->ExecuteSimpleSQL(nsPrintfCString(
+        QM_TRY(connection->ExecuteSimpleSQL(nsPrintfCString(
             "PRAGMA page_size = %" PRIu32 ";", sqlitePageSizeOverride)));
       }
 
       // We have to set the auto_vacuum mode before opening a transaction.
-      IDB_TRY((MOZ_TO_RESULT_INVOKE(
-                   connection, ExecuteSimpleSQL,
+      QM_TRY((MOZ_TO_RESULT_INVOKE(
+                  connection, ExecuteSimpleSQL,
 #ifdef IDB_MOBILE
-                   // Turn on full auto_vacuum mode to reclaim disk space on
-                   // mobile devices (at the cost of some COMMIT speed).
-                   "PRAGMA auto_vacuum = FULL;"_ns
+                  // Turn on full auto_vacuum mode to reclaim disk space on
+                  // mobile devices (at the cost of some COMMIT speed).
+                  "PRAGMA auto_vacuum = FULL;"_ns
 #else
-                   // Turn on incremental auto_vacuum mode on desktop builds.
-                   "PRAGMA auto_vacuum = INCREMENTAL;"_ns
-#endif
-                   )
-                   .mapErr(mapNoDeviceSpaceError)));
-
-      IDB_TRY(SetJournalMode(*connection));
+                  // Turn on incremental auto_vacuum mode on desktop builds.
+                  "PRAGMA auto_vacuum = INCREMENTAL;"_ns
+#endif
+                  )
+                  .mapErr(mapNoDeviceSpaceError)));
+
+      QM_TRY(SetJournalMode(*connection));
 
       journalModeSet = true;
     } else {
 #ifdef DEBUG
       // Disable foreign key support while upgrading. This has to be done before
       // starting a transaction.
       MOZ_ALWAYS_SUCCEEDS(
           connection->ExecuteSimpleSQL("PRAGMA foreign_keys = OFF;"_ns));
 #endif
     }
 
     bool vacuumNeeded = false;
 
     mozStorageTransaction transaction(
         connection.get(), false, mozIStorageConnection::TRANSACTION_IMMEDIATE);
 
-    IDB_TRY(transaction.Start());
+    QM_TRY(transaction.Start());
 
     if (newDatabase) {
-      IDB_TRY(CreateTables(*connection));
+      QM_TRY(CreateTables(*connection));
 
 #ifdef DEBUG
       {
-        IDB_TRY_INSPECT(const int32_t& schemaVersion,
-                        MOZ_TO_RESULT_INVOKE(connection, GetSchemaVersion),
-                        QM_ASSERT_UNREACHABLE);
+        QM_TRY_INSPECT(const int32_t& schemaVersion,
+                       MOZ_TO_RESULT_INVOKE(connection, GetSchemaVersion),
+                       QM_ASSERT_UNREACHABLE);
         MOZ_ASSERT(schemaVersion == kSQLiteSchemaVersion);
       }
 #endif
 
       // The parameter names are not used, parameters are bound by index only
       // locally in the same function.
-      IDB_TRY_INSPECT(
+      QM_TRY_INSPECT(
           const auto& stmt,
           MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageStatement>, connection,
                                      CreateStatement,
                                      "INSERT INTO database (name, origin) "
                                      "VALUES (:name, :origin)"_ns));
 
-      IDB_TRY(stmt->BindStringByIndex(0, aName));
-      IDB_TRY(stmt->BindUTF8StringByIndex(1, aOrigin));
-      IDB_TRY(stmt->Execute());
+      QM_TRY(stmt->BindStringByIndex(0, aName));
+      QM_TRY(stmt->BindUTF8StringByIndex(1, aOrigin));
+      QM_TRY(stmt->Execute());
     } else {
-      IDB_TRY_UNWRAP(vacuumNeeded,
-                     MaybeUpgradeSchema(*connection, schemaVersion,
-                                        aFMDirectory, aOrigin));
-    }
-
-    IDB_TRY(MOZ_TO_RESULT_INVOKE(transaction, Commit)
-                .mapErr(mapNoDeviceSpaceError));
+      QM_TRY_UNWRAP(vacuumNeeded, MaybeUpgradeSchema(*connection, schemaVersion,
+                                                     aFMDirectory, aOrigin));
+    }
+
+    QM_TRY(MOZ_TO_RESULT_INVOKE(transaction, Commit)
+               .mapErr(mapNoDeviceSpaceError));
 
 #ifdef DEBUG
     if (!newDatabase) {
       // Re-enable foreign key support after doing a foreign key check.
-      IDB_TRY_INSPECT(const bool& foreignKeyError,
-                      CreateAndExecuteSingleStepStatement<
-                          SingleStepResult::ReturnNullIfNoResult>(
-                          *connection, "PRAGMA foreign_key_check;"_ns),
-                      QM_ASSERT_UNREACHABLE);
+      QM_TRY_INSPECT(const bool& foreignKeyError,
+                     CreateAndExecuteSingleStepStatement<
+                         SingleStepResult::ReturnNullIfNoResult>(
+                         *connection, "PRAGMA foreign_key_check;"_ns),
+                     QM_ASSERT_UNREACHABLE);
 
       MOZ_ASSERT(!foreignKeyError, "Database has inconsisistent foreign keys!");
 
       MOZ_ALWAYS_SUCCEEDS(
           connection->ExecuteSimpleSQL("PRAGMA foreign_keys = OFF;"_ns));
     }
 #endif
 
     if (kSQLitePageSizeOverride && !newDatabase) {
-      IDB_TRY_INSPECT(const auto& stmt,
-                      CreateAndExecuteSingleStepStatement(
-                          *connection, "PRAGMA page_size;"_ns));
-
-      IDB_TRY_INSPECT(const int32_t& pageSize,
-                      MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
+      QM_TRY_INSPECT(const auto& stmt,
+                     CreateAndExecuteSingleStepStatement(
+                         *connection, "PRAGMA page_size;"_ns));
+
+      QM_TRY_INSPECT(const int32_t& pageSize,
+                     MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
       MOZ_ASSERT(pageSize >= 512 && pageSize <= 65536);
 
       if (kSQLitePageSizeOverride != uint32_t(pageSize)) {
         // We must not be in WAL journal mode to change the page size.
-        IDB_TRY(
+        QM_TRY(
             connection->ExecuteSimpleSQL("PRAGMA journal_mode = DELETE;"_ns));
 
-        IDB_TRY_INSPECT(const auto& stmt,
-                        CreateAndExecuteSingleStepStatement(
-                            *connection, "PRAGMA journal_mode;"_ns));
-
-        IDB_TRY_INSPECT(
+        QM_TRY_INSPECT(const auto& stmt,
+                       CreateAndExecuteSingleStepStatement(
+                           *connection, "PRAGMA journal_mode;"_ns));
+
+        QM_TRY_INSPECT(
             const auto& journalMode,
             MOZ_TO_RESULT_INVOKE_TYPED(nsCString, *stmt, GetUTF8String, 0));
 
         if (journalMode.EqualsLiteral("delete")) {
           // Successfully set to rollback journal mode so changing the page size
           // is possible with a VACUUM.
-          IDB_TRY(connection->ExecuteSimpleSQL(nsPrintfCString(
+          QM_TRY(connection->ExecuteSimpleSQL(nsPrintfCString(
               "PRAGMA page_size = %" PRIu32 ";", kSQLitePageSizeOverride)));
 
           // We will need to VACUUM in order to change the page size.
           vacuumNeeded = true;
         } else {
           NS_WARNING(
               "Failed to set journal_mode for database, unable to "
               "change the page size!");
         }
       }
     }
 
     if (vacuumNeeded) {
-      IDB_TRY(connection->ExecuteSimpleSQL("VACUUM;"_ns));
+      QM_TRY(connection->ExecuteSimpleSQL("VACUUM;"_ns));
     }
 
     if (newDatabase || vacuumNeeded) {
       if (journalModeSet) {
         // Make sure we checkpoint to get an accurate file size.
-        IDB_TRY(
-            connection->ExecuteSimpleSQL("PRAGMA wal_checkpoint(FULL);"_ns));
-      }
-
-      IDB_TRY_INSPECT(const int64_t& fileSize,
-                      MOZ_TO_RESULT_INVOKE(aDBFile, GetFileSize));
+        QM_TRY(connection->ExecuteSimpleSQL("PRAGMA wal_checkpoint(FULL);"_ns));
+      }
+
+      QM_TRY_INSPECT(const int64_t& fileSize,
+                     MOZ_TO_RESULT_INVOKE(aDBFile, GetFileSize));
       MOZ_ASSERT(fileSize > 0);
 
       PRTime vacuumTime = PR_Now();
       MOZ_ASSERT(vacuumTime);
 
       // The parameter names are not used, parameters are bound by index only
       // locally in the same function.
-      IDB_TRY_INSPECT(
+      QM_TRY_INSPECT(
           const auto& vacuumTimeStmt,
           MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageStatement>, connection,
                                      CreateStatement,
                                      "UPDATE database "
                                      "SET last_vacuum_time = :time"
                                      ", last_vacuum_size = :size;"_ns));
 
-      IDB_TRY(vacuumTimeStmt->BindInt64ByIndex(0, vacuumTime));
-      IDB_TRY(vacuumTimeStmt->BindInt64ByIndex(1, fileSize));
-      IDB_TRY(vacuumTimeStmt->Execute());
+      QM_TRY(vacuumTimeStmt->BindInt64ByIndex(0, vacuumTime));
+      QM_TRY(vacuumTimeStmt->BindInt64ByIndex(1, fileSize));
+      QM_TRY(vacuumTimeStmt->Execute());
     }
   }
 
   if (!journalModeSet) {
-    IDB_TRY(SetJournalMode(*connection));
+    QM_TRY(SetJournalMode(*connection));
   }
 
   return WrapMovingNotNullUnchecked(std::move(connection));
 }
 
 nsCOMPtr<nsIFile> GetFileForPath(const nsAString& aPath) {
   MOZ_ASSERT(!aPath.IsEmpty());
 
-  IDB_TRY_RETURN(QM_NewLocalFile(aPath), nullptr);
+  QM_TRY_RETURN(QM_NewLocalFile(aPath), nullptr);
 }
 
 Result<MovingNotNull<nsCOMPtr<mozIStorageConnection>>, nsresult>
 GetStorageConnection(nsIFile& aDatabaseFile, const int64_t aDirectoryLockId,
                      const uint32_t aTelemetryId,
                      const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aDirectoryLockId >= 0);
 
   AUTO_PROFILER_LABEL("GetStorageConnection", DOM);
 
-  IDB_TRY_INSPECT(const bool& exists,
-                  MOZ_TO_RESULT_INVOKE(aDatabaseFile, Exists));
-
-  IDB_TRY(OkIf(exists), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
-
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(const bool& exists,
+                 MOZ_TO_RESULT_INVOKE(aDatabaseFile, Exists));
+
+  QM_TRY(OkIf(exists), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
+
+  QM_TRY_INSPECT(
       const auto& dbFileUrl,
       GetDatabaseFileURL(aDatabaseFile, aDirectoryLockId, aMaybeKey));
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& storageService,
       ToResultGet<nsCOMPtr<mozIStorageService>>(
           MOZ_SELECT_OVERLOAD(do_GetService), MOZ_STORAGE_SERVICE_CONTRACTID));
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       nsCOMPtr<mozIStorageConnection> connection,
       OpenDatabaseAndHandleBusy(*storageService, *dbFileUrl, aTelemetryId));
 
-  IDB_TRY(SetDefaultPragmas(*connection));
-
-  IDB_TRY(SetJournalMode(*connection));
+  QM_TRY(SetDefaultPragmas(*connection));
+
+  QM_TRY(SetJournalMode(*connection));
 
   return WrapMovingNotNullUnchecked(std::move(connection));
 }
 
 Result<MovingNotNull<nsCOMPtr<mozIStorageConnection>>, nsresult>
 GetStorageConnection(const nsAString& aDatabaseFilePath,
                      const int64_t aDirectoryLockId,
                      const uint32_t aTelemetryId,
@@ -1122,18 +1119,18 @@ GetStorageConnection(const nsAString& aD
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(!aDatabaseFilePath.IsEmpty());
   MOZ_ASSERT(StringEndsWith(aDatabaseFilePath, kSQLiteSuffix));
   MOZ_ASSERT(aDirectoryLockId >= 0);
 
   nsCOMPtr<nsIFile> dbFile = GetFileForPath(aDatabaseFilePath);
 
-  IDB_TRY(OkIf(dbFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(dbFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   return GetStorageConnection(*dbFile, aDirectoryLockId, aTelemetryId,
                               aMaybeKey);
 }
 
 /*******************************************************************************
  * ConnectionPool declarations
  ******************************************************************************/
@@ -5537,18 +5534,18 @@ class EncryptedFileBlobImpl final : publ
     CreateInputStream(getter_AddRefs(inputStream), aRv);
 
     if (aRv.Failed()) {
       return 0;
     }
 
     MOZ_ASSERT(inputStream);
 
-    IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(inputStream, Available), 0,
-                   [&aRv](const nsresult rv) { aRv = rv; });
+    QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(inputStream, Available), 0,
+                  [&aRv](const nsresult rv) { aRv = rv; });
   }
 
   void CreateInputStream(nsIInputStream** aInputStream,
                          ErrorResult& aRv) override {
     nsCOMPtr<nsIInputStream> baseInputStream;
     FileBlobImpl::CreateInputStream(getter_AddRefs(baseInputStream), aRv);
     if (NS_WARN_IF(aRv.Failed())) {
       return;
@@ -5598,40 +5595,40 @@ SerializeStructuredCloneFiles(PBackgroun
   MOZ_ASSERT(aDatabase);
 
   if (aFiles.IsEmpty()) {
     return nsTArray<SerializedStructuredCloneFile>{};
   }
 
   const nsCOMPtr<nsIFile> directory =
       aDatabase->GetFileManager().GetCheckedDirectory();
-  IDB_TRY(OkIf(directory), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(directory), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   nsTArray<SerializedStructuredCloneFile> serializedStructuredCloneFiles;
-  IDB_TRY(OkIf(serializedStructuredCloneFiles.SetCapacity(aFiles.Length(),
-                                                          fallible)),
-          Err(NS_ERROR_OUT_OF_MEMORY));
-
-  IDB_TRY(TransformIfAbortOnErr(
+  QM_TRY(OkIf(serializedStructuredCloneFiles.SetCapacity(aFiles.Length(),
+                                                         fallible)),
+         Err(NS_ERROR_OUT_OF_MEMORY));
+
+  QM_TRY(TransformIfAbortOnErr(
       aFiles, MakeBackInserter(serializedStructuredCloneFiles),
       [aForPreprocess](const auto& file) {
         return !aForPreprocess ||
                file.Type() == StructuredCloneFileBase::eStructuredClone;
       },
       [&directory, &aDatabase, aBackgroundActor, aForPreprocess](
           const auto& file) -> Result<SerializedStructuredCloneFile, nsresult> {
         const int64_t fileId = file.FileInfo().Id();
         MOZ_ASSERT(fileId > 0);
 
         const nsCOMPtr<nsIFile> nativeFile =
             mozilla::dom::indexedDB::FileManager::GetCheckedFileForId(directory,
                                                                       fileId);
-        IDB_TRY(OkIf(nativeFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-                IDB_REPORT_INTERNAL_ERR_LAMBDA);
+        QM_TRY(OkIf(nativeFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+               IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
         switch (file.Type()) {
           case StructuredCloneFileBase::eStructuredClone:
             if (!aForPreprocess) {
               return SerializedStructuredCloneFile{
                   null_t(), StructuredCloneFileBase::eStructuredClone};
             }
 
@@ -5639,35 +5636,35 @@ SerializeStructuredCloneFiles(PBackgroun
 
           case StructuredCloneFileBase::eBlob: {
             const auto impl = CreateFileBlobImpl(*aDatabase, nativeFile,
                                                  file.FileInfo().Id());
 
             IPCBlob ipcBlob;
 
             // This can only fail if the child has crashed.
-            IDB_TRY(IPCBlobUtils::Serialize(impl, aBackgroundActor, ipcBlob),
-                    Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-                    IDB_REPORT_INTERNAL_ERR_LAMBDA);
+            QM_TRY(IPCBlobUtils::Serialize(impl, aBackgroundActor, ipcBlob),
+                   Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+                   IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
             aDatabase->MapBlob(ipcBlob, file.FileInfoPtr());
 
             return SerializedStructuredCloneFile{ipcBlob, file.Type()};
           }
 
           case StructuredCloneFileBase::eMutableFile: {
             if (aDatabase->IsFileHandleDisabled()) {
               return SerializedStructuredCloneFile{
                   null_t(), StructuredCloneFileBase::eMutableFile};
             }
 
             const RefPtr<MutableFile> actor = MutableFile::Create(
                 nativeFile, aDatabase.clonePtr(), file.FileInfoPtr());
-            IDB_TRY(OkIf(actor), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-                    IDB_REPORT_INTERNAL_ERR_LAMBDA);
+            QM_TRY(OkIf(actor), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+                   IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
             // Transfer ownership to IPDL.
             actor->SetActorAlive();
 
             if (!aDatabase->SendPBackgroundMutableFileConstructor(actor, u""_ns,
                                                                   u""_ns)) {
               // This can only fail if the child has crashed.
               IDB_REPORT_INTERNAL_ERR();
@@ -5726,22 +5723,22 @@ auto MakeMaybeIdempotentFilter(const Ide
 // previous deletion call updated the usage.)
 nsresult DeleteFile(nsIFile& aFile, QuotaManager* const aQuotaManager,
                     const PersistenceType aPersistenceType,
                     const OriginMetadata& aOriginMetadata,
                     const Idempotency aIdempotent) {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& fileSize,
       ([aQuotaManager, &aFile,
         aIdempotent]() -> Result<Maybe<int64_t>, nsresult> {
         if (aQuotaManager) {
-          IDB_TRY_INSPECT(
+          QM_TRY_INSPECT(
               const Maybe<int64_t>& fileSize,
               QM_OR_ELSE_WARN(
                   MOZ_TO_RESULT_INVOKE(aFile, GetFileSize)
                       .map([](const int64_t val) { return Some(val); }),
                   MakeMaybeIdempotentFilter<int64_t>(aIdempotent)));
 
           // XXX Can we really assert that the file size is not 0 if
           // it existed? This might be violated by external
@@ -5753,19 +5750,19 @@ nsresult DeleteFile(nsIFile& aFile, Quot
 
         return Some(int64_t(0));
       }()));
 
   if (!fileSize) {
     return NS_OK;
   }
 
-  IDB_TRY_INSPECT(const auto& didExist,
-                  QM_OR_ELSE_WARN(ToResult(aFile.Remove(false)).map(Some<Ok>),
-                                  MakeMaybeIdempotentFilter<Ok>(aIdempotent)));
+  QM_TRY_INSPECT(const auto& didExist,
+                 QM_OR_ELSE_WARN(ToResult(aFile.Remove(false)).map(Some<Ok>),
+                                 MakeMaybeIdempotentFilter<Ok>(aIdempotent)));
 
   if (!didExist) {
     // XXX If we get here, this means that the file still existed when we
     // queried its size, but no longer when we tried to remove it. Not sure if
     // this should really be silently accepted in idempotent mode.
     return NS_OK;
   }
 
@@ -5782,53 +5779,53 @@ nsresult DeleteFile(nsIFile& aFile, Quot
 nsresult DeleteFile(nsIFile& aDirectory, const nsAString& aFilename,
                     QuotaManager* const aQuotaManager,
                     const PersistenceType aPersistenceType,
                     const OriginMetadata& aOriginMetadata,
                     const Idempotency aIdempotent) {
   AssertIsOnIOThread();
   MOZ_ASSERT(!aFilename.IsEmpty());
 
-  IDB_TRY_INSPECT(const auto& file, CloneFileAndAppend(aDirectory, aFilename));
+  QM_TRY_INSPECT(const auto& file, CloneFileAndAppend(aDirectory, aFilename));
 
   return DeleteFile(*file, aQuotaManager, aPersistenceType, aOriginMetadata,
                     aIdempotent);
 }
 
 nsresult DeleteFilesNoQuota(nsIFile* aDirectory, const nsAString& aFilename) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
   MOZ_ASSERT(!aFilename.IsEmpty());
 
   // The current using function hasn't initialized the origin, so in here we
   // don't update the size of origin. Adding this assertion for preventing from
   // misusing.
   DebugOnly<QuotaManager*> quotaManager = QuotaManager::Get();
   MOZ_ASSERT(!quotaManager->IsTemporaryStorageInitialized());
 
-  IDB_TRY_INSPECT(const auto& file, CloneFileAndAppend(*aDirectory, aFilename));
-
-  IDB_TRY_INSPECT(const auto& didExist,
-                  QM_OR_ELSE_WARN(ToResult(file->Remove(true)).map(Some<Ok>),
-                                  IdempotentFilter<Ok>));
+  QM_TRY_INSPECT(const auto& file, CloneFileAndAppend(*aDirectory, aFilename));
+
+  QM_TRY_INSPECT(const auto& didExist,
+                 QM_OR_ELSE_WARN(ToResult(file->Remove(true)).map(Some<Ok>),
+                                 IdempotentFilter<Ok>));
 
   Unused << didExist;
 
   return NS_OK;
 }
 
 // CreateMarkerFile and RemoveMarkerFile are a pair of functions to indicate
 // whether having removed all the files successfully. The marker file should
 // be checked before executing the next operation or initialization.
 Result<nsCOMPtr<nsIFile>, nsresult> CreateMarkerFile(
     nsIFile& aBaseDirectory, const nsAString& aDatabaseNameBase) {
   AssertIsOnIOThread();
   MOZ_ASSERT(!aDatabaseNameBase.IsEmpty());
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& markerFile,
       CloneFileAndAppend(aBaseDirectory,
                          kIdbDeletionMarkerFilePrefix + aDatabaseNameBase));
 
   QM_TRY(QM_OR_ELSE_WARN(
       ToResult(markerFile->Create(nsIFile::NORMAL_FILE_TYPE, 0644)),
       ErrToDefaultOkOrErr<NS_ERROR_FILE_ALREADY_EXISTS>));
 
@@ -5838,32 +5835,32 @@ Result<nsCOMPtr<nsIFile>, nsresult> Crea
 nsresult RemoveMarkerFile(nsIFile* aMarkerFile) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aMarkerFile);
 
   DebugOnly<bool> exists;
   MOZ_ASSERT(NS_SUCCEEDED(aMarkerFile->Exists(&exists)));
   MOZ_ASSERT(exists);
 
-  IDB_TRY(aMarkerFile->Remove(false));
+  QM_TRY(aMarkerFile->Remove(false));
 
   return NS_OK;
 }
 
 Result<Ok, nsresult> DeleteFileManagerDirectory(
     nsIFile& aFileManagerDirectory, QuotaManager* aQuotaManager,
     const PersistenceType aPersistenceType,
     const OriginMetadata& aOriginMetadata) {
   if (!aQuotaManager) {
-    IDB_TRY(aFileManagerDirectory.Remove(true));
+    QM_TRY(aFileManagerDirectory.Remove(true));
 
     return Ok{};
   }
 
-  IDB_TRY_UNWRAP(auto fileUsage, FileManager::GetUsage(&aFileManagerDirectory));
+  QM_TRY_UNWRAP(auto fileUsage, FileManager::GetUsage(&aFileManagerDirectory));
 
   uint64_t usageValue = fileUsage.GetValue().valueOr(0);
 
   auto res = QM_OR_ELSE_WARN(
       MOZ_TO_RESULT_INVOKE(aFileManagerDirectory, Remove, true),
       ([&usageValue, &aFileManagerDirectory](nsresult rv) {
         // We may have deleted some files, try to update quota
         // information before returning the error.
@@ -5907,68 +5904,67 @@ nsresult RemoveDatabaseFilesAndDirectory
                                          const PersistenceType aPersistenceType,
                                          const OriginMetadata& aOriginMetadata,
                                          const nsAString& aDatabaseName) {
   AssertIsOnIOThread();
   MOZ_ASSERT(!aDatabaseFilenameBase.IsEmpty());
 
   AUTO_PROFILER_LABEL("RemoveDatabaseFilesAndDirectory", DOM);
 
-  IDB_TRY_UNWRAP(auto markerFile,
-                 CreateMarkerFile(aBaseDirectory, aDatabaseFilenameBase));
+  QM_TRY_UNWRAP(auto markerFile,
+                CreateMarkerFile(aBaseDirectory, aDatabaseFilenameBase));
 
   // The database file counts towards quota.
-  IDB_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteSuffix,
-                     aQuotaManager, aPersistenceType, aOriginMetadata,
-                     Idempotency::Yes));
+  QM_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteSuffix,
+                    aQuotaManager, aPersistenceType, aOriginMetadata,
+                    Idempotency::Yes));
 
   // .sqlite-journal files don't count towards quota.
-  IDB_TRY(DeleteFile(aBaseDirectory,
-                     aDatabaseFilenameBase + kSQLiteJournalSuffix,
-                     /* doesn't count */ nullptr, aPersistenceType,
-                     aOriginMetadata, Idempotency::Yes));
+  QM_TRY(DeleteFile(aBaseDirectory,
+                    aDatabaseFilenameBase + kSQLiteJournalSuffix,
+                    /* doesn't count */ nullptr, aPersistenceType,
+                    aOriginMetadata, Idempotency::Yes));
 
   // .sqlite-shm files don't count towards quota.
-  IDB_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteSHMSuffix,
-                     /* doesn't count */ nullptr, aPersistenceType,
-                     aOriginMetadata, Idempotency::Yes));
+  QM_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteSHMSuffix,
+                    /* doesn't count */ nullptr, aPersistenceType,
+                    aOriginMetadata, Idempotency::Yes));
 
   // .sqlite-wal files do count towards quota.
-  IDB_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteWALSuffix,
-                     aQuotaManager, aPersistenceType, aOriginMetadata,
-                     Idempotency::Yes));
+  QM_TRY(DeleteFile(aBaseDirectory, aDatabaseFilenameBase + kSQLiteWALSuffix,
+                    aQuotaManager, aPersistenceType, aOriginMetadata,
+                    Idempotency::Yes));
 
   // The files directory counts towards quota.
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& fmDirectory,
       CloneFileAndAppend(aBaseDirectory, aDatabaseFilenameBase +
                                              kFileManagerDirectoryNameSuffix));
 
-  IDB_TRY_INSPECT(const bool& exists,
-                  MOZ_TO_RESULT_INVOKE(fmDirectory, Exists));
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(fmDirectory, Exists));
 
   if (exists) {
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(fmDirectory, IsDirectory));
-
-    IDB_TRY(OkIf(isDirectory), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    IDB_TRY(DeleteFileManagerDirectory(*fmDirectory, aQuotaManager,
-                                       aPersistenceType, aOriginMetadata));
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(fmDirectory, IsDirectory));
+
+    QM_TRY(OkIf(isDirectory), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+    QM_TRY(DeleteFileManagerDirectory(*fmDirectory, aQuotaManager,
+                                      aPersistenceType, aOriginMetadata));
   }
 
   IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
   MOZ_ASSERT_IF(aQuotaManager, mgr);
 
   if (mgr) {
     mgr->InvalidateFileManager(aPersistenceType, aOriginMetadata.mOrigin,
                                aDatabaseName);
   }
 
-  IDB_TRY(RemoveMarkerFile(markerFile));
+  QM_TRY(RemoveMarkerFile(markerFile));
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * Globals
  ******************************************************************************/
 
@@ -6327,29 +6323,29 @@ struct PopulateResponseHelper;
 
 struct CommonPopulateResponseHelper {
   explicit CommonPopulateResponseHelper(
       const TransactionDatabaseOperationBase& aOp)
       : mOp{aOp} {}
 
   nsresult GetKeys(mozIStorageStatement* const aStmt,
                    Key* const aOptOutSortKey) {
-    IDB_TRY(GetCommonKeys(aStmt));
+    QM_TRY(GetCommonKeys(aStmt));
 
     if (aOptOutSortKey) {
       *aOptOutSortKey = mPosition;
     }
 
     return NS_OK;
   }
 
   nsresult GetCommonKeys(mozIStorageStatement* const aStmt) {
     MOZ_ASSERT(mPosition.IsUnset());
 
-    IDB_TRY(mPosition.SetFromStatement(aStmt, 0));
+    QM_TRY(mPosition.SetFromStatement(aStmt, 0));
 
     IDB_LOG_MARK_PARENT_TRANSACTION_REQUEST(
         "PRELOAD: Populating response with key %s", "Populating%.0s",
         IDB_LOG_ID_STRING(mOp.BackgroundChildLoggingId()),
         mOp.TransactionLoggingSerialNumber(), mOp.LoggingSerialNumber(),
         mPosition.GetBuffer().get());
 
     return NS_OK;
@@ -6377,21 +6373,21 @@ struct CommonPopulateResponseHelper {
 struct IndexPopulateResponseHelper : CommonPopulateResponseHelper {
   using CommonPopulateResponseHelper::CommonPopulateResponseHelper;
 
   nsresult GetKeys(mozIStorageStatement* const aStmt,
                    Key* const aOptOutSortKey) {
     MOZ_ASSERT(mLocaleAwarePosition.IsUnset());
     MOZ_ASSERT(mObjectStorePosition.IsUnset());
 
-    IDB_TRY(CommonPopulateResponseHelper::GetCommonKeys(aStmt));
-
-    IDB_TRY(mLocaleAwarePosition.SetFromStatement(aStmt, 1));
-
-    IDB_TRY(mObjectStorePosition.SetFromStatement(aStmt, 2));
+    QM_TRY(CommonPopulateResponseHelper::GetCommonKeys(aStmt));
+
+    QM_TRY(mLocaleAwarePosition.SetFromStatement(aStmt, 1));
+
+    QM_TRY(mObjectStorePosition.SetFromStatement(aStmt, 2));
 
     if (aOptOutSortKey) {
       *aOptOutSortKey =
           mLocaleAwarePosition.IsUnset() ? GetPosition() : mLocaleAwarePosition;
     }
 
     return NS_OK;
   }
@@ -6434,20 +6430,20 @@ struct KeyPopulateResponseHelper {
 };
 
 template <bool StatementHasIndexKeyBindings>
 struct ValuePopulateResponseHelper {
   nsresult MaybeGetCloneInfo(mozIStorageStatement* const aStmt,
                              const ValueCursorBase& aCursor) {
     constexpr auto offset = StatementHasIndexKeyBindings ? 2 : 0;
 
-    IDB_TRY_UNWRAP(auto cloneInfo,
-                   GetStructuredCloneReadInfoFromStatement(
-                       aStmt, 2 + offset, 1 + offset, *aCursor.mFileManager,
-                       aCursor.mDatabase->MaybeKeyRef()));
+    QM_TRY_UNWRAP(auto cloneInfo,
+                  GetStructuredCloneReadInfoFromStatement(
+                      aStmt, 2 + offset, 1 + offset, *aCursor.mFileManager,
+                      aCursor.mDatabase->MaybeKeyRef()));
 
     mCloneInfo.init(std::move(cloneInfo));
 
     if (mCloneInfo->HasPreprocessInfo()) {
       IDB_WARNING("Preprocessing for cursors not yet implemented!");
       return NS_ERROR_NOT_IMPLEMENTED;
     }
 
@@ -6559,17 +6555,17 @@ nsresult DispatchAndReturnFileReferences
     waiting = false;
     lock.Notify();
   };
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   // XXX can't we simply use NS_DISPATCH_SYNC instead of using a monitor?
-  IDB_TRY(quotaManager->IOThread()->Dispatch(
+  QM_TRY(quotaManager->IOThread()->Dispatch(
       NS_NewRunnableFunction("GetFileReferences", std::move(lambda)),
       NS_DISPATCH_NORMAL));
 
   mozilla::MonitorAutoLock autolock(monitor);
   while (waiting) {
     autolock.Wait();
   }
 
@@ -6615,49 +6611,49 @@ class DeserializeIndexValueHelper final 
 
     // The operation will continue on the main-thread.
 
     MOZ_ASSERT(!(mCloneReadInfo.Data().Size() % sizeof(uint64_t)));
 
     MonitorAutoLock lock(mMonitor);
 
     RefPtr<Runnable> self = this;
-    IDB_TRY(SchedulerGroup::Dispatch(TaskCategory::Other, self.forget()));
+    QM_TRY(SchedulerGroup::Dispatch(TaskCategory::Other, self.forget()));
 
     lock.Wait();
     return mStatus;
   }
 
   NS_IMETHOD
   Run() override {
     MOZ_ASSERT(NS_IsMainThread());
 
     AutoJSAPI jsapi;
     jsapi.Init();
     JSContext* const cx = jsapi.cx();
 
     JS::Rooted<JSObject*> global(cx, GetSandbox(cx));
 
-    IDB_TRY(OkIf(global), NS_OK,
-            [this](const NotOk) { OperationCompleted(NS_ERROR_FAILURE); });
+    QM_TRY(OkIf(global), NS_OK,
+           [this](const NotOk) { OperationCompleted(NS_ERROR_FAILURE); });
 
     const JSAutoRealm ar(cx, global);
 
     JS::Rooted<JS::Value> value(cx);
-    IDB_TRY(DeserializeIndexValue(cx, &value), NS_OK,
-            [this](const nsresult rv) { OperationCompleted(rv); });
+    QM_TRY(DeserializeIndexValue(cx, &value), NS_OK,
+           [this](const nsresult rv) { OperationCompleted(rv); });
 
     ErrorResult errorResult;
     IDBObjectStore::AppendIndexUpdateInfo(mIndexID, mKeyPath, mMultiEntry,
                                           mLocale, cx, value, &mUpdateInfoArray,
                                           &errorResult);
-    IDB_TRY(OkIf(!errorResult.Failed()), NS_OK,
-            ([this, &errorResult](const NotOk) {
-              OperationCompleted(errorResult.StealNSResult());
-            }));
+    QM_TRY(OkIf(!errorResult.Failed()), NS_OK,
+           ([this, &errorResult](const NotOk) {
+             OperationCompleted(errorResult.StealNSResult());
+           }));
 
     OperationCompleted(NS_OK);
     return NS_OK;
   }
 
  private:
   nsresult DeserializeIndexValue(JSContext* aCx,
                                  JS::MutableHandle<JS::Value> aValue) {
@@ -6807,17 +6803,17 @@ FileHandleThreadPool* GetFileHandleThrea
 }
 
 nsresult FileManager::AsyncDeleteFile(int64_t aFileId) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!mFileInfos.Contains(aFileId));
 
   QuotaClient* quotaClient = QuotaClient::GetInstance();
   if (quotaClient) {
-    IDB_TRY(quotaClient->AsyncDeleteFile(this, aFileId));
+    QM_TRY(quotaClient->AsyncDeleteFile(this, aFileId));
   }
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * DatabaseConnection implementation
  ******************************************************************************/
@@ -6845,55 +6841,55 @@ DatabaseConnection::~DatabaseConnection(
   MOZ_ASSERT(!mDEBUGSavepointCount);
 }
 
 nsresult DatabaseConnection::Init() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(!mInReadTransaction);
   MOZ_ASSERT(!mInWriteTransaction);
 
-  IDB_TRY(ExecuteCachedStatement("BEGIN;"_ns));
+  QM_TRY(ExecuteCachedStatement("BEGIN;"_ns));
 
   mInReadTransaction = true;
 
   return NS_OK;
 }
 
 nsresult DatabaseConnection::BeginWriteTransaction() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(HasStorageConnection());
   MOZ_ASSERT(mInReadTransaction);
   MOZ_ASSERT(!mInWriteTransaction);
 
   AUTO_PROFILER_LABEL("DatabaseConnection::BeginWriteTransaction", DOM);
 
   // Release our read locks.
-  IDB_TRY(ExecuteCachedStatement("ROLLBACK;"_ns));
+  QM_TRY(ExecuteCachedStatement("ROLLBACK;"_ns));
 
   mInReadTransaction = false;
 
   if (!mUpdateRefcountFunction) {
     MOZ_ASSERT(mFileManager);
 
     RefPtr<UpdateRefcountFunction> function =
         new UpdateRefcountFunction(this, **mFileManager);
 
-    IDB_TRY(MutableStorageConnection().CreateFunction("update_refcount"_ns,
-                                                      /* aNumArguments */ 2,
-                                                      function));
+    QM_TRY(MutableStorageConnection().CreateFunction("update_refcount"_ns,
+                                                     /* aNumArguments */ 2,
+                                                     function));
 
     mUpdateRefcountFunction = std::move(function);
   }
 
   // This one cannot obviously use ExecuteCachedStatement because of the custom
   // error handling for Execute only. If only Execute can produce
   // NS_ERROR_STORAGE_BUSY, we could actually use ExecuteCachedStatement and
   // simplify this.
-  IDB_TRY_INSPECT(const auto& beginStmt,
-                  BorrowCachedStatement("BEGIN IMMEDIATE;"_ns));
+  QM_TRY_INSPECT(const auto& beginStmt,
+                 BorrowCachedStatement("BEGIN IMMEDIATE;"_ns));
 
   QM_TRY(QM_OR_ELSE_WARN(
       ToResult(beginStmt->Execute()), ([&beginStmt](nsresult rv) {
         if (rv == NS_ERROR_STORAGE_BUSY) {
           NS_WARNING(
               "Received NS_ERROR_STORAGE_BUSY when attempting to start write "
               "transaction, retrying for up to 10 seconds");
 
@@ -6923,17 +6919,17 @@ nsresult DatabaseConnection::BeginWriteT
 nsresult DatabaseConnection::CommitWriteTransaction() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(HasStorageConnection());
   MOZ_ASSERT(!mInReadTransaction);
   MOZ_ASSERT(mInWriteTransaction);
 
   AUTO_PROFILER_LABEL("DatabaseConnection::CommitWriteTransaction", DOM);
 
-  IDB_TRY(ExecuteCachedStatement("COMMIT;"_ns));
+  QM_TRY(ExecuteCachedStatement("COMMIT;"_ns));
 
   mInWriteTransaction = false;
   return NS_OK;
 }
 
 void DatabaseConnection::RollbackWriteTransaction() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(!mInReadTransaction);
@@ -6984,17 +6980,17 @@ void DatabaseConnection::FinishWriteTran
 nsresult DatabaseConnection::StartSavepoint() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(HasStorageConnection());
   MOZ_ASSERT(mUpdateRefcountFunction);
   MOZ_ASSERT(mInWriteTransaction);
 
   AUTO_PROFILER_LABEL("DatabaseConnection::StartSavepoint", DOM);
 
-  IDB_TRY(ExecuteCachedStatement(SAVEPOINT_CLAUSE));
+  QM_TRY(ExecuteCachedStatement(SAVEPOINT_CLAUSE));
 
   mUpdateRefcountFunction->StartSavepoint();
 
 #ifdef DEBUG
   MOZ_ASSERT(mDEBUGSavepointCount < UINT32_MAX);
   mDEBUGSavepointCount++;
 #endif
 
@@ -7004,17 +7000,17 @@ nsresult DatabaseConnection::StartSavepo
 nsresult DatabaseConnection::ReleaseSavepoint() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(HasStorageConnection());
   MOZ_ASSERT(mUpdateRefcountFunction);
   MOZ_ASSERT(mInWriteTransaction);
 
   AUTO_PROFILER_LABEL("DatabaseConnection::ReleaseSavepoint", DOM);
 
-  IDB_TRY(ExecuteCachedStatement("RELEASE "_ns SAVEPOINT_CLAUSE));
+  QM_TRY(ExecuteCachedStatement("RELEASE "_ns SAVEPOINT_CLAUSE));
 
   mUpdateRefcountFunction->ReleaseSavepoint();
 
 #ifdef DEBUG
   MOZ_ASSERT(mDEBUGSavepointCount);
   mDEBUGSavepointCount--;
 #endif
 
@@ -7031,18 +7027,18 @@ nsresult DatabaseConnection::RollbackSav
 
 #ifdef DEBUG
   MOZ_ASSERT(mDEBUGSavepointCount);
   mDEBUGSavepointCount--;
 #endif
 
   mUpdateRefcountFunction->RollbackSavepoint();
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  BorrowCachedStatement("ROLLBACK TO "_ns SAVEPOINT_CLAUSE));
+  QM_TRY_INSPECT(const auto& stmt,
+                 BorrowCachedStatement("ROLLBACK TO "_ns SAVEPOINT_CLAUSE));
 
   // This may fail if SQLite already rolled back the savepoint so ignore any
   // errors.
   Unused << stmt->Execute();
 
   return NS_OK;
 }
 
@@ -7075,55 +7071,55 @@ nsresult DatabaseConnection::CheckpointI
       break;
 
     default:
       MOZ_CRASH("Unknown CheckpointMode!");
   }
 
   stmtString.AppendLiteral(");");
 
-  IDB_TRY(ExecuteCachedStatement(stmtString));
+  QM_TRY(ExecuteCachedStatement(stmtString));
 
   return NS_OK;
 }
 
 void DatabaseConnection::DoIdleProcessing(bool aNeedsCheckpoint) {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(mInReadTransaction);
   MOZ_ASSERT(!mInWriteTransaction);
 
   AUTO_PROFILER_LABEL("DatabaseConnection::DoIdleProcessing", DOM);
 
   CachingDatabaseConnection::CachedStatement freelistStmt;
   const uint32_t freelistCount = [this, &freelistStmt] {
-    IDB_TRY_RETURN(GetFreelistCount(freelistStmt), 0u);
+    QM_TRY_RETURN(GetFreelistCount(freelistStmt), 0u);
   }();
 
   CachedStatement rollbackStmt;
   CachedStatement beginStmt;
   if (aNeedsCheckpoint || freelistCount) {
-    IDB_TRY_UNWRAP(rollbackStmt, GetCachedStatement("ROLLBACK;"_ns), QM_VOID);
-    IDB_TRY_UNWRAP(beginStmt, GetCachedStatement("BEGIN;"_ns), QM_VOID);
+    QM_TRY_UNWRAP(rollbackStmt, GetCachedStatement("ROLLBACK;"_ns), QM_VOID);
+    QM_TRY_UNWRAP(beginStmt, GetCachedStatement("BEGIN;"_ns), QM_VOID);
 
     // Release the connection's normal transaction. It's possible that it could
     // fail, but that isn't a problem here.
     Unused << rollbackStmt.Borrow()->Execute();
 
     mInReadTransaction = false;
   }
 
   const bool freedSomePages = freelistCount && [this, &freelistStmt,
                                                 &rollbackStmt, freelistCount,
                                                 aNeedsCheckpoint] {
     // Warn in case of an error, but do not propagate it. Just indicate we
     // didn't free any pages.
-    IDB_TRY_INSPECT(const bool& res,
-                    ReclaimFreePagesWhileIdle(freelistStmt, rollbackStmt,
-                                              freelistCount, aNeedsCheckpoint),
-                    false);
+    QM_TRY_INSPECT(const bool& res,
+                   ReclaimFreePagesWhileIdle(freelistStmt, rollbackStmt,
+                                             freelistCount, aNeedsCheckpoint),
+                   false);
 
     // Make sure we didn't leave a transaction running.
     MOZ_ASSERT(!mInReadTransaction);
     MOZ_ASSERT(!mInWriteTransaction);
 
     return res;
   }();
 
@@ -7162,119 +7158,119 @@ Result<bool, nsresult> DatabaseConnectio
   if (NS_HasPendingEvents(currentThread)) {
     return false;
   }
 
   // Make all the statements we'll need up front.
 
   // Only try to free 10% at a time so that we can bail out if this connection
   // suddenly becomes active or if the thread is needed otherwise.
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& incrementalVacuumStmt,
       GetCachedStatement(
           "PRAGMA incremental_vacuum("_ns +
           IntToCString(std::max(uint64_t(1), uint64_t(aFreelistCount / 10))) +
           ");"_ns));
 
-  IDB_TRY_INSPECT(const auto& beginImmediateStmt,
-                  GetCachedStatement("BEGIN IMMEDIATE;"_ns));
-
-  IDB_TRY_INSPECT(const auto& commitStmt, GetCachedStatement("COMMIT;"_ns));
+  QM_TRY_INSPECT(const auto& beginImmediateStmt,
+                 GetCachedStatement("BEGIN IMMEDIATE;"_ns));
+
+  QM_TRY_INSPECT(const auto& commitStmt, GetCachedStatement("COMMIT;"_ns));
 
   if (aNeedsCheckpoint) {
     // Freeing pages is a journaled operation, so it will require additional WAL
     // space. However, we're idle and are about to checkpoint anyway, so doing a
     // RESTART checkpoint here should allow us to reuse any existing space.
-    IDB_TRY(CheckpointInternal(CheckpointMode::Restart));
+    QM_TRY(CheckpointInternal(CheckpointMode::Restart));
   }
 
   // Start the write transaction.
-  IDB_TRY(beginImmediateStmt.Borrow()->Execute());
+  QM_TRY(beginImmediateStmt.Borrow()->Execute());
 
   mInWriteTransaction = true;
 
   bool freedSomePages = false, interrupted = false;
 
   const auto rollback = [&aRollbackStatement, this](const auto&) {
     MOZ_ASSERT(mInWriteTransaction);
 
     // Something failed, make sure we roll everything back.
     Unused << aRollbackStatement.Borrow()->Execute();
 
     // XXX Is rollback infallible? Shouldn't we check the result?
 
     mInWriteTransaction = false;
   };
 
-  IDB_TRY(CollectWhile(
-              [&aFreelistCount, &interrupted,
-               currentThread]() -> Result<bool, nsresult> {
-                if (NS_HasPendingEvents(currentThread)) {
-                  // Abort if something else wants to use the thread, and
-                  // roll back this transaction. It's ok if we never make
-                  // progress here because the idle service should
-                  // eventually reclaim this space.
-                  interrupted = true;
-                  return false;
-                }
-                return aFreelistCount != 0;
-              },
-              [&aFreelistStatement, &aFreelistCount, &incrementalVacuumStmt,
-               &freedSomePages, this]() -> mozilla::Result<Ok, nsresult> {
-                IDB_TRY(incrementalVacuumStmt.Borrow()->Execute());
-
-                freedSomePages = true;
-
-                IDB_TRY_UNWRAP(aFreelistCount,
-                               GetFreelistCount(aFreelistStatement));
-
-                return Ok{};
-              })
-              .andThen([&commitStmt, &freedSomePages, &interrupted, &rollback,
-                        this](Ok) -> Result<Ok, nsresult> {
-                if (interrupted) {
-                  rollback(Ok{});
-                  freedSomePages = false;
-                }
-
-                if (freedSomePages) {
-                  // Commit the write transaction.
-                  IDB_TRY(commitStmt.Borrow()->Execute(), QM_PROPAGATE,
-                          [](const auto&) { NS_WARNING("Failed to commit!"); });
-
-                  mInWriteTransaction = false;
-                }
-
-                return Ok{};
-              }),
-          QM_PROPAGATE, rollback);
+  QM_TRY(CollectWhile(
+             [&aFreelistCount, &interrupted,
+              currentThread]() -> Result<bool, nsresult> {
+               if (NS_HasPendingEvents(currentThread)) {
+                 // Abort if something else wants to use the thread, and
+                 // roll back this transaction. It's ok if we never make
+                 // progress here because the idle service should
+                 // eventually reclaim this space.
+                 interrupted = true;
+                 return false;
+               }
+               return aFreelistCount != 0;
+             },
+             [&aFreelistStatement, &aFreelistCount, &incrementalVacuumStmt,
+              &freedSomePages, this]() -> mozilla::Result<Ok, nsresult> {
+               QM_TRY(incrementalVacuumStmt.Borrow()->Execute());
+
+               freedSomePages = true;
+
+               QM_TRY_UNWRAP(aFreelistCount,
+                             GetFreelistCount(aFreelistStatement));
+
+               return Ok{};
+             })
+             .andThen([&commitStmt, &freedSomePages, &interrupted, &rollback,
+                       this](Ok) -> Result<Ok, nsresult> {
+               if (interrupted) {
+                 rollback(Ok{});
+                 freedSomePages = false;
+               }
+
+               if (freedSomePages) {
+                 // Commit the write transaction.
+                 QM_TRY(commitStmt.Borrow()->Execute(), QM_PROPAGATE,
+                        [](const auto&) { NS_WARNING("Failed to commit!"); });
+
+                 mInWriteTransaction = false;
+               }
+
+               return Ok{};
+             }),
+         QM_PROPAGATE, rollback);
 
   return freedSomePages;
 }
 
 Result<uint32_t, nsresult> DatabaseConnection::GetFreelistCount(
     CachedStatement& aCachedStatement) {
   AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL("DatabaseConnection::GetFreelistCount", DOM);
 
   if (!aCachedStatement) {
-    IDB_TRY_UNWRAP(aCachedStatement,
-                   GetCachedStatement("PRAGMA freelist_count;"_ns));
+    QM_TRY_UNWRAP(aCachedStatement,
+                  GetCachedStatement("PRAGMA freelist_count;"_ns));
   }
 
   const auto borrowedStatement = aCachedStatement.Borrow();
 
-  IDB_TRY_UNWRAP(const DebugOnly<bool> hasResult,
-                 MOZ_TO_RESULT_INVOKE(&*borrowedStatement, ExecuteStep));
+  QM_TRY_UNWRAP(const DebugOnly<bool> hasResult,
+                MOZ_TO_RESULT_INVOKE(&*borrowedStatement, ExecuteStep));
 
   MOZ_ASSERT(hasResult);
 
-  IDB_TRY_INSPECT(const int32_t& freelistCount,
-                  MOZ_TO_RESULT_INVOKE(*borrowedStatement, GetInt32, 0));
+  QM_TRY_INSPECT(const int32_t& freelistCount,
+                 MOZ_TO_RESULT_INVOKE(*borrowedStatement, GetInt32, 0));
 
   MOZ_ASSERT(freelistCount >= 0);
 
   return uint32_t(freelistCount);
 }
 
 void DatabaseConnection::Close() {
   AssertIsOnConnectionThread();
@@ -7296,17 +7292,17 @@ void DatabaseConnection::Close() {
 
 nsresult DatabaseConnection::DisableQuotaChecks() {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(HasStorageConnection());
 
   if (!mQuotaObject) {
     MOZ_ASSERT(!mJournalQuotaObject);
 
-    IDB_TRY(MutableStorageConnection().GetQuotaObjects(
+    QM_TRY(MutableStorageConnection().GetQuotaObjects(
         getter_AddRefs(mQuotaObject), getter_AddRefs(mJournalQuotaObject)));
 
     MOZ_ASSERT(mQuotaObject);
     MOZ_ASSERT(mJournalQuotaObject);
   }
 
   mQuotaObject->DisableQuotaCheck();
   mJournalQuotaObject->DisableQuotaCheck();
@@ -7327,38 +7323,38 @@ void DatabaseConnection::EnableQuotaChec
   MOZ_ASSERT(mJournalQuotaObject);
 
   const RefPtr<QuotaObject> quotaObject = std::move(mQuotaObject);
   const RefPtr<QuotaObject> journalQuotaObject = std::move(mJournalQuotaObject);
 
   quotaObject->EnableQuotaCheck();
   journalQuotaObject->EnableQuotaCheck();
 
-  IDB_TRY_INSPECT(const int64_t& fileSize, GetFileSize(quotaObject->Path()),
-                  QM_VOID);
-  IDB_TRY_INSPECT(const int64_t& journalFileSize,
-                  GetFileSize(journalQuotaObject->Path()), QM_VOID);
+  QM_TRY_INSPECT(const int64_t& fileSize, GetFileSize(quotaObject->Path()),
+                 QM_VOID);
+  QM_TRY_INSPECT(const int64_t& journalFileSize,
+                 GetFileSize(journalQuotaObject->Path()), QM_VOID);
 
   DebugOnly<bool> result = journalQuotaObject->MaybeUpdateSize(
       journalFileSize, /* aTruncate */ true);
   MOZ_ASSERT(result);
 
   result = quotaObject->MaybeUpdateSize(fileSize, /* aTruncate */ true);
   MOZ_ASSERT(result);
 }
 
 Result<int64_t, nsresult> DatabaseConnection::GetFileSize(
     const nsAString& aPath) {
   MOZ_ASSERT(!aPath.IsEmpty());
 
-  IDB_TRY_INSPECT(const auto& file, QM_NewLocalFile(aPath));
-  IDB_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(file, Exists));
+  QM_TRY_INSPECT(const auto& file, QM_NewLocalFile(aPath));
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(file, Exists));
 
   if (exists) {
-    IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(file, GetFileSize));
+    QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(file, GetFileSize));
   }
 
   return 0;
 }
 
 DatabaseConnection::AutoSavepoint::AutoSavepoint()
     : mConnection(nullptr)
 #ifdef DEBUG
@@ -7404,32 +7400,32 @@ nsresult DatabaseConnection::AutoSavepoi
         "The connection was closed because the previous operation "
         "failed!");
     return NS_ERROR_DOM_INDEXEDDB_ABORT_ERR;
   }
 
   MOZ_ASSERT(!mConnection);
   MOZ_ASSERT(!mDEBUGTransaction);
 
-  IDB_TRY(connection->StartSavepoint());
+  QM_TRY(connection->StartSavepoint());
 
   mConnection = connection;
 #ifdef DEBUG
   mDEBUGTransaction = &aTransaction;
 #endif
 
   return NS_OK;
 }
 
 nsresult DatabaseConnection::AutoSavepoint::Commit() {
   MOZ_ASSERT(mConnection);
   mConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(mDEBUGTransaction);
 
-  IDB_TRY(mConnection->ReleaseSavepoint());
+  QM_TRY(mConnection->ReleaseSavepoint());
 
   mConnection = nullptr;
 #ifdef DEBUG
   mDEBUGTransaction = nullptr;
 #endif
 
   return NS_OK;
 }
@@ -7465,71 +7461,70 @@ nsresult DatabaseConnection::UpdateRefco
        insertStatement =
            LazyStatement{
                *mConnection,
                "INSERT INTO file (id, refcount) VALUES(:id, :delta)"_ns},
        this](int64_t aId, int32_t aDelta) mutable -> Result<Ok, nsresult> {
     AUTO_PROFILER_LABEL(
         "DatabaseConnection::UpdateRefcountFunction::WillCommit::Update", DOM);
     {
-      IDB_TRY_INSPECT(const auto& borrowedUpdateStatement,
-                      updateStatement.Borrow());
-
-      IDB_TRY(borrowedUpdateStatement->BindInt32ByIndex(0, aDelta));
-      IDB_TRY(borrowedUpdateStatement->BindInt64ByIndex(1, aId));
-      IDB_TRY(borrowedUpdateStatement->Execute());
-    }
-
-    IDB_TRY_INSPECT(
-        const int32_t& rows,
-        MOZ_TO_RESULT_INVOKE(mConnection->MutableStorageConnection(),
-                             GetAffectedRows));
+      QM_TRY_INSPECT(const auto& borrowedUpdateStatement,
+                     updateStatement.Borrow());
+
+      QM_TRY(borrowedUpdateStatement->BindInt32ByIndex(0, aDelta));
+      QM_TRY(borrowedUpdateStatement->BindInt64ByIndex(1, aId));
+      QM_TRY(borrowedUpdateStatement->Execute());
+    }
+
+    QM_TRY_INSPECT(const int32_t& rows,
+                   MOZ_TO_RESULT_INVOKE(mConnection->MutableStorageConnection(),
+                                        GetAffectedRows));
 
     if (rows > 0) {
-      IDB_TRY_INSPECT(const bool& hasResult,
-                      selectStatement
-                          .BorrowAndExecuteSingleStep(
-                              [aId](auto& stmt) -> Result<Ok, nsresult> {
-                                IDB_TRY(stmt.BindInt64ByIndex(0, aId));
-                                return Ok{};
-                              })
-                          .map(IsSome));
+      QM_TRY_INSPECT(const bool& hasResult,
+                     selectStatement
+                         .BorrowAndExecuteSingleStep(
+                             [aId](auto& stmt) -> Result<Ok, nsresult> {
+                               QM_TRY(stmt.BindInt64ByIndex(0, aId));
+                               return Ok{};
+                             })
+                         .map(IsSome));
 
       if (!hasResult) {
         // Don't have to create the journal here, we can create all at once,
         // just before commit
         mJournalsToCreateBeforeCommit.AppendElement(aId);
       }
 
       return Ok{};
     }
 
-    IDB_TRY_INSPECT(const auto& borrowedInsertStatement,
-                    insertStatement.Borrow());
-
-    IDB_TRY(borrowedInsertStatement->BindInt64ByIndex(0, aId));
-    IDB_TRY(borrowedInsertStatement->BindInt32ByIndex(1, aDelta));
-    IDB_TRY(borrowedInsertStatement->Execute());
+    QM_TRY_INSPECT(const auto& borrowedInsertStatement,
+                   insertStatement.Borrow());
+
+    QM_TRY(borrowedInsertStatement->BindInt64ByIndex(0, aId));
+    QM_TRY(borrowedInsertStatement->BindInt32ByIndex(1, aDelta));
+    QM_TRY(borrowedInsertStatement->Execute());
 
     mJournalsToRemoveAfterCommit.AppendElement(aId);
 
     return Ok{};
   };
 
-  IDB_TRY(CollectEachInRange(
+  QM_TRY(CollectEachInRange(
       mFileInfoEntries, [&update](const auto& entry) -> Result<Ok, nsresult> {
         const auto delta = entry.GetData()->Delta();
         if (delta) {
-          IDB_TRY(update(entry.GetKey(), delta));
+          QM_TRY(update(entry.GetKey(), delta));
         }
 
         return Ok{};
       }));
 
-  IDB_TRY(CreateJournals());
+  QM_TRY(CreateJournals());
 
   return NS_OK;
 }
 
 void DatabaseConnection::UpdateRefcountFunction::DidCommit() {
   MOZ_ASSERT(mConnection);
   mConnection->AssertIsOnConnectionThread();
 
@@ -7614,28 +7609,28 @@ nsresult DatabaseConnection::UpdateRefco
     mozIStorageValueArray* aValues, int32_t aIndex, UpdateType aUpdateType) {
   MOZ_ASSERT(mConnection);
   mConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(aValues);
 
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::ProcessValue", DOM);
 
-  IDB_TRY_INSPECT(const int32_t& type,
-                  MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, aIndex));
+  QM_TRY_INSPECT(const int32_t& type,
+                 MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, aIndex));
 
   if (type == mozIStorageValueArray::VALUE_TYPE_NULL) {
     return NS_OK;
   }
 
-  IDB_TRY_INSPECT(const auto& ids, MOZ_TO_RESULT_INVOKE_TYPED(
-                                       nsString, aValues, GetString, aIndex));
-
-  IDB_TRY_INSPECT(const auto& files,
-                  DeserializeStructuredCloneFiles(mFileManager, ids));
+  QM_TRY_INSPECT(const auto& ids, MOZ_TO_RESULT_INVOKE_TYPED(
+                                      nsString, aValues, GetString, aIndex));
+
+  QM_TRY_INSPECT(const auto& files,
+                 DeserializeStructuredCloneFiles(mFileManager, ids));
 
   for (const StructuredCloneFileParent& file : files) {
     const int64_t id = file.FileInfo().Id();
     MOZ_ASSERT(id > 0);
 
     const auto entry =
         WrapNotNull(mFileInfoEntries.GetOrInsertNew(id, file.FileInfoPtr()));
 
@@ -7661,46 +7656,46 @@ nsresult DatabaseConnection::UpdateRefco
 nsresult DatabaseConnection::UpdateRefcountFunction::CreateJournals() {
   MOZ_ASSERT(mConnection);
   mConnection->AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::CreateJournals", DOM);
 
   const nsCOMPtr<nsIFile> journalDirectory = mFileManager.GetJournalDirectory();
-  IDB_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
 
   for (const int64_t id : mJournalsToCreateBeforeCommit) {
     const nsCOMPtr<nsIFile> file =
         FileManager::GetFileForId(journalDirectory, id);
-    IDB_TRY(OkIf(file), NS_ERROR_FAILURE);
-
-    IDB_TRY(file->Create(nsIFile::NORMAL_FILE_TYPE, 0644));
+    QM_TRY(OkIf(file), NS_ERROR_FAILURE);
+
+    QM_TRY(file->Create(nsIFile::NORMAL_FILE_TYPE, 0644));
 
     mJournalsToRemoveAfterAbort.AppendElement(id);
   }
 
   return NS_OK;
 }
 
 nsresult DatabaseConnection::UpdateRefcountFunction::RemoveJournals(
     const nsTArray<int64_t>& aJournals) {
   MOZ_ASSERT(mConnection);
   mConnection->AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::RemoveJournals", DOM);
 
   nsCOMPtr<nsIFile> journalDirectory = mFileManager.GetJournalDirectory();
-  IDB_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
 
   for (const auto& journal : aJournals) {
     nsCOMPtr<nsIFile> file =
         FileManager::GetFileForId(journalDirectory, journal);
-    IDB_TRY(OkIf(file), NS_ERROR_FAILURE);
+    QM_TRY(OkIf(file), NS_ERROR_FAILURE);
 
     QM_WARNONLY_TRY(file->Remove(false));
   }
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(DatabaseConnection::UpdateRefcountFunction,
@@ -7712,38 +7707,38 @@ DatabaseConnection::UpdateRefcountFuncti
   MOZ_ASSERT(aValues);
   MOZ_ASSERT(_retval);
 
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::OnFunctionCall", DOM);
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const uint32_t& numEntries,
-                    MOZ_TO_RESULT_INVOKE(aValues, GetNumEntries),
-                    QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const uint32_t& numEntries,
+                   MOZ_TO_RESULT_INVOKE(aValues, GetNumEntries),
+                   QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(numEntries == 2);
 
-    IDB_TRY_INSPECT(const int32_t& type1,
-                    MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 0),
-                    QM_ASSERT_UNREACHABLE);
-
-    IDB_TRY_INSPECT(const int32_t& type2,
-                    MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 1),
-                    QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const int32_t& type1,
+                   MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 0),
+                   QM_ASSERT_UNREACHABLE);
+
+    QM_TRY_INSPECT(const int32_t& type2,
+                   MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 1),
+                   QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(!(type1 == mozIStorageValueArray::VALUE_TYPE_NULL &&
                  type2 == mozIStorageValueArray::VALUE_TYPE_NULL));
   }
 #endif
 
-  IDB_TRY(ProcessValue(aValues, 0, UpdateType::Decrement));
-
-  IDB_TRY(ProcessValue(aValues, 1, UpdateType::Increment));
+  QM_TRY(ProcessValue(aValues, 0, UpdateType::Decrement));
+
+  QM_TRY(ProcessValue(aValues, 1, UpdateType::Increment));
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * ConnectionPool implementation
  ******************************************************************************/
 
@@ -7847,25 +7842,25 @@ ConnectionPool::GetOrCreateConnection(co
   if (dbInfo->mConnection) {
     dbInfo->AssertIsOnConnectionThread();
 
     return dbInfo->mConnection;
   }
 
   MOZ_ASSERT(!dbInfo->mDEBUGConnectionThread);
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       MovingNotNull<nsCOMPtr<mozIStorageConnection>> storageConnection,
       GetStorageConnection(aDatabase.FilePath(), aDatabase.DirectoryLockId(),
                            aDatabase.TelemetryId(), aDatabase.MaybeKeyRef()));
 
   RefPtr<DatabaseConnection> connection = new DatabaseConnection(
       std::move(storageConnection), aDatabase.GetFileManagerPtr());
 
-  IDB_TRY(connection->Init());
+  QM_TRY(connection->Init());
 
   dbInfo->mConnection = connection;
 
   IDB_DEBUG_LOG(("ConnectionPool created connection 0x%p for '%s'",
                  dbInfo->mConnection.get(),
                  NS_ConvertUTF16toUTF8(aDatabase.FilePath()).get()));
 
 #ifdef DEBUG
@@ -9464,21 +9459,20 @@ bool Database::InvalidateAll(const nsTBa
   AssertIsOnBackgroundThread();
 
   const uint32_t count = aTable.Count();
   if (!count) {
     return true;
   }
 
   // XXX Does this really need to be fallible?
-  IDB_TRY_INSPECT(
-      const auto& elementsToInvalidate,
-      TransformIntoNewArray(
-          aTable, [](const auto& entry) { return entry; }, fallible),
-      false);
+  QM_TRY_INSPECT(const auto& elementsToInvalidate,
+                 TransformIntoNewArray(
+                     aTable, [](const auto& entry) { return entry; }, fallible),
+                 false);
 
   IDB_REPORT_INTERNAL_ERR();
 
   for (const auto& elementToInvalidate : elementsToInvalidate) {
     MOZ_ASSERT(elementToInvalidate);
 
     elementToInvalidate->Invalidate();
   }
@@ -9508,17 +9502,17 @@ void Database::Invalidate() {
 
 nsresult Database::EnsureConnection() {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("Database::EnsureConnection", DOM);
 
   if (!mConnection || !mConnection->HasStorageConnection()) {
-    IDB_TRY_UNWRAP(mConnection, gConnectionPool->GetOrCreateConnection(*this));
+    QM_TRY_UNWRAP(mConnection, gConnectionPool->GetOrCreateConnection(*this));
   }
 
   AssertIsOnConnectionThread();
 
   return NS_OK;
 }
 
 bool Database::RegisterTransaction(TransactionBase& aTransaction) {
@@ -9979,17 +9973,17 @@ Database::AllocPBackgroundIDBTransaction
   const ObjectStoreTable& objectStores = mMetadata->mObjectStores;
   const uint32_t nameCount = aObjectStoreNames.Length();
 
   if (NS_WARN_IF(nameCount > objectStores.Count())) {
     ASSERT_UNLESS_FUZZING();
     return nullptr;
   }
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       auto objectStoreMetadatas,
       TransformIntoNewArrayAbortOnErr(
           aObjectStoreNames,
           [lastName = Maybe<const nsString&>{},
            &objectStores](const nsString& name) mutable
           -> mozilla::Result<SafeRefPtr<FullObjectStoreMetadata>, nsresult> {
             if (lastName) {
               // Make sure that this name is sorted properly and not a
@@ -10147,17 +10141,17 @@ nsresult Database::StartTransactionOp::D
   if (Transaction().GetMode() == IDBTransaction::Mode::Cleanup) {
     DebugOnly<nsresult> rv = aConnection->DisableQuotaChecks();
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
                          "DisableQuotaChecks failed, trying to continue "
                          "cleanup transaction with quota checks enabled");
   }
 
   if (Transaction().GetMode() != IDBTransaction::Mode::ReadOnly) {
-    IDB_TRY(aConnection->BeginWriteTransaction());
+    QM_TRY(aConnection->BeginWriteTransaction());
   }
 
   return NS_OK;
 }
 
 nsresult Database::StartTransactionOp::SendSuccessResult() {
   // We don't need to do anything here.
   return NS_OK;
@@ -11990,23 +11984,23 @@ void ValueCursorBase::ProcessFiles(Curso
         default:
           MOZ_CRASH("Should never get here!");
       }
 
       MOZ_ASSERT(serializedInfo);
       MOZ_ASSERT(serializedInfo->files().IsEmpty());
       MOZ_ASSERT(this->mDatabase);
 
-      IDB_TRY_UNWRAP(serializedInfo->files(),
-                     SerializeStructuredCloneFiles((*this->mBackgroundParent),
-                                                   this->mDatabase, files,
-                                                   /* aForPreprocess */ false),
-                     QM_VOID, [&aResponse](const nsresult result) {
-                       aResponse = ClampResultCode(result);
-                     });
+      QM_TRY_UNWRAP(serializedInfo->files(),
+                    SerializeStructuredCloneFiles((*this->mBackgroundParent),
+                                                  this->mDatabase, files,
+                                                  /* aForPreprocess */ false),
+                    QM_VOID, [&aResponse](const nsresult result) {
+                      aResponse = ClampResultCode(result);
+                    });
     }
   }
 }
 
 template <IDBCursorType CursorType>
 void Cursor<CursorType>::SendResponseInternal(
     CursorResponse& aResponse, const FilesArrayT<CursorType>& aFiles) {
   AssertIsOnBackgroundThread();
@@ -12079,26 +12073,26 @@ mozilla::ipc::IPCResult Cursor<CursorTyp
       false
 #else
       this->mIsSameProcessActor
 #endif
       ;
 
   MOZ_ASSERT(!aCurrentKey.IsUnset());
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       auto position,
       ([&]() -> Result<CursorPosition<CursorType>, mozilla::ipc::IPCResult> {
         if constexpr (IsIndexCursor) {
           auto localeAwarePosition = Key{};
           if (this->IsLocaleAware()) {
-            IDB_TRY_UNWRAP(localeAwarePosition,
-                           aCurrentKey.ToLocaleAwareKey(this->mLocale),
-                           Err(IPC_FAIL_NO_REASON(this)),
-                           [](const auto&) { ASSERT_UNLESS_FUZZING(); });
+            QM_TRY_UNWRAP(localeAwarePosition,
+                          aCurrentKey.ToLocaleAwareKey(this->mLocale),
+                          Err(IPC_FAIL_NO_REASON(this)),
+                          [](const auto&) { ASSERT_UNLESS_FUZZING(); });
           }
           return CursorPosition<CursorType>{aCurrentKey, localeAwarePosition,
                                             aCurrentObjectStoreKey};
         } else {
           return CursorPosition<CursorType>{aCurrentKey};
         }
       }()));
 
@@ -12145,56 +12139,56 @@ FileManager::FileManager(PersistenceType
       mEnforcingQuota(aEnforcingQuota) {}
 
 nsresult FileManager::Init(nsIFile* aDirectory,
                            mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
   {
-    IDB_TRY_INSPECT(const bool& existsAsDirectory,
-                    ExistsAsDirectory(*aDirectory));
+    QM_TRY_INSPECT(const bool& existsAsDirectory,
+                   ExistsAsDirectory(*aDirectory));
 
     if (!existsAsDirectory) {
-      IDB_TRY(aDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755));
-    }
-
-    IDB_TRY_UNWRAP(auto path,
-                   MOZ_TO_RESULT_INVOKE_TYPED(nsString, aDirectory, GetPath));
+      QM_TRY(aDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755));
+    }
+
+    QM_TRY_UNWRAP(auto path,
+                  MOZ_TO_RESULT_INVOKE_TYPED(nsString, aDirectory, GetPath));
 
     mDirectoryPath.init(std::move(path));
   }
 
-  IDB_TRY_INSPECT(const auto& journalDirectory,
-                  CloneFileAndAppend(*aDirectory, kJournalDirectoryName));
+  QM_TRY_INSPECT(const auto& journalDirectory,
+                 CloneFileAndAppend(*aDirectory, kJournalDirectoryName));
 
   // We don't care if it doesn't exist at all, but if it does exist, make sure
   // it's a directory.
-  IDB_TRY_INSPECT(const bool& existsAsDirectory,
-                  ExistsAsDirectory(*journalDirectory));
+  QM_TRY_INSPECT(const bool& existsAsDirectory,
+                 ExistsAsDirectory(*journalDirectory));
   Unused << existsAsDirectory;
 
   {
-    IDB_TRY_UNWRAP(auto path, MOZ_TO_RESULT_INVOKE_TYPED(
-                                  nsString, journalDirectory, GetPath));
+    QM_TRY_UNWRAP(auto path, MOZ_TO_RESULT_INVOKE_TYPED(
+                                 nsString, journalDirectory, GetPath));
 
     mJournalDirectoryPath.init(std::move(path));
   }
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  MOZ_TO_RESULT_INVOKE_TYPED(
-                      nsCOMPtr<mozIStorageStatement>, aConnection,
-                      CreateStatement, "SELECT id, refcount FROM file"_ns));
-
-  IDB_TRY(
+  QM_TRY_INSPECT(const auto& stmt,
+                 MOZ_TO_RESULT_INVOKE_TYPED(
+                     nsCOMPtr<mozIStorageStatement>, aConnection,
+                     CreateStatement, "SELECT id, refcount FROM file"_ns));
+
+  QM_TRY(
       CollectWhileHasResult(*stmt, [this](auto& stmt) -> Result<Ok, nsresult> {
-        IDB_TRY_INSPECT(const int64_t& id,
-                        MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 0));
-        IDB_TRY_INSPECT(const int32_t& dbRefCnt,
-                        MOZ_TO_RESULT_INVOKE(stmt, GetInt32, 1));
+        QM_TRY_INSPECT(const int64_t& id,
+                       MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 0));
+        QM_TRY_INSPECT(const int32_t& dbRefCnt,
+                       MOZ_TO_RESULT_INVOKE(stmt, GetInt32, 1));
 
         // We put a raw pointer into the hash table, so the memory refcount will
         // be 0, but the dbRefCnt is non-zero, which will keep the FileInfo
         // object alive.
         MOZ_ASSERT(dbRefCnt > 0);
         mFileInfos.InsertOrUpdate(
             id, MakeNotNull<FileInfo*>(FileManagerGuard{}, SafeRefPtrFromThis(),
                                        id, static_cast<nsrefcnt>(dbRefCnt)));
@@ -12240,40 +12234,40 @@ nsCOMPtr<nsIFile> FileManager::GetJourna
   return GetFileForPath(*mJournalDirectoryPath);
 }
 
 nsCOMPtr<nsIFile> FileManager::EnsureJournalDirectory() {
   // This can happen on the IO or on a transaction thread.
   MOZ_ASSERT(!NS_IsMainThread());
 
   auto journalDirectory = GetFileForPath(*mJournalDirectoryPath);
-  IDB_TRY(OkIf(journalDirectory), nullptr);
-
-  IDB_TRY_INSPECT(const bool& exists,
-                  MOZ_TO_RESULT_INVOKE(journalDirectory, Exists), nullptr);
+  QM_TRY(OkIf(journalDirectory), nullptr);
+
+  QM_TRY_INSPECT(const bool& exists,
+                 MOZ_TO_RESULT_INVOKE(journalDirectory, Exists), nullptr);
 
   if (exists) {
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(journalDirectory, IsDirectory),
-                    nullptr);
-
-    IDB_TRY(OkIf(isDirectory), nullptr);
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(journalDirectory, IsDirectory),
+                   nullptr);
+
+    QM_TRY(OkIf(isDirectory), nullptr);
   } else {
-    IDB_TRY(journalDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755), nullptr);
+    QM_TRY(journalDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755), nullptr);
   }
 
   return journalDirectory;
 }
 
 // static
 nsCOMPtr<nsIFile> FileManager::GetFileForId(nsIFile* aDirectory, int64_t aId) {
   MOZ_ASSERT(aDirectory);
   MOZ_ASSERT(aId > 0);
 
-  IDB_TRY_RETURN(CloneFileAndAppend(*aDirectory, IntToString(aId)), nullptr);
+  QM_TRY_RETURN(CloneFileAndAppend(*aDirectory, IntToString(aId)), nullptr);
 }
 
 // static
 nsCOMPtr<nsIFile> FileManager::GetCheckedFileForId(nsIFile* aDirectory,
                                                    int64_t aId) {
   auto file = GetFileForId(aDirectory, aId);
   if (NS_WARN_IF(!file)) {
     return nullptr;
@@ -12292,154 +12286,154 @@ nsCOMPtr<nsIFile> FileManager::GetChecke
 
 // static
 nsresult FileManager::InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
                                     const nsACString& aOrigin,
                                     uint32_t aTelemetryId) {
   AssertIsOnIOThread();
 
   {
-    IDB_TRY_INSPECT(const bool& exists,
-                    MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
+    QM_TRY_INSPECT(const bool& exists,
+                   MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
 
     if (!exists) {
       return NS_OK;
     }
 
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(aDirectory, IsDirectory));
-    IDB_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
-  }
-
-  IDB_TRY_INSPECT(const auto& journalDirectory,
-                  CloneFileAndAppend(aDirectory, kJournalDirectoryName));
-
-  IDB_TRY_INSPECT(const bool& exists,
-                  MOZ_TO_RESULT_INVOKE(journalDirectory, Exists));
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(aDirectory, IsDirectory));
+    QM_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
+  }
+
+  QM_TRY_INSPECT(const auto& journalDirectory,
+                 CloneFileAndAppend(aDirectory, kJournalDirectoryName));
+
+  QM_TRY_INSPECT(const bool& exists,
+                 MOZ_TO_RESULT_INVOKE(journalDirectory, Exists));
 
   if (exists) {
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(journalDirectory, IsDirectory));
-    IDB_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(journalDirectory, IsDirectory));
+    QM_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
 
     bool hasJournals = false;
 
-    IDB_TRY(CollectEachFile(
+    QM_TRY(CollectEachFile(
         *journalDirectory,
         [&hasJournals](const nsCOMPtr<nsIFile>& file) -> Result<Ok, nsresult> {
-          IDB_TRY_INSPECT(
+          QM_TRY_INSPECT(
               const auto& leafName,
               MOZ_TO_RESULT_INVOKE_TYPED(nsString, file, GetLeafName));
 
           nsresult rv;
           leafName.ToInteger64(&rv);
           if (NS_SUCCEEDED(rv)) {
             hasJournals = true;
           } else {
             UNKNOWN_FILE_WARNING(leafName);
           }
 
           return Ok{};
         }));
 
     if (hasJournals) {
-      IDB_TRY_UNWRAP(const NotNull<nsCOMPtr<mozIStorageConnection>> connection,
-                     CreateStorageConnection(
-                         aDatabaseFile, aDirectory, VoidString(), aOrigin,
-                         /* aDirectoryLockId */ -1, aTelemetryId, Nothing{}));
+      QM_TRY_UNWRAP(const NotNull<nsCOMPtr<mozIStorageConnection>> connection,
+                    CreateStorageConnection(
+                        aDatabaseFile, aDirectory, VoidString(), aOrigin,
+                        /* aDirectoryLockId */ -1, aTelemetryId, Nothing{}));
 
       mozStorageTransaction transaction(connection.get(), false);
 
-      IDB_TRY(transaction.Start())
-
-      IDB_TRY(connection->ExecuteSimpleSQL(
+      QM_TRY(transaction.Start())
+
+      QM_TRY(connection->ExecuteSimpleSQL(
           "CREATE VIRTUAL TABLE fs USING filesystem;"_ns));
 
       // The parameter names are not used, parameters are bound by index only
       // locally in the same function.
-      IDB_TRY_INSPECT(
+      QM_TRY_INSPECT(
           const auto& stmt,
           MOZ_TO_RESULT_INVOKE_TYPED(
               nsCOMPtr<mozIStorageStatement>, *connection, CreateStatement,
               "SELECT name, (name IN (SELECT id FROM file)) FROM fs WHERE path = :path"_ns));
 
-      IDB_TRY_INSPECT(
+      QM_TRY_INSPECT(
           const auto& path,
           MOZ_TO_RESULT_INVOKE_TYPED(nsString, journalDirectory, GetPath));
 
-      IDB_TRY(stmt->BindStringByIndex(0, path));
-
-      IDB_TRY(CollectWhileHasResult(
+      QM_TRY(stmt->BindStringByIndex(0, path));
+
+      QM_TRY(CollectWhileHasResult(
           *stmt,
           [&aDirectory, &journalDirectory](auto& stmt) -> Result<Ok, nsresult> {
             nsString name;
-            IDB_TRY(stmt.GetString(0, name));
+            QM_TRY(stmt.GetString(0, name));
 
             nsresult rv;
             name.ToInteger64(&rv);
             if (NS_FAILED(rv)) {
               return Ok{};
             }
 
             int32_t flag = stmt.AsInt32(1);
 
             if (!flag) {
-              IDB_TRY_INSPECT(const auto& file,
-                              CloneFileAndAppend(aDirectory, name));
+              QM_TRY_INSPECT(const auto& file,
+                             CloneFileAndAppend(aDirectory, name));
 
               if (NS_FAILED(file->Remove(false))) {
                 NS_WARNING("Failed to remove orphaned file!");
               }
             }
 
-            IDB_TRY_INSPECT(const auto& journalFile,
-                            CloneFileAndAppend(*journalDirectory, name));
+            QM_TRY_INSPECT(const auto& journalFile,
+                           CloneFileAndAppend(*journalDirectory, name));
 
             if (NS_FAILED(journalFile->Remove(false))) {
               NS_WARNING("Failed to remove journal file!");
             }
 
             return Ok{};
           }));
 
-      IDB_TRY(connection->ExecuteSimpleSQL("DROP TABLE fs;"_ns));
-      IDB_TRY(transaction.Commit());
+      QM_TRY(connection->ExecuteSimpleSQL("DROP TABLE fs;"_ns));
+      QM_TRY(transaction.Commit());
     }
   }
 
   return NS_OK;
 }
 
 // static
 Result<FileUsageType, nsresult> FileManager::GetUsage(nsIFile* aDirectory) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
-  IDB_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
 
   if (!exists) {
     return FileUsageType{};
   }
 
   FileUsageType usage;
 
-  IDB_TRY(CollectEachFile(
+  QM_TRY(CollectEachFile(
       *aDirectory,
       [&usage](const nsCOMPtr<nsIFile>& file) -> Result<Ok, nsresult> {
-        IDB_TRY_INSPECT(const auto& leafName, MOZ_TO_RESULT_INVOKE_TYPED(
-                                                  nsString, file, GetLeafName));
+        QM_TRY_INSPECT(const auto& leafName,
+                       MOZ_TO_RESULT_INVOKE_TYPED(nsString, file, GetLeafName));
 
         if (leafName.Equals(kJournalDirectoryName)) {
           return Ok{};
         }
 
         nsresult rv;
         leafName.ToInteger64(&rv);
         if (NS_SUCCEEDED(rv)) {
-          IDB_TRY_INSPECT(
+          QM_TRY_INSPECT(
               const auto& thisUsage,
               QM_OR_ELSE_WARN(
                   MOZ_TO_RESULT_INVOKE(file, GetFileSize)
                       .map([](const int64_t fileSize) {
                         return FileUsageType(Some(uint64_t(fileSize)));
                       }),
                   ([](const nsresult rv) -> Result<FileUsageType, nsresult> {
                     if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ||
@@ -12468,39 +12462,39 @@ Result<FileUsageType, nsresult> FileMana
 nsresult FileManager::SyncDeleteFile(const int64_t aId) {
   MOZ_ASSERT(!mFileInfos.Contains(aId));
 
   if (!this->AssertValid()) {
     return NS_ERROR_UNEXPECTED;
   }
 
   const auto directory = GetDirectory();
-  IDB_TRY(OkIf(directory), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(directory), NS_ERROR_FAILURE);
 
   const auto journalDirectory = GetJournalDirectory();
-  IDB_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
 
   const nsCOMPtr<nsIFile> file = GetFileForId(directory, aId);
-  IDB_TRY(OkIf(file), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(file), NS_ERROR_FAILURE);
 
   const nsCOMPtr<nsIFile> journalFile = GetFileForId(journalDirectory, aId);
-  IDB_TRY(OkIf(journalFile), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(journalFile), NS_ERROR_FAILURE);
 
   return SyncDeleteFile(*file, *journalFile);
 }
 
 nsresult FileManager::SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile) {
   QuotaManager* const quotaManager =
       EnforcingQuota() ? QuotaManager::Get() : nullptr;
   MOZ_ASSERT_IF(EnforcingQuota(), quotaManager);
 
-  IDB_TRY(DeleteFile(aFile, quotaManager, Type(), OriginMetadata(),
-                     Idempotency::No));
-
-  IDB_TRY(aJournalFile.Remove(false));
+  QM_TRY(DeleteFile(aFile, quotaManager, Type(), OriginMetadata(),
+                    Idempotency::No));
+
+  QM_TRY(aJournalFile.Remove(false));
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * QuotaClient
  ******************************************************************************/
 
@@ -12544,29 +12538,29 @@ nsresult QuotaClient::AsyncDeleteFile(Fi
     // Fixing this is tracked by bug 1539377.
 
     return NS_OK;
   }
 
   MOZ_ASSERT(mDeleteTimer);
   MOZ_ALWAYS_SUCCEEDS(mDeleteTimer->Cancel());
 
-  IDB_TRY(mDeleteTimer->InitWithNamedFuncCallback(
+  QM_TRY(mDeleteTimer->InitWithNamedFuncCallback(
       DeleteTimerCallback, this, kDeleteTimeoutMs, nsITimer::TYPE_ONE_SHOT,
       "dom::indexeddb::QuotaClient::AsyncDeleteFile"));
 
   mPendingDeleteInfos.GetOrInsertNew(aFileManager)->AppendElement(aFileId);
 
   return NS_OK;
 }
 
 nsresult QuotaClient::FlushPendingFileDeletions() {
   AssertIsOnBackgroundThread();
 
-  IDB_TRY(mDeleteTimer->Cancel());
+  QM_TRY(mDeleteTimer->Cancel());
 
   DeleteTimerCallback(mDeleteTimer, this);
 
   return NS_OK;
 }
 
 nsThreadPool* QuotaClient::GetOrCreateThreadPool() {
   AssertIsOnBackgroundThread();
@@ -12600,116 +12594,116 @@ nsThreadPool* QuotaClient::GetOrCreateTh
 mozilla::dom::quota::Client::Type QuotaClient::GetType() {
   return QuotaClient::IDB;
 }
 
 nsresult QuotaClient::UpgradeStorageFrom1_0To2_0(nsIFile* aDirectory) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
-  IDB_TRY_INSPECT((const auto& [subdirsToProcess, databaseFilenames]),
-                  GetDatabaseFilenames(*aDirectory,
-                                       /* aCanceled */ AtomicBool{false}));
-
-  IDB_TRY(CollectEachInRange(
+  QM_TRY_INSPECT((const auto& [subdirsToProcess, databaseFilenames]),
+                 GetDatabaseFilenames(*aDirectory,
+                                      /* aCanceled */ AtomicBool{false}));
+
+  QM_TRY(CollectEachInRange(
       subdirsToProcess,
       [&databaseFilenames = databaseFilenames,
        aDirectory](const nsString& subdirName) -> Result<Ok, nsresult> {
         // If the directory has the correct suffix then it should exist in
         // databaseFilenames.
         nsDependentSubstring subdirNameBase;
         if (GetFilenameBase(subdirName, kFileManagerDirectoryNameSuffix,
                             subdirNameBase)) {
           QM_WARNONLY_TRY(OkIf(databaseFilenames.Contains(subdirNameBase)));
           return Ok{};
         }
 
         // The directory didn't have the right suffix but we might need to
         // rename it. Check to see if we have a database that references this
         // directory.
-        IDB_TRY_INSPECT(
+        QM_TRY_INSPECT(
             const auto& subdirNameWithSuffix,
             ([&databaseFilenames,
               &subdirName]() -> Result<nsAutoString, NotOk> {
               if (databaseFilenames.Contains(subdirName)) {
                 return nsAutoString{subdirName +
                                     kFileManagerDirectoryNameSuffix};
               }
 
               // Windows doesn't allow a directory to end with a dot ('.'), so
               // we have to check that possibility here too. We do this on all
               // platforms, because the origin directory may have been created
               // on Windows and now accessed on different OS.
               const nsAutoString subdirNameWithDot = subdirName + u"."_ns;
-              IDB_TRY(OkIf(databaseFilenames.Contains(subdirNameWithDot)),
-                      Err(NotOk{}));
+              QM_TRY(OkIf(databaseFilenames.Contains(subdirNameWithDot)),
+                     Err(NotOk{}));
 
               return nsAutoString{subdirNameWithDot +
                                   kFileManagerDirectoryNameSuffix};
             }()),
             Ok{});
 
         // We do have a database that uses this subdir so we should rename it
         // now.
-        IDB_TRY_INSPECT(const auto& subdir,
-                        CloneFileAndAppend(*aDirectory, subdirName));
+        QM_TRY_INSPECT(const auto& subdir,
+                       CloneFileAndAppend(*aDirectory, subdirName));
 
         DebugOnly<bool> isDirectory;
         MOZ_ASSERT(NS_SUCCEEDED(subdir->IsDirectory(&isDirectory)));
         MOZ_ASSERT(isDirectory);
 
         // Check if the subdir with suffix already exists before renaming.
-        IDB_TRY_INSPECT(const auto& subdirWithSuffix,
-                        CloneFileAndAppend(*aDirectory, subdirNameWithSuffix));
-
-        IDB_TRY_INSPECT(const bool& exists,
-                        MOZ_TO_RESULT_INVOKE(subdirWithSuffix, Exists));
+        QM_TRY_INSPECT(const auto& subdirWithSuffix,
+                       CloneFileAndAppend(*aDirectory, subdirNameWithSuffix));
+
+        QM_TRY_INSPECT(const bool& exists,
+                       MOZ_TO_RESULT_INVOKE(subdirWithSuffix, Exists));
 
         if (exists) {
           IDB_WARNING("Deleting old %s files directory!",
                       NS_ConvertUTF16toUTF8(subdirName).get());
 
-          IDB_TRY(subdir->Remove(/* aRecursive */ true));
+          QM_TRY(subdir->Remove(/* aRecursive */ true));
 
           return Ok{};
         }
 
         // Finally, rename the subdir.
-        IDB_TRY(subdir->RenameTo(nullptr, subdirNameWithSuffix));
+        QM_TRY(subdir->RenameTo(nullptr, subdirNameWithSuffix));
 
         return Ok{};
       }));
 
   return NS_OK;
 }
 
 nsresult QuotaClient::UpgradeStorageFrom2_1To2_2(nsIFile* aDirectory) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
-  IDB_TRY(CollectEachFile(
+  QM_TRY(CollectEachFile(
       *aDirectory, [](const nsCOMPtr<nsIFile>& file) -> Result<Ok, nsresult> {
-        IDB_TRY_INSPECT(const auto& dirEntryKind, GetDirEntryKind(*file));
+        QM_TRY_INSPECT(const auto& dirEntryKind, GetDirEntryKind(*file));
 
         switch (dirEntryKind) {
           case nsIFileKind::ExistsAsDirectory:
             break;
 
           case nsIFileKind::ExistsAsFile: {
-            IDB_TRY_INSPECT(
+            QM_TRY_INSPECT(
                 const auto& leafName,
                 MOZ_TO_RESULT_INVOKE_TYPED(nsString, file, GetLeafName));
 
             // It's reported that files ending with ".tmp" somehow live in the
             // indexedDB directories in Bug 1503883. Such files shouldn't exist
             // in the indexedDB directory so remove them in this upgrade.
             if (StringEndsWith(leafName, u".tmp"_ns)) {
               IDB_WARNING("Deleting unknown temporary file!");
 
-              IDB_TRY(file->Remove(false));
+              QM_TRY(file->Remove(false));
             }
 
             break;
           }
 
           case nsIFileKind::DoesNotExist:
             // Ignore files that got removed externally while iterating.
             break;
@@ -12721,95 +12715,94 @@ nsresult QuotaClient::UpgradeStorageFrom
   return NS_OK;
 }
 
 Result<UsageInfo, nsresult> QuotaClient::InitOrigin(
     PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
     const AtomicBool& aCanceled) {
   AssertIsOnIOThread();
 
-  IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(this, GetUsageForOriginInternal,
-                                      aPersistenceType, aOriginMetadata,
-                                      aCanceled,
-                                      /* aInitializing*/ true));
+  QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(this, GetUsageForOriginInternal,
+                                     aPersistenceType, aOriginMetadata,
+                                     aCanceled,
+                                     /* aInitializing*/ true));
 }
 
 nsresult QuotaClient::InitOriginWithoutTracking(
     PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
     const AtomicBool& aCanceled) {
   AssertIsOnIOThread();
 
   return GetUsageForOriginInternal(aPersistenceType, aOriginMetadata, aCanceled,
                                    /* aInitializing*/ true, nullptr);
 }
 
 Result<UsageInfo, nsresult> QuotaClient::GetUsageForOrigin(
     PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
     const AtomicBool& aCanceled) {
   AssertIsOnIOThread();
 
-  IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(this, GetUsageForOriginInternal,
-                                      aPersistenceType, aOriginMetadata,
-                                      aCanceled,
-                                      /* aInitializing*/ false));
+  QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(this, GetUsageForOriginInternal,
+                                     aPersistenceType, aOriginMetadata,
+                                     aCanceled,
+                                     /* aInitializing*/ false));
 }
 
 nsresult QuotaClient::GetUsageForOriginInternal(
     PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
     const AtomicBool& aCanceled, const bool aInitializing,
     UsageInfo* aUsageInfo) {
   AssertIsOnIOThread();
 
-  IDB_TRY_INSPECT(const nsCOMPtr<nsIFile>& directory,
-                  GetDirectory(aPersistenceType, aOriginMetadata.mOrigin));
+  QM_TRY_INSPECT(const nsCOMPtr<nsIFile>& directory,
+                 GetDirectory(aPersistenceType, aOriginMetadata.mOrigin));
 
   // We need to see if there are any files in the directory already. If they
   // are database files then we need to cleanup stored files (if it's needed)
   // and also get the usage.
 
   // XXX Can we avoid unwrapping into non-const variables here? (Only
   // databaseFilenames is currently modified below)
-  IDB_TRY_UNWRAP(
-      (auto [subdirsToProcess, databaseFilenames, obsoleteFilenames]),
-      GetDatabaseFilenames<ObsoleteFilenamesHandling::Include>(*directory,
-                                                               aCanceled));
+  QM_TRY_UNWRAP((auto [subdirsToProcess, databaseFilenames, obsoleteFilenames]),
+                GetDatabaseFilenames<ObsoleteFilenamesHandling::Include>(
+                    *directory, aCanceled));
 
   if (aInitializing) {
-    IDB_TRY(CollectEachInRange(
+    QM_TRY(CollectEachInRange(
         subdirsToProcess,
         [&directory, &obsoleteFilenames = obsoleteFilenames,
          &databaseFilenames = databaseFilenames, aPersistenceType,
          &aOriginMetadata](const nsString& subdirName) -> Result<Ok, nsresult> {
           // The directory must have the correct suffix.
           nsDependentSubstring subdirNameBase;
-          IDB_TRY(QM_OR_ELSE_WARN(
-                      ([&subdirName, &subdirNameBase] {
-                        IDB_TRY_RETURN(OkIf(GetFilenameBase(
-                            subdirName, kFileManagerDirectoryNameSuffix,
-                            subdirNameBase)));
-                      }()),
-                      ([&directory,
-                        &subdirName](const NotOk) -> Result<Ok, nsresult> {
-                        // If there is an unexpected directory in the idb
-                        // directory, trying to delete at first instead of
-                        // breaking the whole initialization.
-                        IDB_TRY(DeleteFilesNoQuota(directory, subdirName),
-                                Err(NS_ERROR_UNEXPECTED));
-
-                        return Ok{};
-                      })),
-                  Ok{});
+          QM_TRY(QM_OR_ELSE_WARN(
+                     ([&subdirName, &subdirNameBase] {
+                       QM_TRY_RETURN(OkIf(GetFilenameBase(
+                           subdirName, kFileManagerDirectoryNameSuffix,
+                           subdirNameBase)));
+                     }()),
+                     ([&directory,
+                       &subdirName](const NotOk) -> Result<Ok, nsresult> {
+                       // If there is an unexpected directory in the idb
+                       // directory, trying to delete at first instead of
+                       // breaking the whole initialization.
+                       QM_TRY(DeleteFilesNoQuota(directory, subdirName),
+                              Err(NS_ERROR_UNEXPECTED));
+
+                       return Ok{};
+                     })),
+                 Ok{});
 
           if (obsoleteFilenames.Contains(subdirNameBase)) {
             // If this fails, it probably means we are in a serious situation.
             // e.g. Filesystem corruption. Will handle this in bug 1521541.
-            IDB_TRY(RemoveDatabaseFilesAndDirectory(*directory, subdirNameBase,
-                                                    nullptr, aPersistenceType,
-                                                    aOriginMetadata, u""_ns),
-                    Err(NS_ERROR_UNEXPECTED));
+            QM_TRY(RemoveDatabaseFilesAndDirectory(*directory, subdirNameBase,
+                                                   nullptr, aPersistenceType,
+                                                   aOriginMetadata, u""_ns),
+                   Err(NS_ERROR_UNEXPECTED));
 
             databaseFilenames.Remove(subdirNameBase);
             return Ok{};
           }
 
           // The directory base must exist in databaseFilenames.
           // If there is an unexpected directory in the idb directory, trying to
           // delete at first instead of breaking the whole initialization.
@@ -12820,79 +12813,79 @@ nsresult QuotaClient::GetUsageForOriginI
           QM_WARNONLY_TRY(QM_OR_ELSE_WARN(
               OkIf(databaseFilenames.Contains(subdirNameBase))
                   .mapErr([](const NotOk) { return NS_ERROR_FAILURE; }),
               ([&directory,
                 &subdirName](const nsresult) -> Result<Ok, nsresult> {
                 // XXX It seems if we really got here, we can fail the
                 // MOZ_ASSERT(!quotaManager->IsTemporaryStorageInitialized());
                 // assertion in DeleteFilesNoQuota.
-                IDB_TRY(DeleteFilesNoQuota(directory, subdirName),
-                        Err(NS_ERROR_UNEXPECTED));
+                QM_TRY(DeleteFilesNoQuota(directory, subdirName),
+                       Err(NS_ERROR_UNEXPECTED));
 
                 return Ok{};
               })));
 
           return Ok{};
         }));
   }
 
   for (const auto& databaseFilename : databaseFilenames) {
     if (aCanceled) {
       break;
     }
 
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& fmDirectory,
         CloneFileAndAppend(*directory,
                            databaseFilename + kFileManagerDirectoryNameSuffix));
 
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& databaseFile,
         CloneFileAndAppend(*directory, databaseFilename + kSQLiteSuffix));
 
     if (aInitializing) {
-      IDB_TRY(FileManager::InitDirectory(*fmDirectory, *databaseFile,
-                                         aOriginMetadata.mOrigin,
-                                         TelemetryIdForFile(databaseFile)));
+      QM_TRY(FileManager::InitDirectory(*fmDirectory, *databaseFile,
+                                        aOriginMetadata.mOrigin,
+                                        TelemetryIdForFile(databaseFile)));
     }
 
     if (aUsageInfo) {
       {
-        IDB_TRY_INSPECT(const int64_t& fileSize,
-                        MOZ_TO_RESULT_INVOKE(databaseFile, GetFileSize));
+        QM_TRY_INSPECT(const int64_t& fileSize,
+                       MOZ_TO_RESULT_INVOKE(databaseFile, GetFileSize));
 
         MOZ_ASSERT(fileSize >= 0);
 
         *aUsageInfo += DatabaseUsageType(Some(uint64_t(fileSize)));
       }
 
       {
-        IDB_TRY_INSPECT(const auto& walFile,
-                        CloneFileAndAppend(
-                            *directory, databaseFilename + kSQLiteWALSuffix));
+        QM_TRY_INSPECT(const auto& walFile,
+                       CloneFileAndAppend(*directory,
+                                          databaseFilename + kSQLiteWALSuffix));
 
         // QM_OR_ELSE_WARN is not used here since we want to ignore
         // NS_ERROR_FILE_NOT_FOUND/NS_ERROR_FILE_TARGET_DOES_NOT_EXIST
         // completely (the -wal file doesn't have to exist).
-        IDB_TRY_INSPECT(const int64_t& walFileSize,
-                        MOZ_TO_RESULT_INVOKE(walFile, GetFileSize)
-                            .orElse([](const nsresult rv) {
-                              return (rv == NS_ERROR_FILE_NOT_FOUND ||
-                                      rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
-                                         ? Result<int64_t, nsresult>{0}
-                                         : Err(rv);
-                            }));
+        QM_TRY_INSPECT(const int64_t& walFileSize,
+                       MOZ_TO_RESULT_INVOKE(walFile, GetFileSize)
+                           .orElse([](const nsresult rv) {
+                             return (rv == NS_ERROR_FILE_NOT_FOUND ||
+                                     rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
+                                        ? Result<int64_t, nsresult>{0}
+                                        : Err(rv);
+                           }));
         MOZ_ASSERT(walFileSize >= 0);
         *aUsageInfo += DatabaseUsageType(Some(uint64_t(walFileSize)));
       }
 
       {
-        IDB_TRY_INSPECT(const auto& fileUsage,
-                        FileManager::GetUsage(fmDirectory));
+        QM_TRY_INSPECT(const auto& fileUsage,
+                       FileManager::GetUsage(fmDirectory));
 
         *aUsageInfo += fileUsage;
       }
     }
   }
 
   return NS_OK;
 }
@@ -13093,42 +13086,41 @@ void QuotaClient::DeleteTimerCallback(ns
   self->mPendingDeleteInfos.Clear();
 }
 
 Result<nsCOMPtr<nsIFile>, nsresult> QuotaClient::GetDirectory(
     PersistenceType aPersistenceType, const nsACString& aOrigin) {
   QuotaManager* const quotaManager = QuotaManager::Get();
   NS_ASSERTION(quotaManager, "This should never fail!");
 
-  IDB_TRY_INSPECT(const auto& directory, quotaManager->GetDirectoryForOrigin(
-                                             aPersistenceType, aOrigin));
+  QM_TRY_INSPECT(const auto& directory, quotaManager->GetDirectoryForOrigin(
+                                            aPersistenceType, aOrigin));
 
   MOZ_ASSERT(directory);
 
-  IDB_TRY(
-      directory->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
+  QM_TRY(directory->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
 
   return directory;
 }
 
 template <QuotaClient::ObsoleteFilenamesHandling ObsoleteFilenames>
 Result<QuotaClient::GetDatabaseFilenamesResult<ObsoleteFilenames>, nsresult>
 QuotaClient::GetDatabaseFilenames(nsIFile& aDirectory,
                                   const AtomicBool& aCanceled) {
   AssertIsOnIOThread();
 
   GetDatabaseFilenamesResult<ObsoleteFilenames> result;
 
-  IDB_TRY(CollectEachFileAtomicCancelable(
+  QM_TRY(CollectEachFileAtomicCancelable(
       aDirectory, aCanceled,
       [&result](const nsCOMPtr<nsIFile>& file) -> Result<Ok, nsresult> {
-        IDB_TRY_INSPECT(const auto& leafName, MOZ_TO_RESULT_INVOKE_TYPED(
-                                                  nsString, file, GetLeafName));
-
-        IDB_TRY_INSPECT(const auto& dirEntryKind, GetDirEntryKind(*file));
+        QM_TRY_INSPECT(const auto& leafName,
+                       MOZ_TO_RESULT_INVOKE_TYPED(nsString, file, GetLeafName));
+
+        QM_TRY_INSPECT(const auto& dirEntryKind, GetDirEntryKind(*file));
 
         switch (dirEntryKind) {
           case nsIFileKind::ExistsAsDirectory:
             result.subdirsToProcess.AppendElement(leafName);
             break;
 
           case nsIFileKind::ExistsAsFile: {
             if constexpr (ObsoleteFilenames ==
@@ -13304,18 +13296,18 @@ void DeleteFilesRunnable::DirectoryLockA
   mDirectoryLock = aLock;
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   // Must set this before dispatching otherwise we will race with the IO thread
   mState = State_DatabaseWorkOpen;
 
-  IDB_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL), QM_VOID,
-          [this](const nsresult) { Finish(); });
+  QM_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL), QM_VOID,
+         [this](const nsresult) { Finish(); });
 }
 
 void DeleteFilesRunnable::DirectoryLockFailed() {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(mState == State_DirectoryOpenPending);
   MOZ_ASSERT(!mDirectoryLock);
 
   Finish();
@@ -13460,18 +13452,18 @@ nsresult Maintenance::DirectoryOpen() {
     return NS_ERROR_ABORT;
   }
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   mState = State::DirectoryWorkOpen;
 
-  IDB_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL),
-          NS_ERROR_FAILURE);
+  QM_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL),
+         NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
 nsresult Maintenance::DirectoryWork() {
   AssertIsOnIOThread();
   MOZ_ASSERT(mState == State::DirectoryWorkOpen);
 
@@ -13485,49 +13477,49 @@ nsresult Maintenance::DirectoryWork() {
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       IsAborted()) {
     return NS_ERROR_ABORT;
   }
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
-  IDB_TRY(quotaManager->EnsureStorageIsInitialized());
+  QM_TRY(quotaManager->EnsureStorageIsInitialized());
 
   // Since idle maintenance may occur before temporary storage is initialized,
   // make sure it's initialized here (all non-persistent origins need to be
   // cleaned up and quota info needs to be loaded for them).
 
   // Don't fail whole idle maintenance in case of an error, the persistent
   // repository can still
   // be processed.
   const bool initTemporaryStorageFailed = [&quotaManager] {
-    IDB_TRY(quotaManager->EnsureTemporaryStorageIsInitialized(), true);
+    QM_TRY(quotaManager->EnsureTemporaryStorageIsInitialized(), true);
     return false;
   }();
 
   const nsCOMPtr<nsIFile> storageDir =
       GetFileForPath(quotaManager->GetStoragePath());
-  IDB_TRY(OkIf(storageDir), NS_ERROR_FAILURE);
+  QM_TRY(OkIf(storageDir), NS_ERROR_FAILURE);
 
   {
-    IDB_TRY_INSPECT(const bool& exists,
-                    MOZ_TO_RESULT_INVOKE(storageDir, Exists));
+    QM_TRY_INSPECT(const bool& exists,
+                   MOZ_TO_RESULT_INVOKE(storageDir, Exists));
 
     // XXX No warning here?
     if (!exists) {
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
 
   {
-    IDB_TRY_INSPECT(const bool& isDirectory,
-                    MOZ_TO_RESULT_INVOKE(storageDir, IsDirectory));
-
-    IDB_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
+    QM_TRY_INSPECT(const bool& isDirectory,
+                   MOZ_TO_RESULT_INVOKE(storageDir, IsDirectory));
+
+    QM_TRY(OkIf(isDirectory), NS_ERROR_FAILURE);
   }
 
   // There are currently only 3 persistence types, and we want to iterate them
   // in this order:
   static const PersistenceType kPersistenceTypes[] = {
       PERSISTENCE_TYPE_PERSISTENT, PERSISTENCE_TYPE_DEFAULT,
       PERSISTENCE_TYPE_TEMPORARY};
 
@@ -13555,60 +13547,58 @@ nsresult Maintenance::DirectoryWork() {
 
     // XXX persistenceType == PERSISTENCE_TYPE_PERSISTENT shouldn't be a special
     // case...
     const auto persistenceTypeString =
         persistenceType == PERSISTENCE_TYPE_PERSISTENT
             ? "permanent"_ns
             : PersistenceTypeToString(persistenceType);
 
-    IDB_TRY_INSPECT(
-        const auto& persistenceDir,
-        CloneFileAndAppend(*storageDir,
-                           NS_ConvertASCIItoUTF16(persistenceTypeString)));
+    QM_TRY_INSPECT(const auto& persistenceDir,
+                   CloneFileAndAppend(*storageDir, NS_ConvertASCIItoUTF16(
+                                                       persistenceTypeString)));
 
     {
-      IDB_TRY_INSPECT(const bool& exists,
-                      MOZ_TO_RESULT_INVOKE(persistenceDir, Exists));
+      QM_TRY_INSPECT(const bool& exists,
+                     MOZ_TO_RESULT_INVOKE(persistenceDir, Exists));
 
       if (!exists) {
         continue;
       }
 
-      IDB_TRY_INSPECT(const bool& isDirectory,
-                      MOZ_TO_RESULT_INVOKE(persistenceDir, IsDirectory));
+      QM_TRY_INSPECT(const bool& isDirectory,
+                     MOZ_TO_RESULT_INVOKE(persistenceDir, IsDirectory));
 
       if (NS_WARN_IF(!isDirectory)) {
         continue;
       }
     }
 
     // Loop over "<origin>/idb" directories.
-    IDB_TRY(CollectEachFile(
+    QM_TRY(CollectEachFile(
         *persistenceDir,
         [this, &quotaManager, persistent, persistenceType, &idbDirName](
             const nsCOMPtr<nsIFile>& originDir) -> Result<Ok, nsresult> {
           if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
               IsAborted()) {
             return Err(NS_ERROR_ABORT);
           }
 
-          IDB_TRY_INSPECT(const auto& dirEntryKind,
-                          GetDirEntryKind(*originDir));
+          QM_TRY_INSPECT(const auto& dirEntryKind, GetDirEntryKind(*originDir));
 
           switch (dirEntryKind) {
             case nsIFileKind::ExistsAsFile:
               break;
 
             case nsIFileKind::ExistsAsDirectory: {
               // Get the necessary information about the origin
               // (LoadFullOriginMetadataWithRestore also checks if it's a valid
               // origin).
 
-              IDB_TRY_INSPECT(
+              QM_TRY_INSPECT(
                   const auto& metadata,
                   quotaManager->LoadFullOriginMetadataWithRestore(originDir),
                   // Not much we can do here...
                   Ok{});
 
               // Don't do any maintenance for private browsing databases, which
               // are only temporary.
               if (OriginAttributes::IsPrivateBrowsing(metadata.mOrigin)) {
@@ -13617,67 +13607,67 @@ nsresult Maintenance::DirectoryWork() {
 
               if (persistent) {
                 // We have to check that all persistent origins are cleaned up,
                 // but there's no way to do that by one call, we need to
                 // initialize (and possibly clean up) them one by one
                 // (EnsureTemporaryStorageIsInitialized cleans up only
                 // non-persistent origins).
 
-                IDB_TRY_UNWRAP(
+                QM_TRY_UNWRAP(
                     const DebugOnly<bool> created,
                     quotaManager->EnsurePersistentOriginIsInitialized(metadata)
                         .map([](const auto& res) { return res.second; }),
                     // Not much we can do here...
                     Ok{});
 
                 // We found this origin directory by traversing the repository,
                 // so EnsurePersistentOriginIsInitialized shouldn't report that
                 // a new directory has been created.
                 MOZ_ASSERT(!created);
               }
 
-              IDB_TRY_INSPECT(const auto& idbDir,
-                              CloneFileAndAppend(*originDir, idbDirName));
-
-              IDB_TRY_INSPECT(const bool& exists,
-                              MOZ_TO_RESULT_INVOKE(idbDir, Exists));
+              QM_TRY_INSPECT(const auto& idbDir,
+                             CloneFileAndAppend(*originDir, idbDirName));
+
+              QM_TRY_INSPECT(const bool& exists,
+                             MOZ_TO_RESULT_INVOKE(idbDir, Exists));
 
               if (!exists) {
                 return Ok{};
               }
 
-              IDB_TRY_INSPECT(const bool& isDirectory,
-                              MOZ_TO_RESULT_INVOKE(idbDir, IsDirectory));
-
-              IDB_TRY(OkIf(isDirectory), Ok{});
+              QM_TRY_INSPECT(const bool& isDirectory,
+                             MOZ_TO_RESULT_INVOKE(idbDir, IsDirectory));
+
+              QM_TRY(OkIf(isDirectory), Ok{});
 
               nsTArray<nsString> databasePaths;
 
               // Loop over files in the "idb" directory.
-              IDB_TRY(CollectEachFile(
+              QM_TRY(CollectEachFile(
                   *idbDir,
                   [this, &databasePaths](const nsCOMPtr<nsIFile>& idbDirFile)
                       -> Result<Ok, nsresult> {
                     if (NS_WARN_IF(QuotaClient::
                                        IsShuttingDownOnNonBackgroundThread()) ||
                         IsAborted()) {
                       return Err(NS_ERROR_ABORT);
                     }
 
-                    IDB_TRY_UNWRAP(auto idbFilePath,
-                                   MOZ_TO_RESULT_INVOKE_TYPED(
-                                       nsString, idbDirFile, GetPath));
+                    QM_TRY_UNWRAP(auto idbFilePath,
+                                  MOZ_TO_RESULT_INVOKE_TYPED(
+                                      nsString, idbDirFile, GetPath));
 
                     if (!StringEndsWith(idbFilePath, kSQLiteSuffix)) {
                       return Ok{};
                     }
 
-                    IDB_TRY_INSPECT(const auto& dirEntryKind,
-                                    GetDirEntryKind(*idbDirFile));
+                    QM_TRY_INSPECT(const auto& dirEntryKind,
+                                   GetDirEntryKind(*idbDirFile));
 
                     switch (dirEntryKind) {
                       case nsIFileKind::ExistsAsDirectory:
                         break;
 
                       case nsIFileKind::ExistsAsFile:
                         // Found a database.
 
@@ -13854,33 +13844,33 @@ Maintenance::Run() {
         MOZ_ALWAYS_SUCCEEDS(mQuotaClient->BackgroundThread()->Dispatch(
             this, NS_DISPATCH_NORMAL));
       }
     }
   };
 
   switch (mState) {
     case State::Initial:
-      IDB_TRY(Start(), NS_OK, handleError);
+      QM_TRY(Start(), NS_OK, handleError);
       break;
 
     case State::CreateIndexedDatabaseManager:
-      IDB_TRY(CreateIndexedDatabaseManager(), NS_OK, handleError);
+      QM_TRY(CreateIndexedDatabaseManager(), NS_OK, handleError);
       break;
 
     case State::IndexedDatabaseManagerOpen:
-      IDB_TRY(OpenDirectory(), NS_OK, handleError);
+      QM_TRY(OpenDirectory(), NS_OK, handleError);
       break;
 
     case State::DirectoryWorkOpen:
-      IDB_TRY(DirectoryWork(), NS_OK, handleError);
+      QM_TRY(DirectoryWork(), NS_OK, handleError);
       break;
 
     case State::BeginDatabaseMaintenance:
-      IDB_TRY(BeginDatabaseMaintenance(), NS_OK, handleError);
+      QM_TRY(BeginDatabaseMaintenance(), NS_OK, handleError);
       break;
 
     case State::Finishing:
       Finish();
       break;
 
     default:
       MOZ_CRASH("Bad state!");
@@ -13963,17 +13953,17 @@ void DatabaseMaintenance::PerformMainten
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       mMaintenance->IsAborted()) {
     return;
   }
 
   const nsCOMPtr<nsIFile> databaseFile = GetFileForPath(mDatabasePath);
   MOZ_ASSERT(databaseFile);
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       const NotNull<nsCOMPtr<mozIStorageConnection>> connection,
       GetStorageConnection(*databaseFile, mDirectoryLockId,
                            TelemetryIdForFile(databaseFile), mMaybeKey),
       QM_VOID);
 
   AutoClose autoClose(connection);
 
   AutoProgressHandler progressHandler(mMaintenance);
@@ -14027,50 +14017,50 @@ nsresult DatabaseMaintenance::CheckInteg
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       mMaintenance->IsAborted()) {
     return NS_ERROR_ABORT;
   }
 
   // First do a full integrity_check. Scope statements tightly here because
   // later operations require zero live statements.
   {
-    IDB_TRY_INSPECT(const auto& stmt,
-                    CreateAndExecuteSingleStepStatement(
-                        aConnection, "PRAGMA integrity_check(1);"_ns));
-
-    IDB_TRY_INSPECT(const auto& result,
-                    MOZ_TO_RESULT_INVOKE_TYPED(nsString, *stmt, GetString, 0));
-
-    IDB_TRY(OkIf(result.EqualsLiteral("ok")), NS_OK,
-            [&aOk](const auto) { *aOk = false; });
+    QM_TRY_INSPECT(const auto& stmt,
+                   CreateAndExecuteSingleStepStatement(
+                       aConnection, "PRAGMA integrity_check(1);"_ns));
+
+    QM_TRY_INSPECT(const auto& result,
+                   MOZ_TO_RESULT_INVOKE_TYPED(nsString, *stmt, GetString, 0));
+
+    QM_TRY(OkIf(result.EqualsLiteral("ok")), NS_OK,
+           [&aOk](const auto) { *aOk = false; });
   }
 
   // Now enable and check for foreign key constraints.
   {
-    IDB_TRY_INSPECT(const int32_t& foreignKeysWereEnabled,
-                    ([&aConnection]() -> Result<int32_t, nsresult> {
-                      IDB_TRY_INSPECT(
-                          const auto& stmt,
-                          CreateAndExecuteSingleStepStatement(
-                              aConnection, "PRAGMA foreign_keys;"_ns));
-
-                      IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
-                    }()));
+    QM_TRY_INSPECT(const int32_t& foreignKeysWereEnabled,
+                   ([&aConnection]() -> Result<int32_t, nsresult> {
+                     QM_TRY_INSPECT(
+                         const auto& stmt,
+                         CreateAndExecuteSingleStepStatement(
+                             aConnection, "PRAGMA foreign_keys;"_ns));
+
+                     QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
+                   }()));
 
     if (!foreignKeysWereEnabled) {
-      IDB_TRY(aConnection.ExecuteSimpleSQL("PRAGMA foreign_keys = ON;"_ns));
-    }
-
-    IDB_TRY_INSPECT(const bool& foreignKeyError,
-                    CreateAndExecuteSingleStepStatement<
-                        SingleStepResult::ReturnNullIfNoResult>(
-                        aConnection, "PRAGMA foreign_key_check;"_ns));
+      QM_TRY(aConnection.ExecuteSimpleSQL("PRAGMA foreign_keys = ON;"_ns));
+    }
+
+    QM_TRY_INSPECT(const bool& foreignKeyError,
+                   CreateAndExecuteSingleStepStatement<
+                       SingleStepResult::ReturnNullIfNoResult>(
+                       aConnection, "PRAGMA foreign_key_check;"_ns));
 
     if (!foreignKeysWereEnabled) {
-      IDB_TRY(aConnection.ExecuteSimpleSQL("PRAGMA foreign_keys = OFF;"_ns));
+      QM_TRY(aConnection.ExecuteSimpleSQL("PRAGMA foreign_keys = OFF;"_ns));
     }
 
     if (foreignKeyError) {
       *aOk = false;
       return NS_OK;
     }
   }
 
@@ -14086,46 +14076,46 @@ nsresult DatabaseMaintenance::DetermineM
   MOZ_ASSERT(aDatabaseFile);
   MOZ_ASSERT(aMaintenanceAction);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       mMaintenance->IsAborted()) {
     return NS_ERROR_ABORT;
   }
 
-  IDB_TRY_INSPECT(const int32_t& schemaVersion,
-                  MOZ_TO_RESULT_INVOKE(aConnection, GetSchemaVersion));
+  QM_TRY_INSPECT(const int32_t& schemaVersion,
+                 MOZ_TO_RESULT_INVOKE(aConnection, GetSchemaVersion));
 
   // Don't do anything if the schema version is less than 18; before that
   // version no databases had |auto_vacuum == INCREMENTAL| set and we didn't
   // track the values needed for the heuristics below.
   if (schemaVersion < MakeSchemaVersion(18, 0)) {
     *aMaintenanceAction = MaintenanceAction::Nothing;
     return NS_OK;
   }
 
   // This method shouldn't make any permanent changes to the database, so make
   // sure everything gets rolled back when we leave.
   mozStorageTransaction transaction(&aConnection,
                                     /* aCommitOnComplete */ false);
 
-  IDB_TRY(transaction.Start())
+  QM_TRY(transaction.Start())
 
   // Check to see when we last vacuumed this database.
-  IDB_TRY_INSPECT(const auto& stmt,
-                  CreateAndExecuteSingleStepStatement(
-                      aConnection,
-                      "SELECT last_vacuum_time, last_vacuum_size "
-                      "FROM database;"_ns));
-
-  IDB_TRY_INSPECT(const PRTime& lastVacuumTime,
-                  MOZ_TO_RESULT_INVOKE(*stmt, GetInt64, 0));
-
-  IDB_TRY_INSPECT(const int64_t& lastVacuumSize,
-                  MOZ_TO_RESULT_INVOKE(*stmt, GetInt64, 1));
+  QM_TRY_INSPECT(const auto& stmt,
+                 CreateAndExecuteSingleStepStatement(
+                     aConnection,
+                     "SELECT last_vacuum_time, last_vacuum_size "
+                     "FROM database;"_ns));
+
+  QM_TRY_INSPECT(const PRTime& lastVacuumTime,
+                 MOZ_TO_RESULT_INVOKE(*stmt, GetInt64, 0));
+
+  QM_TRY_INSPECT(const int64_t& lastVacuumSize,
+                 MOZ_TO_RESULT_INVOKE(*stmt, GetInt64, 1));
 
   NS_ASSERTION(lastVacuumSize > 0,
                "Thy last vacuum size shall be greater than zero, less than "
                "zero shall thy last vacuum size not be. Zero is right out.");
 
   const PRTime startTime = mMaintenance->StartTime();
 
   // This shouldn't really be possible...
@@ -14139,83 +14129,83 @@ nsresult DatabaseMaintenance::DetermineM
     return NS_OK;
   }
 
   // It has been more than a week since the database was vacuumed, so gather
   // statistics on its usage to see if vacuuming is worthwhile.
 
   // Create a temporary copy of the dbstat table to speed up the queries that
   // come later.
-  IDB_TRY(aConnection.ExecuteSimpleSQL(
+  QM_TRY(aConnection.ExecuteSimpleSQL(
       "CREATE VIRTUAL TABLE __stats__ USING dbstat;"
       "CREATE TEMP TABLE __temp_stats__ AS SELECT * FROM __stats__;"_ns));
 
   {  // Calculate the percentage of the database pages that are not in
      // contiguous order.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stmt,
         CreateAndExecuteSingleStepStatement(
             aConnection,
             "SELECT SUM(__ts1__.pageno != __ts2__.pageno + 1) * 100.0 / "
             "COUNT(*) "
             "FROM __temp_stats__ AS __ts1__, __temp_stats__ AS __ts2__ "
             "WHERE __ts1__.name = __ts2__.name "
             "AND __ts1__.rowid = __ts2__.rowid + 1;"_ns));
 
-    IDB_TRY_INSPECT(const int32_t& percentUnordered,
-                    MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
+    QM_TRY_INSPECT(const int32_t& percentUnordered,
+                   MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
 
     MOZ_ASSERT(percentUnordered >= 0);
     MOZ_ASSERT(percentUnordered <= 100);
 
     if (percentUnordered >= kPercentUnorderedThreshold) {
       *aMaintenanceAction = MaintenanceAction::FullVacuum;
       return NS_OK;
     }
   }
 
   // Don't try a full vacuum if the file hasn't grown by 10%.
-  IDB_TRY_INSPECT(const int64_t& currentFileSize,
-                  MOZ_TO_RESULT_INVOKE(aDatabaseFile, GetFileSize));
+  QM_TRY_INSPECT(const int64_t& currentFileSize,
+                 MOZ_TO_RESULT_INVOKE(aDatabaseFile, GetFileSize));
 
   if (currentFileSize <= lastVacuumSize ||
       (((currentFileSize - lastVacuumSize) * 100 / currentFileSize) <
        kPercentFileSizeGrowthThreshold)) {
     *aMaintenanceAction = MaintenanceAction::IncrementalVacuum;
     return NS_OK;
   }
 
   {  // See if there are any free pages that we can reclaim.
-    IDB_TRY_INSPECT(const auto& stmt,
-                    CreateAndExecuteSingleStepStatement(
-                        aConnection, "PRAGMA freelist_count;"_ns));
-
-    IDB_TRY_INSPECT(const int32_t& freelistCount,
-                    MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
+    QM_TRY_INSPECT(const auto& stmt,
+                   CreateAndExecuteSingleStepStatement(
+                       aConnection, "PRAGMA freelist_count;"_ns));
+
+    QM_TRY_INSPECT(const int32_t& freelistCount,
+                   MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
 
     MOZ_ASSERT(freelistCount >= 0);
 
     // If we have too many free pages then we should try an incremental
     // vacuum. If that causes too much fragmentation then we'll try a full
     // vacuum later.
     if (freelistCount > kMaxFreelistThreshold) {
       *aMaintenanceAction = MaintenanceAction::IncrementalVacuum;
       return NS_OK;
     }
   }
 
   {  // Calculate the percentage of unused bytes on pages in the database.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stmt,
         CreateAndExecuteSingleStepStatement(
             aConnection,
             "SELECT SUM(unused) * 100.0 / SUM(pgsize) FROM __temp_stats__;"_ns));
 
-    IDB_TRY_INSPECT(const int32_t& percentUnused,
-                    MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
+    QM_TRY_INSPECT(const int32_t& percentUnused,
+                   MOZ_TO_RESULT_INVOKE(*stmt, GetInt32, 0));
 
     MOZ_ASSERT(percentUnused >= 0);
     MOZ_ASSERT(percentUnused <= 100);
 
     *aMaintenanceAction = percentUnused >= kPercentUnusedThreshold
                               ? MaintenanceAction::FullVacuum
                               : MaintenanceAction::IncrementalVacuum;
   }
@@ -14246,40 +14236,40 @@ void DatabaseMaintenance::FullVacuum(moz
   MOZ_ASSERT(aDatabaseFile);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       mMaintenance->IsAborted()) {
     return;
   }
 
   QM_WARNONLY_TRY(([&]() -> Result<Ok, nsresult> {
-    IDB_TRY(aConnection.ExecuteSimpleSQL("VACUUM;"_ns));
+    QM_TRY(aConnection.ExecuteSimpleSQL("VACUUM;"_ns));
 
     const PRTime vacuumTime = PR_Now();
     MOZ_ASSERT(vacuumTime > 0);
 
-    IDB_TRY_INSPECT(const int64_t& fileSize,
-                    MOZ_TO_RESULT_INVOKE(aDatabaseFile, GetFileSize));
+    QM_TRY_INSPECT(const int64_t& fileSize,
+                   MOZ_TO_RESULT_INVOKE(aDatabaseFile, GetFileSize));
 
     MOZ_ASSERT(fileSize > 0);
 
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(const auto& stmt, MOZ_TO_RESULT_INVOKE_TYPED(
-                                          nsCOMPtr<mozIStorageStatement>,
-                                          aConnection, CreateStatement,
-                                          "UPDATE database "
-                                          "SET last_vacuum_time = :time"
-                                          ", last_vacuum_size = :size;"_ns));
-
-    IDB_TRY(stmt->BindInt64ByIndex(0, vacuumTime));
-
-    IDB_TRY(stmt->BindInt64ByIndex(1, fileSize));
-
-    IDB_TRY(stmt->Execute());
+    QM_TRY_INSPECT(const auto& stmt, MOZ_TO_RESULT_INVOKE_TYPED(
+                                         nsCOMPtr<mozIStorageStatement>,
+                                         aConnection, CreateStatement,
+                                         "UPDATE database "
+                                         "SET last_vacuum_time = :time"
+                                         ", last_vacuum_size = :size;"_ns));
+
+    QM_TRY(stmt->BindInt64ByIndex(0, vacuumTime));
+
+    QM_TRY(stmt->BindInt64ByIndex(1, fileSize));
+
+    QM_TRY(stmt->Execute());
     return Ok{};
   }()));
 }
 
 void DatabaseMaintenance::RunOnOwningThread() {
   AssertIsOnBackgroundThread();
 
   mDirectoryLock = nullptr;
@@ -14449,51 +14439,51 @@ template <typename KeyTransformation>
 nsresult DatabaseOperationBase::MaybeBindKeyToStatement(
     const Key& aKey, mozIStorageStatement* const aStatement,
     const nsCString& aParameterName,
     const KeyTransformation& aKeyTransformation) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aStatement);
 
   if (!aKey.IsUnset()) {
-    // XXX This case distinction could be avoided if IDB_TRY_INSPECT would also
+    // XXX This case distinction could be avoided if QM_TRY_INSPECT would also
     // work with a function not returning a Result<V, E> but simply a V (which
     // is const Key& here) and then assuming it is always a success. Or the
     // transformation could be changed to return Result<const V&, void> but I
     // don't think that Result supports that at the moment.
     if constexpr (std::is_reference_v<
                       std::invoke_result_t<KeyTransformation, Key>>) {
-      IDB_TRY(
+      QM_TRY(
           aKeyTransformation(aKey).BindToStatement(aStatement, aParameterName));
     } else {
-      IDB_TRY_INSPECT(const auto& transformedKey, aKeyTransformation(aKey));
-      IDB_TRY(transformedKey.BindToStatement(aStatement, aParameterName));
+      QM_TRY_INSPECT(const auto& transformedKey, aKeyTransformation(aKey));
+      QM_TRY(transformedKey.BindToStatement(aStatement, aParameterName));
     }
   }
 
   return NS_OK;
 }
 
 // static
 template <typename KeyTransformation>
 nsresult DatabaseOperationBase::BindTransformedKeyRangeToStatement(
     const SerializedKeyRange& aKeyRange, mozIStorageStatement* const aStatement,
     const KeyTransformation& aKeyTransformation) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aStatement);
 
-  IDB_TRY(MaybeBindKeyToStatement(aKeyRange.lower(), aStatement,
-                                  kStmtParamNameLowerKey, aKeyTransformation));
+  QM_TRY(MaybeBindKeyToStatement(aKeyRange.lower(), aStatement,
+                                 kStmtParamNameLowerKey, aKeyTransformation));
 
   if (aKeyRange.isOnly()) {
     return NS_OK;
   }
 
-  IDB_TRY(MaybeBindKeyToStatement(aKeyRange.upper(), aStatement,
-                                  kStmtParamNameUpperKey, aKeyTransformation));
+  QM_TRY(MaybeBindKeyToStatement(aKeyRange.upper(), aStatement,
+                                 kStmtParamNameUpperKey, aKeyTransformation));
 
   return NS_OK;
 }
 
 // static
 nsresult DatabaseOperationBase::BindKeyRangeToStatement(
     const SerializedKeyRange& aKeyRange,
     mozIStorageStatement* const aStatement) {
@@ -14600,28 +14590,26 @@ nsresult DatabaseOperationBase::InsertIn
           kStmtParamNameObjectDataKey + ", :"_ns + kStmtParamNameObjectStoreId +
           ", :"_ns + kStmtParamNameValueLocale + ");"_ns};
 
   for (uint32_t index = 0; index < count; index++) {
     const IndexDataValue& info = aIndexValues[index];
 
     auto& stmt = info.mUnique ? insertUniqueStmt : insertStmt;
 
-    IDB_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
-
-    IDB_TRY(
-        borrowedStmt->BindInt64ByName(kStmtParamNameIndexId, info.mIndexId));
-    IDB_TRY(
-        info.mPosition.BindToStatement(&*borrowedStmt, kStmtParamNameValue));
-    IDB_TRY(info.mLocaleAwarePosition.BindToStatement(
+    QM_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
+
+    QM_TRY(borrowedStmt->BindInt64ByName(kStmtParamNameIndexId, info.mIndexId));
+    QM_TRY(info.mPosition.BindToStatement(&*borrowedStmt, kStmtParamNameValue));
+    QM_TRY(info.mLocaleAwarePosition.BindToStatement(
         &*borrowedStmt, kStmtParamNameValueLocale));
-    IDB_TRY(borrowedStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
-                                          aObjectStoreId));
-    IDB_TRY(aObjectStoreKey.BindToStatement(&*borrowedStmt,
-                                            kStmtParamNameObjectDataKey));
+    QM_TRY(borrowedStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
+                                         aObjectStoreId));
+    QM_TRY(aObjectStoreKey.BindToStatement(&*borrowedStmt,
+                                           kStmtParamNameObjectDataKey));
 
     QM_TRY(QM_OR_ELSE_WARN(
         ToResult(borrowedStmt->Execute()),
         ([&info, index, &aIndexValues](nsresult rv) -> Result<Ok, nsresult> {
           if (rv == NS_ERROR_STORAGE_CONSTRAINT && info.mUnique) {
             // If we're inserting multiple entries for the same unique
             // index, then we might have failed to insert due to
             // colliding with another entry for the same index in which
@@ -14670,130 +14658,130 @@ nsresult DatabaseOperationBase::DeleteIn
                         kStmtParamNameValue + " AND object_data_key = :"_ns +
                         kStmtParamNameObjectDataKey + ";"_ns};
 
   for (uint32_t index = 0; index < count; index++) {
     const IndexDataValue& indexValue = aIndexValues[index];
 
     auto& stmt = indexValue.mUnique ? deleteUniqueStmt : deleteStmt;
 
-    IDB_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
-
-    IDB_TRY(borrowedStmt->BindInt64ByName(kStmtParamNameIndexId,
-                                          indexValue.mIndexId));
-
-    IDB_TRY(indexValue.mPosition.BindToStatement(&*borrowedStmt,
-                                                 kStmtParamNameValue));
+    QM_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
+
+    QM_TRY(borrowedStmt->BindInt64ByName(kStmtParamNameIndexId,
+                                         indexValue.mIndexId));
+
+    QM_TRY(indexValue.mPosition.BindToStatement(&*borrowedStmt,
+                                                kStmtParamNameValue));
 
     if (!indexValue.mUnique) {
-      IDB_TRY(aObjectStoreKey.BindToStatement(&*borrowedStmt,
-                                              kStmtParamNameObjectDataKey));
-    }
-
-    IDB_TRY(borrowedStmt->Execute());
+      QM_TRY(aObjectStoreKey.BindToStatement(&*borrowedStmt,
+                                             kStmtParamNameObjectDataKey));
+    }
+
+    QM_TRY(borrowedStmt->Execute());
   }
 
   return NS_OK;
 }
 
 // static
 nsresult DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes(
     DatabaseConnection* aConnection, const IndexOrObjectStoreId aObjectStoreId,
     const Maybe<SerializedKeyRange>& aKeyRange) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(aObjectStoreId);
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const bool& hasIndexes,
-                    ObjectStoreHasIndexes(*aConnection, aObjectStoreId),
-                    QM_PROPAGATE, [](const auto&) { MOZ_ASSERT(false); });
+    QM_TRY_INSPECT(const bool& hasIndexes,
+                   ObjectStoreHasIndexes(*aConnection, aObjectStoreId),
+                   QM_PROPAGATE, [](const auto&) { MOZ_ASSERT(false); });
     MOZ_ASSERT(hasIndexes,
                "Don't use this slow method if there are no indexes!");
   }
 #endif
 
   AUTO_PROFILER_LABEL(
       "DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes", DOM);
 
   const bool singleRowOnly = aKeyRange.isSome() && aKeyRange.ref().isOnly();
 
   Key objectStoreKey;
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& selectStmt,
       ([singleRowOnly, &aConnection, &objectStoreKey, &aKeyRange]()
            -> Result<CachingDatabaseConnection::BorrowedStatement, nsresult> {
         if (singleRowOnly) {
-          IDB_TRY_UNWRAP(auto selectStmt,
-                         aConnection->BorrowCachedStatement(
-                             "SELECT index_data_values "
-                             "FROM object_data "
-                             "WHERE object_store_id = :"_ns +
-                             kStmtParamNameObjectStoreId + " AND key = :"_ns +
-                             kStmtParamNameKey + ";"_ns));
+          QM_TRY_UNWRAP(auto selectStmt,
+                        aConnection->BorrowCachedStatement(
+                            "SELECT index_data_values "
+                            "FROM object_data "
+                            "WHERE object_store_id = :"_ns +
+                            kStmtParamNameObjectStoreId + " AND key = :"_ns +
+                            kStmtParamNameKey + ";"_ns));
 
           objectStoreKey = aKeyRange.ref().lower();
 
-          IDB_TRY(
+          QM_TRY(
               objectStoreKey.BindToStatement(&*selectStmt, kStmtParamNameKey));
 
           return selectStmt;
         }
 
         const auto keyRangeClause =
             MaybeGetBindingClauseForKeyRange(aKeyRange, kColumnNameKey);
 
-        IDB_TRY_UNWRAP(
+        QM_TRY_UNWRAP(
             auto selectStmt,
             aConnection->BorrowCachedStatement(
                 "SELECT index_data_values, "_ns + kColumnNameKey +
                 " FROM object_data WHERE object_store_id = :"_ns +
                 kStmtParamNameObjectStoreId + keyRangeClause + ";"_ns));
 
         if (aKeyRange.isSome()) {
-          IDB_TRY(BindKeyRangeToStatement(aKeyRange.ref(), &*selectStmt));
+          QM_TRY(BindKeyRangeToStatement(aKeyRange.ref(), &*selectStmt));
         }
 
         return selectStmt;
       }()));
 
-  IDB_TRY(
+  QM_TRY(
       selectStmt->BindInt64ByName(kStmtParamNameObjectStoreId, aObjectStoreId));
 
   DebugOnly<uint32_t> resultCountDEBUG = 0;
 
-  IDB_TRY(CollectWhileHasResult(
+  QM_TRY(CollectWhileHasResult(
       *selectStmt,
       [singleRowOnly, aObjectStoreId, &objectStoreKey, &aConnection,
        &resultCountDEBUG, indexValues = IndexDataValuesAutoArray{},
        deleteStmt = DatabaseConnection::LazyStatement{
            *aConnection,
            "DELETE FROM object_data "
            "WHERE object_store_id = :"_ns +
                kStmtParamNameObjectStoreId + " AND key = :"_ns +
                kStmtParamNameKey +
                ";"_ns}](auto& selectStmt) mutable -> Result<Ok, nsresult> {
         if (!singleRowOnly) {
-          IDB_TRY(objectStoreKey.SetFromStatement(&selectStmt, 1));
+          QM_TRY(objectStoreKey.SetFromStatement(&selectStmt, 1));
 
           indexValues.ClearAndRetainStorage();
         }
 
-        IDB_TRY(ReadCompressedIndexDataValues(selectStmt, 0, indexValues));
-        IDB_TRY(
+        QM_TRY(ReadCompressedIndexDataValues(selectStmt, 0, indexValues));
+        QM_TRY(
             DeleteIndexDataTableRows(aConnection, objectStoreKey, indexValues));
 
-        IDB_TRY_INSPECT(const auto& borrowedDeleteStmt, deleteStmt.Borrow());
-
-        IDB_TRY(borrowedDeleteStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
-                                                    aObjectStoreId));
-        IDB_TRY(objectStoreKey.BindToStatement(&*borrowedDeleteStmt,
-                                               kStmtParamNameKey));
-        IDB_TRY(borrowedDeleteStmt->Execute());
+        QM_TRY_INSPECT(const auto& borrowedDeleteStmt, deleteStmt.Borrow());
+
+        QM_TRY(borrowedDeleteStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
+                                                   aObjectStoreId));
+        QM_TRY(objectStoreKey.BindToStatement(&*borrowedDeleteStmt,
+                                              kStmtParamNameKey));
+        QM_TRY(borrowedDeleteStmt->Execute());
 
         resultCountDEBUG++;
 
         return Ok{};
       }));
 
   MOZ_ASSERT_IF(singleRowOnly, resultCountDEBUG <= 1);
 
@@ -14805,67 +14793,66 @@ nsresult DatabaseOperationBase::UpdateIn
     DatabaseConnection* aConnection, const IndexOrObjectStoreId aObjectStoreId,
     const Key& aObjectStoreKey, const nsTArray<IndexDataValue>& aIndexValues) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(!aObjectStoreKey.IsUnset());
 
   AUTO_PROFILER_LABEL("DatabaseOperationBase::UpdateIndexValues", DOM);
 
-  IDB_TRY_UNWRAP((auto [indexDataValues, indexDataValuesLength]),
-                 MakeCompressedIndexDataValues(aIndexValues));
+  QM_TRY_UNWRAP((auto [indexDataValues, indexDataValuesLength]),
+                MakeCompressedIndexDataValues(aIndexValues));
 
   MOZ_ASSERT(!indexDataValuesLength == !(indexDataValues.get()));
 
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "UPDATE object_data SET index_data_values = :"_ns +
           kStmtParamNameIndexDataValues + " WHERE object_store_id = :"_ns +
           kStmtParamNameObjectStoreId + " AND key = :"_ns + kStmtParamNameKey +
           ";"_ns,
       [&indexDataValues = indexDataValues,
        indexDataValuesLength = indexDataValuesLength, aObjectStoreId,
        &aObjectStoreKey](
           mozIStorageStatement& updateStmt) -> Result<Ok, nsresult> {
-        IDB_TRY(indexDataValues
-                    ? updateStmt.BindAdoptedBlobByName(
-                          kStmtParamNameIndexDataValues,
-                          indexDataValues.release(), indexDataValuesLength)
-                    : updateStmt.BindNullByName(kStmtParamNameIndexDataValues));
-
-        IDB_TRY(updateStmt.BindInt64ByName(kStmtParamNameObjectStoreId,
-                                           aObjectStoreId));
-
-        IDB_TRY(
-            aObjectStoreKey.BindToStatement(&updateStmt, kStmtParamNameKey));
+        QM_TRY(indexDataValues
+                   ? updateStmt.BindAdoptedBlobByName(
+                         kStmtParamNameIndexDataValues,
+                         indexDataValues.release(), indexDataValuesLength)
+                   : updateStmt.BindNullByName(kStmtParamNameIndexDataValues));
+
+        QM_TRY(updateStmt.BindInt64ByName(kStmtParamNameObjectStoreId,
+                                          aObjectStoreId));
+
+        QM_TRY(aObjectStoreKey.BindToStatement(&updateStmt, kStmtParamNameKey));
 
         return Ok{};
       }));
 
   return NS_OK;
 }
 
 // static
 Result<bool, nsresult> DatabaseOperationBase::ObjectStoreHasIndexes(
     DatabaseConnection& aConnection,
     const IndexOrObjectStoreId aObjectStoreId) {
   aConnection.AssertIsOnConnectionThread();
   MOZ_ASSERT(aObjectStoreId);
 
-  IDB_TRY_RETURN(aConnection
-                     .BorrowAndExecuteSingleStepStatement(
-                         "SELECT id "
-                         "FROM object_store_index "
-                         "WHERE object_store_id = :"_ns +
-                             kStmtParamNameObjectStoreId + kOpenLimit + "1;"_ns,
-                         [aObjectStoreId](auto& stmt) -> Result<Ok, nsresult> {
-                           IDB_TRY(stmt.BindInt64ByName(
-                               kStmtParamNameObjectStoreId, aObjectStoreId));
-                           return Ok{};
-                         })
-                     .map(IsSome));
+  QM_TRY_RETURN(aConnection
+                    .BorrowAndExecuteSingleStepStatement(
+                        "SELECT id "
+                        "FROM object_store_index "
+                        "WHERE object_store_id = :"_ns +
+                            kStmtParamNameObjectStoreId + kOpenLimit + "1;"_ns,
+                        [aObjectStoreId](auto& stmt) -> Result<Ok, nsresult> {
+                          QM_TRY(stmt.BindInt64ByName(
+                              kStmtParamNameObjectStoreId, aObjectStoreId));
+                          return Ok{};
+                        })
+                    .map(IsSome));
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(DatabaseOperationBase, Runnable,
                             mozIStorageProgressHandler)
 
 NS_IMETHODIMP
 DatabaseOperationBase::OnProgress(mozIStorageConnection* aConnection,
                                   bool* _retval) {
@@ -14897,17 +14884,17 @@ DatabaseOperationBase::AutoSetProgressHa
 }
 
 nsresult DatabaseOperationBase::AutoSetProgressHandler::Register(
     mozIStorageConnection& aConnection, DatabaseOperationBase* aDatabaseOp) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aDatabaseOp);
   MOZ_ASSERT(!mConnection);
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       const DebugOnly oldProgressHandler,
       MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageProgressHandler>,
                                  aConnection, SetProgressHandler,
                                  kStorageProgressGranularity, aDatabaseOp));
 
   MOZ_ASSERT(!oldProgressHandler.inspect());
 
   mConnection = SomeRef(aConnection);
@@ -14981,24 +14968,24 @@ already_AddRefed<nsISupports> MutableFil
   AssertIsOnBackgroundThread();
 
   const PersistenceType persistenceType = mDatabase->Type();
   const auto& originMetadata = mDatabase->OriginMetadata();
 
   nsCOMPtr<nsISupports> result;
 
   if (aReadOnly) {
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stream,
         CreateFileInputStream(persistenceType, originMetadata, Client::IDB,
                               mFile, -1, -1, nsIFileInputStream::DEFER_OPEN),
         nullptr);
     result = NS_ISUPPORTS_CAST(nsIFileInputStream*, stream.get());
   } else {
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stream,
         CreateFileStream(persistenceType, originMetadata, Client::IDB, mFile,
                          -1, -1, nsIFileStream::DEFER_OPEN),
         nullptr);
     result = NS_ISUPPORTS_CAST(nsIFileStream*, stream.get());
   }
 
   return result.forget();
@@ -15248,17 +15235,17 @@ nsresult FactoryOp::Open() {
   const RefPtr<ContentParent> contentParent = std::move(mContentParent);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       !OperationMayProceed()) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
-  IDB_TRY_INSPECT(const auto& permission, CheckPermission(contentParent));
+  QM_TRY_INSPECT(const auto& permission, CheckPermission(contentParent));
 
   MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed ||
              permission == PermissionRequestBase::kPermissionDenied ||
              permission == PermissionRequestBase::kPermissionPrompt);
 
   if (permission == PermissionRequestBase::kPermissionDenied) {
     return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
   }
@@ -15359,17 +15346,17 @@ nsresult FactoryOp::RetryCheckPermission
   const RefPtr<ContentParent> contentParent = std::move(mContentParent);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
       !OperationMayProceed()) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
-  IDB_TRY_INSPECT(const auto& permission, CheckPermission(contentParent));
+  QM_TRY_INSPECT(const auto& permission, CheckPermission(contentParent));
 
   MOZ_ASSERT(permission == PermissionRequestBase::kPermissionAllowed ||
              permission == PermissionRequestBase::kPermissionDenied ||
              permission == PermissionRequestBase::kPermissionPrompt);
 
   if (permission == PermissionRequestBase::kPermissionDenied ||
       permission == PermissionRequestBase::kPermissionPrompt) {
     return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
@@ -15423,17 +15410,17 @@ nsresult FactoryOp::DirectoryOpen() {
           }
         }
 
         return false;
       }();
 
   mState = State::DatabaseOpenPending;
   if (!delayed) {
-    IDB_TRY(DatabaseOpen());
+    QM_TRY(DatabaseOpen());
   }
 
   return NS_OK;
 }
 
 nsresult FactoryOp::SendToIOThread() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::DatabaseOpenPending);
@@ -15445,18 +15432,18 @@ nsresult FactoryOp::SendToIOThread() {
   }
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   // Must set this before dispatching otherwise we will race with the IO thread.
   mState = State::DatabaseWorkOpen;
 
-  IDB_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL),
-          NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL),
+         NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   return NS_OK;
 }
 
 void FactoryOp::WaitForTransactions() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::BeginVersionChange ||
              mState == State::WaitingForOtherDatabasesToClose);
@@ -15592,40 +15579,40 @@ FactoryOp::CheckPermission(ContentParent
       mEnforcingQuota = false;
     }
 
     return PermissionRequestBase::kPermissionAllowed;
   }
 
   MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
 
-  IDB_TRY_INSPECT(const auto& principal,
-                  PrincipalInfoToPrincipal(principalInfo));
-
-  IDB_TRY_UNWRAP(auto principalMetadata,
-                 QuotaManager::GetInfoFromPrincipal(principal));
-
-  IDB_TRY_INSPECT(
-      const auto& permission,
-      ([persistenceType, &origin = principalMetadata.mOrigin,
-        &principal = *principal]()
-           -> mozilla::Result<PermissionRequestBase::PermissionValue,
-                              nsresult> {
-        if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
-          if (QuotaManager::IsOriginInternal(origin)) {
-            return PermissionRequestBase::kPermissionAllowed;
-          }
+  QM_TRY_INSPECT(const auto& principal,
+                 PrincipalInfoToPrincipal(principalInfo));
+
+  QM_TRY_UNWRAP(auto principalMetadata,
+                QuotaManager::GetInfoFromPrincipal(principal));
+
+  QM_TRY_INSPECT(const auto& permission,
+                 ([persistenceType, &origin = principalMetadata.mOrigin,
+                   &principal = *principal]()
+                      -> mozilla::Result<PermissionRequestBase::PermissionValue,
+                                         nsresult> {
+                   if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
+                     if (QuotaManager::IsOriginInternal(origin)) {
+                       return PermissionRequestBase::kPermissionAllowed;
+                     }
 #ifdef IDB_MOBILE
-          return Err(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
+                     return Err(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
 #else
-          return PermissionRequestBase::GetCurrentPermission(principal);
-#endif
-        }
-        return PermissionRequestBase::kPermissionAllowed;
-      })());
+                     return PermissionRequestBase::GetCurrentPermission(
+                         principal);
+#endif
+                   }
+                   return PermissionRequestBase::kPermissionAllowed;
+                 })());
 
   if (permission != PermissionRequestBase::kPermissionDenied &&
       State::Initial == mState) {
     mOriginMetadata = {std::move(principalMetadata), persistenceType};
 
     mEnforcingQuota = persistenceType != PERSISTENCE_TYPE_PERSISTENT;
   }
 
@@ -15689,34 +15676,34 @@ nsresult FactoryOp::FinishOpen() {
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
       IsActorDestroyed()) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   if (QuotaManager::Get()) {
-    IDB_TRY(OpenDirectory());
+    QM_TRY(OpenDirectory());
 
     return NS_OK;
   }
 
   mState = State::QuotaManagerPending;
   QuotaManager::GetOrCreate(this);
 
   return NS_OK;
 }
 
 nsresult FactoryOp::QuotaManagerOpen() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::QuotaManagerPending);
 
-  IDB_TRY(OkIf(QuotaManager::Get()), NS_ERROR_FAILURE);
-
-  IDB_TRY(OpenDirectory());
+  QM_TRY(OkIf(QuotaManager::Get()), NS_ERROR_FAILURE);
+
+  QM_TRY(OpenDirectory());
 
   return NS_OK;
 }
 
 nsresult FactoryOp::OpenDirectory() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::FinishOpen ||
              mState == State::QuotaManagerPending);
@@ -15728,32 +15715,32 @@ nsresult FactoryOp::OpenDirectory() {
   const PersistenceType persistenceType =
       mCommonParams.metadata().persistenceType();
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   // Need to get database file path before opening the directory.
   // XXX: For what reason?
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       mDatabaseFilePath,
       ([this, quotaManager,
         persistenceType]() -> mozilla::Result<nsString, nsresult> {
-        IDB_TRY_INSPECT(const auto& dbFile,
-                        quotaManager->GetDirectoryForOrigin(
-                            persistenceType, mOriginMetadata.mOrigin));
-
-        IDB_TRY(
+        QM_TRY_INSPECT(const auto& dbFile,
+                       quotaManager->GetDirectoryForOrigin(
+                           persistenceType, mOriginMetadata.mOrigin));
+
+        QM_TRY(
             dbFile->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
 
-        IDB_TRY(dbFile->Append(
+        QM_TRY(dbFile->Append(
             GetDatabaseFilenameBase(mCommonParams.metadata().name()) +
             kSQLiteSuffix));
 
-        IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
+        QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
       }()));
 
   RefPtr<DirectoryLock> directoryLock = quotaManager->CreateDirectoryLock(
       persistenceType, mOriginMetadata, Client::IDB,
       /* aExclusive */ false);
 
   mState = State::DirectoryOpenPending;
 
@@ -15796,49 +15783,49 @@ FactoryOp::Run() {
         MOZ_ALWAYS_SUCCEEDS(
             mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
       }
     }
   };
 
   switch (mState) {
     case State::Initial:
-      IDB_TRY(Open(), NS_OK, handleError);
+      QM_TRY(Open(), NS_OK, handleError);
       break;
 
     case State::PermissionChallenge:
-      IDB_TRY(ChallengePermission(), NS_OK, handleError);
+      QM_TRY(ChallengePermission(), NS_OK, handleError);
       break;
 
     case State::PermissionRetry:
-      IDB_TRY(RetryCheckPermission(), NS_OK, handleError);
+      QM_TRY(RetryCheckPermission(), NS_OK, handleError);
       break;
 
     case State::FinishOpen:
-      IDB_TRY(FinishOpen(), NS_OK, handleError);
+      QM_TRY(FinishOpen(), NS_OK, handleError);
       break;
 
     case State::QuotaManagerPending:
-      IDB_TRY(QuotaManagerOpen(), NS_OK, handleError);
+      QM_TRY(QuotaManagerOpen(), NS_OK, handleError);
       break;
 
     case State::DatabaseOpenPending:
-      IDB_TRY(DatabaseOpen(), NS_OK, handleError);
+      QM_TRY(DatabaseOpen(), NS_OK, handleError);
       break;
 
     case State::DatabaseWorkOpen:
-      IDB_TRY(DoDatabaseWork(), NS_OK, handleError);
+      QM_TRY(DoDatabaseWork(), NS_OK, handleError);
       break;
 
     case State::BeginVersionChange:
-      IDB_TRY(BeginVersionChange(), NS_OK, handleError);
+      QM_TRY(BeginVersionChange(), NS_OK, handleError);
       break;
 
     case State::WaitingForTransactionsToComplete:
-      IDB_TRY(DispatchToWorkThread(), NS_OK, handleError);
+      QM_TRY(DispatchToWorkThread(), NS_OK, handleError);
       break;
 
     case State::SendingResults:
       SendResults();
       break;
 
     default:
       MOZ_CRASH("Bad state!");
@@ -15853,17 +15840,17 @@ void FactoryOp::DirectoryLockAcquired(Di
   MOZ_ASSERT(mState == State::DirectoryOpenPending);
   MOZ_ASSERT(!mDirectoryLock);
 
   mDirectoryLock = aLock;
 
   MOZ_ASSERT(mDirectoryLock->Id() >= 0);
   mDirectoryLockId = mDirectoryLock->Id();
 
-  IDB_TRY(DirectoryOpen(), QM_VOID, [this](const nsresult rv) {
+  QM_TRY(DirectoryOpen(), QM_VOID, [this](const nsresult rv) {
     SetFailureCodeIfUnset(rv);
 
     // The caller holds a strong reference to us, no need for a self reference
     // before calling Run().
 
     mState = State::SendingResults;
     MOZ_ALWAYS_SUCCEEDS(Run());
   });
@@ -15957,102 +15944,101 @@ nsresult OpenDatabaseOp::DatabaseOpen() 
 }
 
 nsresult OpenDatabaseOp::DoDatabaseWork() {
   AssertIsOnIOThread();
   MOZ_ASSERT(mState == State::DatabaseWorkOpen);
 
   AUTO_PROFILER_LABEL("OpenDatabaseOp::DoDatabaseWork", DOM);
 
-  IDB_TRY(OkIf(!QuotaClient::IsShuttingDownOnNonBackgroundThread()),
-          NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(!QuotaClient::IsShuttingDownOnNonBackgroundThread()),
+         NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   if (!OperationMayProceed()) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   const nsString& databaseName = mCommonParams.metadata().name();
   const PersistenceType persistenceType =
       mCommonParams.metadata().persistenceType();
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
-  IDB_TRY(quotaManager->EnsureStorageIsInitialized());
-
-  IDB_TRY_INSPECT(
+  QM_TRY(quotaManager->EnsureStorageIsInitialized());
+
+  QM_TRY_INSPECT(
       const auto& dbDirectory,
       ([persistenceType, &quotaManager, this]()
            -> mozilla::Result<std::pair<nsCOMPtr<nsIFile>, bool>, nsresult> {
         if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
-          IDB_TRY_RETURN(quotaManager->EnsurePersistentOriginIsInitialized(
+          QM_TRY_RETURN(quotaManager->EnsurePersistentOriginIsInitialized(
               mOriginMetadata));
         }
 
-        IDB_TRY(quotaManager->EnsureTemporaryStorageIsInitialized());
-        IDB_TRY_RETURN(quotaManager->EnsureTemporaryOriginIsInitialized(
+        QM_TRY(quotaManager->EnsureTemporaryStorageIsInitialized());
+        QM_TRY_RETURN(quotaManager->EnsureTemporaryOriginIsInitialized(
             persistenceType, mOriginMetadata));
       }()
                   .map([](const auto& res) { return res.first; })));
 
-  IDB_TRY(
+  QM_TRY(
       dbDirectory->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
 
   {
-    IDB_TRY_INSPECT(const bool& exists,
-                    MOZ_TO_RESULT_INVOKE(dbDirectory, Exists));
+    QM_TRY_INSPECT(const bool& exists,
+                   MOZ_TO_RESULT_INVOKE(dbDirectory, Exists));
 
     if (!exists) {
-      IDB_TRY(dbDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755));
+      QM_TRY(dbDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755));
     }
 #ifdef DEBUG
     else {
       bool isDirectory;
       MOZ_ASSERT(NS_SUCCEEDED(dbDirectory->IsDirectory(&isDirectory)));
       MOZ_ASSERT(isDirectory);
     }
 #endif
   }
 
   const auto databaseFilenameBase = GetDatabaseFilenameBase(databaseName);
 
-  IDB_TRY_INSPECT(
-      const auto& markerFile,
-      CloneFileAndAppend(*dbDirectory,
-                         kIdbDeletionMarkerFilePrefix + databaseFilenameBase));
-
-  IDB_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(markerFile, Exists));
+  QM_TRY_INSPECT(const auto& markerFile,
+                 CloneFileAndAppend(*dbDirectory, kIdbDeletionMarkerFilePrefix +
+                                                      databaseFilenameBase));
+
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(markerFile, Exists));
 
   if (exists) {
     // Delete the database and directroy since they should be deleted in
     // previous operation.
     // Note: only update usage to the QuotaManager when mEnforcingQuota == true
-    IDB_TRY(RemoveDatabaseFilesAndDirectory(
+    QM_TRY(RemoveDatabaseFilesAndDirectory(
         *dbDirectory, databaseFilenameBase,
         mEnforcingQuota ? quotaManager : nullptr, persistenceType,
         mOriginMetadata, databaseName));
   }
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& dbFile,
       CloneFileAndAppend(*dbDirectory, databaseFilenameBase + kSQLiteSuffix));
 
   mTelemetryId = TelemetryIdForFile(dbFile);
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const auto& databaseFilePath,
-                    MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
+    QM_TRY_INSPECT(const auto& databaseFilePath,
+                   MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
 
     MOZ_ASSERT(databaseFilePath == mDatabaseFilePath);
   }
 #endif
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& fmDirectory,
       CloneFileAndAppend(*dbDirectory, databaseFilenameBase +
                                            kFileManagerDirectoryNameSuffix));
 
   Maybe<const CipherKey> maybeKey;
   if (mInPrivateBrowsing) {
     CipherKey key;
 
@@ -16061,60 +16047,60 @@ nsresult OpenDatabaseOp::DoDatabaseWork(
           gPrivateBrowsingInfoHashtable->Lock();
       MOZ_ALWAYS_TRUE(
           lockedPrivateBrowsingInfoHashtable->Get(mDatabaseId, &key));
     }
 
     maybeKey.emplace(std::move(key));
   }
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       NotNull<nsCOMPtr<mozIStorageConnection>> connection,
       CreateStorageConnection(*dbFile, *fmDirectory, databaseName,
                               mOriginMetadata.mOrigin, mDirectoryLockId,
                               mTelemetryId, maybeKey));
 
   AutoSetProgressHandler asph;
-  IDB_TRY(asph.Register(*connection, this));
-
-  IDB_TRY(LoadDatabaseInformation(*connection));
+  QM_TRY(asph.Register(*connection, this));
+
+  QM_TRY(LoadDatabaseInformation(*connection));
 
   MOZ_ASSERT(mMetadata->mNextObjectStoreId > mMetadata->mObjectStores.Count());
   MOZ_ASSERT(mMetadata->mNextIndexId > 0);
 
   // See if we need to do a versionchange transaction
 
   // Optional version semantics.
   if (!mRequestedVersion) {
     // If the requested version was not specified and the database was created,
     // treat it as if version 1 were requested.
     // Otherwise, treat it as if the current version were requested.
     mRequestedVersion = mMetadata->mCommonMetadata.version() == 0
                             ? 1
                             : mMetadata->mCommonMetadata.version();
   }
 
-  IDB_TRY(OkIf(mMetadata->mCommonMetadata.version() <= mRequestedVersion),
-          NS_ERROR_DOM_INDEXEDDB_VERSION_ERR);
-
-  IDB_TRY_UNWRAP(
+  QM_TRY(OkIf(mMetadata->mCommonMetadata.version() <= mRequestedVersion),
+         NS_ERROR_DOM_INDEXEDDB_VERSION_ERR);
+
+  QM_TRY_UNWRAP(
       mFileManager,
       ([this, persistenceType, &databaseName, &fmDirectory,
         &connection]() -> mozilla::Result<SafeRefPtr<FileManager>, nsresult> {
         IndexedDatabaseManager* const mgr = IndexedDatabaseManager::Get();
         MOZ_ASSERT(mgr);
 
         SafeRefPtr<FileManager> fileManager = mgr->GetFileManager(
             persistenceType, mOriginMetadata.mOrigin, databaseName);
 
         if (!fileManager) {
           fileManager = MakeSafeRefPtr<FileManager>(
               persistenceType, mOriginMetadata, databaseName, mEnforcingQuota);
 
-          IDB_TRY(fileManager->Init(fmDirectory, *connection));
+          QM_TRY(fileManager->Init(fmDirectory, *connection));
 
           mgr->AddFileManager(fileManager.clonePtr());
         }
 
         return fileManager;
       }()));
 
   // Must close connection before dispatching otherwise we might race with the
@@ -16124,286 +16110,285 @@ nsresult OpenDatabaseOp::DoDatabaseWork(
   MOZ_ALWAYS_SUCCEEDS(connection->Close());
 
   // Must set mState before dispatching otherwise we will race with the owning
   // thread.
   mState = (mMetadata->mCommonMetadata.version() == mRequestedVersion)
                ? State::SendingResults
                : State::BeginVersionChange;
 
-  IDB_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
+  QM_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult OpenDatabaseOp::LoadDatabaseInformation(
     mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
   MOZ_ASSERT(mMetadata);
 
   {
     // Load version information.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stmt,
         CreateAndExecuteSingleStepStatement<
             SingleStepResult::ReturnNullIfNoResult>(
             aConnection, "SELECT name, origin, version FROM database"_ns));
 
-    IDB_TRY(OkIf(stmt), NS_ERROR_FILE_CORRUPTED);
-
-    IDB_TRY_INSPECT(const auto& databaseName,
-                    MOZ_TO_RESULT_INVOKE_TYPED(nsString, stmt, GetString, 0));
-
-    IDB_TRY(OkIf(mCommonParams.metadata().name() == databaseName),
-            NS_ERROR_FILE_CORRUPTED);
-
-    IDB_TRY_INSPECT(const auto& origin, MOZ_TO_RESULT_INVOKE_TYPED(
-                                            nsCString, stmt, GetUTF8String, 1));
+    QM_TRY(OkIf(stmt), NS_ERROR_FILE_CORRUPTED);
+
+    QM_TRY_INSPECT(const auto& databaseName,
+                   MOZ_TO_RESULT_INVOKE_TYPED(nsString, stmt, GetString, 0));
+
+    QM_TRY(OkIf(mCommonParams.metadata().name() == databaseName),
+           NS_ERROR_FILE_CORRUPTED);
+
+    QM_TRY_INSPECT(const auto& origin, MOZ_TO_RESULT_INVOKE_TYPED(
+                                           nsCString, stmt, GetUTF8String, 1));
 
     // We can't just compare these strings directly. See bug 1339081 comment 69.
-    IDB_TRY(OkIf(QuotaManager::AreOriginsEqualOnDisk(mOriginMetadata.mOrigin,
-                                                     origin)),
-            NS_ERROR_FILE_CORRUPTED);
-
-    IDB_TRY_INSPECT(const int64_t& version,
-                    MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 2));
+    QM_TRY(OkIf(QuotaManager::AreOriginsEqualOnDisk(mOriginMetadata.mOrigin,
+                                                    origin)),
+           NS_ERROR_FILE_CORRUPTED);
+
+    QM_TRY_INSPECT(const int64_t& version,
+                   MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 2));
 
     mMetadata->mCommonMetadata.version() = uint64_t(version);
   }
 
   ObjectStoreTable& objectStores = mMetadata->mObjectStores;
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& lastObjectStoreId,
       ([&aConnection,
         &objectStores]() -> mozilla::Result<IndexOrObjectStoreId, nsresult> {
         // Load object store names and ids.
-        IDB_TRY_INSPECT(
+        QM_TRY_INSPECT(
             const auto& stmt,
             MOZ_TO_RESULT_INVOKE_TYPED(
                 nsCOMPtr<mozIStorageStatement>, aConnection, CreateStatement,
                 "SELECT id, auto_increment, name, key_path "
                 "FROM object_store"_ns));
 
         IndexOrObjectStoreId lastObjectStoreId = 0;
 
-        IDB_TRY(CollectWhileHasResult(
+        QM_TRY(CollectWhileHasResult(
             *stmt,
             [&lastObjectStoreId, &objectStores,
              usedIds = Maybe<nsTHashSet<uint64_t>>{},
              usedNames = Maybe<nsTHashSet<nsString>>{}](
                 auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
-              IDB_TRY_INSPECT(const IndexOrObjectStoreId& objectStoreId,
-                              MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 0));
+              QM_TRY_INSPECT(const IndexOrObjectStoreId& objectStoreId,
+                             MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 0));
 
               if (!usedIds) {
                 usedIds.emplace();
               }
 
-              IDB_TRY(OkIf(objectStoreId > 0), Err(NS_ERROR_FILE_CORRUPTED));
-              IDB_TRY(OkIf(!usedIds.ref().Contains(objectStoreId)),
-                      Err(NS_ERROR_FILE_CORRUPTED));
-
-              IDB_TRY(OkIf(usedIds.ref().Insert(objectStoreId, fallible)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(objectStoreId > 0), Err(NS_ERROR_FILE_CORRUPTED));
+              QM_TRY(OkIf(!usedIds.ref().Contains(objectStoreId)),
+                     Err(NS_ERROR_FILE_CORRUPTED));
+
+              QM_TRY(OkIf(usedIds.ref().Insert(objectStoreId, fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               nsString name;
-              IDB_TRY(stmt.GetString(2, name));
+              QM_TRY(stmt.GetString(2, name));
 
               if (!usedNames) {
                 usedNames.emplace();
               }
 
-              IDB_TRY(OkIf(!usedNames.ref().Contains(name)),
-                      Err(NS_ERROR_FILE_CORRUPTED));
-
-              IDB_TRY(OkIf(usedNames.ref().Insert(name, fallible)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(!usedNames.ref().Contains(name)),
+                     Err(NS_ERROR_FILE_CORRUPTED));
+
+              QM_TRY(OkIf(usedNames.ref().Insert(name, fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               ObjectStoreMetadata commonMetadata;
               commonMetadata.id() = objectStoreId;
               commonMetadata.name() = std::move(name);
 
-              IDB_TRY_INSPECT(const int32_t& columnType,
-                              MOZ_TO_RESULT_INVOKE(stmt, GetTypeOfIndex, 3));
+              QM_TRY_INSPECT(const int32_t& columnType,
+                             MOZ_TO_RESULT_INVOKE(stmt, GetTypeOfIndex, 3));
 
               if (columnType == mozIStorageStatement::VALUE_TYPE_NULL) {
                 commonMetadata.keyPath() = KeyPath(0);
               } else {
                 MOZ_ASSERT(columnType == mozIStorageStatement::VALUE_TYPE_TEXT);
 
                 nsString keyPathSerialization;
-                IDB_TRY(stmt.GetString(3, keyPathSerialization));
+                QM_TRY(stmt.GetString(3, keyPathSerialization));
 
                 commonMetadata.keyPath() =
                     KeyPath::DeserializeFromString(keyPathSerialization);
-                IDB_TRY(OkIf(commonMetadata.keyPath().IsValid()),
-                        Err(NS_ERROR_FILE_CORRUPTED));
+                QM_TRY(OkIf(commonMetadata.keyPath().IsValid()),
+                       Err(NS_ERROR_FILE_CORRUPTED));
               }
 
-              IDB_TRY_INSPECT(const int64_t& nextAutoIncrementId,
-                              MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 1));
+              QM_TRY_INSPECT(const int64_t& nextAutoIncrementId,
+                             MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 1));
 
               commonMetadata.autoIncrement() = !!nextAutoIncrementId;
 
-              IDB_TRY(OkIf(objectStores.InsertOrUpdate(
-                          objectStoreId,
-                          MakeSafeRefPtr<FullObjectStoreMetadata>(
-                              std::move(commonMetadata),
-                              FullObjectStoreMetadata::AutoIncrementIds{
-                                  nextAutoIncrementId, nextAutoIncrementId}),
-                          fallible)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(objectStores.InsertOrUpdate(
+                         objectStoreId,
+                         MakeSafeRefPtr<FullObjectStoreMetadata>(
+                             std::move(commonMetadata),
+                             FullObjectStoreMetadata::AutoIncrementIds{
+                                 nextAutoIncrementId, nextAutoIncrementId}),
+                         fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               lastObjectStoreId = std::max(lastObjectStoreId, objectStoreId);
 
               return Ok{};
             }));
 
         return lastObjectStoreId;
       }()));
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& lastIndexId,
       ([&aConnection,
         &objectStores]() -> mozilla::Result<IndexOrObjectStoreId, nsresult> {
         // Load index information
-        IDB_TRY_INSPECT(
+        QM_TRY_INSPECT(
             const auto& stmt,
             MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageStatement>,
                                        aConnection, CreateStatement,
                                        "SELECT "
                                        "id, object_store_id, name, key_path, "
                                        "unique_index, multientry, "
                                        "locale, is_auto_locale "
                                        "FROM object_store_index"_ns));
 
         IndexOrObjectStoreId lastIndexId = 0;
 
-        IDB_TRY(CollectWhileHasResult(
+        QM_TRY(CollectWhileHasResult(
             *stmt,
             [&lastIndexId, &objectStores, &aConnection,
              usedIds = Maybe<nsTHashSet<uint64_t>>{},
              usedNames = Maybe<nsTHashSet<nsString>>{}](
                 auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
-              IDB_TRY_INSPECT(const IndexOrObjectStoreId& objectStoreId,
-                              MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 1));
+              QM_TRY_INSPECT(const IndexOrObjectStoreId& objectStoreId,
+                             MOZ_TO_RESULT_INVOKE(stmt, GetInt64, 1));
 
               // XXX Why does this return NS_ERROR_OUT_OF_MEMORY if we don't
               // know the object store id?
 
               auto objectStoreMetadata = objectStores.Lookup(objectStoreId);
-              IDB_TRY(OkIf(static_cast<bool>(objectStoreMetadata)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(static_cast<bool>(objectStoreMetadata)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               MOZ_ASSERT((*objectStoreMetadata)->mCommonMetadata.id() ==
                          objectStoreId);
 
               IndexOrObjectStoreId indexId;
-              IDB_TRY(stmt.GetInt64(0, &indexId));
+              QM_TRY(stmt.GetInt64(0, &indexId));
 
               if (!usedIds) {
                 usedIds.emplace();
               }
 
-              IDB_TRY(OkIf(indexId > 0), Err(NS_ERROR_FILE_CORRUPTED));
-              IDB_TRY(OkIf(!usedIds.ref().Contains(indexId)),
-                      Err(NS_ERROR_FILE_CORRUPTED));
-
-              IDB_TRY(OkIf(usedIds.ref().Insert(indexId, fallible)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(indexId > 0), Err(NS_ERROR_FILE_CORRUPTED));
+              QM_TRY(OkIf(!usedIds.ref().Contains(indexId)),
+                     Err(NS_ERROR_FILE_CORRUPTED));
+
+              QM_TRY(OkIf(usedIds.ref().Insert(indexId, fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               nsString name;
-              IDB_TRY(stmt.GetString(2, name));
+              QM_TRY(stmt.GetString(2, name));
 
               const nsAutoString hashName =
                   IntToString(indexId) + u":"_ns + name;
 
               if (!usedNames) {
                 usedNames.emplace();
               }
 
-              IDB_TRY(OkIf(!usedNames.ref().Contains(hashName)),
-                      Err(NS_ERROR_FILE_CORRUPTED));
-
-              IDB_TRY(OkIf(usedNames.ref().Insert(hashName, fallible)),
-                      Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf(!usedNames.ref().Contains(hashName)),
+                     Err(NS_ERROR_FILE_CORRUPTED));
+
+              QM_TRY(OkIf(usedNames.ref().Insert(hashName, fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               auto indexMetadata = MakeSafeRefPtr<FullIndexMetadata>();
               indexMetadata->mCommonMetadata.id() = indexId;
               indexMetadata->mCommonMetadata.name() = name;
 
 #ifdef DEBUG
               {
                 int32_t columnType;
                 nsresult rv = stmt.GetTypeOfIndex(3, &columnType);
                 MOZ_ASSERT(NS_SUCCEEDED(rv));
                 MOZ_ASSERT(columnType != mozIStorageStatement::VALUE_TYPE_NULL);
               }
 #endif
 
               nsString keyPathSerialization;
-              IDB_TRY(stmt.GetString(3, keyPathSerialization));
+              QM_TRY(stmt.GetString(3, keyPathSerialization));
 
               indexMetadata->mCommonMetadata.keyPath() =
                   KeyPath::DeserializeFromString(keyPathSerialization);
-              IDB_TRY(OkIf(indexMetadata->mCommonMetadata.keyPath().IsValid()),
-                      Err(NS_ERROR_FILE_CORRUPTED));
+              QM_TRY(OkIf(indexMetadata->mCommonMetadata.keyPath().IsValid()),
+                     Err(NS_ERROR_FILE_CORRUPTED));
 
               int32_t scratch;
-              IDB_TRY(stmt.GetInt32(4, &scratch));
+              QM_TRY(stmt.GetInt32(4, &scratch));
 
               indexMetadata->mCommonMetadata.unique() = !!scratch;
 
-              IDB_TRY(stmt.GetInt32(5, &scratch));
+              QM_TRY(stmt.GetInt32(5, &scratch));
 
               indexMetadata->mCommonMetadata.multiEntry() = !!scratch;
 
               const bool localeAware = !stmt.IsNull(6);
               if (localeAware) {
-                IDB_TRY(stmt.GetUTF8String(
+                QM_TRY(stmt.GetUTF8String(
                     6, indexMetadata->mCommonMetadata.locale()));
 
-                IDB_TRY(stmt.GetInt32(7, &scratch));
+                QM_TRY(stmt.GetInt32(7, &scratch));
 
                 indexMetadata->mCommonMetadata.autoLocale() = !!scratch;
 
                 // Update locale-aware indexes if necessary
                 const nsCString& indexedLocale =
                     indexMetadata->mCommonMetadata.locale();
                 const bool& isAutoLocale =
                     indexMetadata->mCommonMetadata.autoLocale();
                 const nsCString& systemLocale =
                     IndexedDatabaseManager::GetLocale();
                 if (!systemLocale.IsEmpty() && isAutoLocale &&
                     !indexedLocale.EqualsASCII(systemLocale.get())) {
-                  IDB_TRY(UpdateLocaleAwareIndex(aConnection,
-                                                 indexMetadata->mCommonMetadata,
-                                                 systemLocale));
+                  QM_TRY(UpdateLocaleAwareIndex(aConnection,
+                                                indexMetadata->mCommonMetadata,
+                                                systemLocale));
                 }
               }
 
-              IDB_TRY(
-                  OkIf((*objectStoreMetadata)
-                           ->mIndexes.InsertOrUpdate(
-                               indexId, std::move(indexMetadata), fallible)),
-                  Err(NS_ERROR_OUT_OF_MEMORY));
+              QM_TRY(OkIf((*objectStoreMetadata)
+                              ->mIndexes.InsertOrUpdate(
+                                  indexId, std::move(indexMetadata), fallible)),
+                     Err(NS_ERROR_OUT_OF_MEMORY));
 
               lastIndexId = std::max(lastIndexId, indexId);
 
               return Ok{};
             }));
 
         return lastIndexId;
       }()));
 
-  IDB_TRY(OkIf(lastObjectStoreId != INT64_MAX),
-          NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
-  IDB_TRY(OkIf(lastIndexId != INT64_MAX), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(lastObjectStoreId != INT64_MAX),
+         NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(lastIndexId != INT64_MAX), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   mMetadata->mNextObjectStoreId = lastObjectStoreId + 1;
   mMetadata->mNextIndexId = lastIndexId + 1;
 
   return NS_OK;
 }
 
 /* static */
@@ -16413,78 +16398,78 @@ nsresult OpenDatabaseOp::UpdateLocaleAwa
   const auto indexTable =
       aIndexMetadata.unique() ? "unique_index_data"_ns : "index_data"_ns;
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
   const nsCString readQuery = "SELECT value, object_data_key FROM "_ns +
                               indexTable + " WHERE index_id = :index_id"_ns;
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& readStmt,
       MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageStatement>, aConnection,
                                  CreateStatement, readQuery));
 
-  IDB_TRY(readStmt->BindInt64ByIndex(0, aIndexMetadata.id()));
-
-  IDB_TRY(CollectWhileHasResult(
+  QM_TRY(readStmt->BindInt64ByIndex(0, aIndexMetadata.id()));
+
+  QM_TRY(CollectWhileHasResult(
       *readStmt,
       [&aConnection, &indexTable, &aIndexMetadata, &aLocale,
        writeStmt = nsCOMPtr<mozIStorageStatement>{}](
           auto& readStmt) mutable -> mozilla::Result<Ok, nsresult> {
         if (!writeStmt) {
-          IDB_TRY_UNWRAP(
+          QM_TRY_UNWRAP(
               writeStmt,
               MOZ_TO_RESULT_INVOKE_TYPED(
                   nsCOMPtr<mozIStorageStatement>, aConnection, CreateStatement,
                   "UPDATE "_ns + indexTable + "SET value_locale = :"_ns +
                       kStmtParamNameValueLocale + " WHERE index_id = :"_ns +
                       kStmtParamNameIndexId + " AND value = :"_ns +
                       kStmtParamNameValue + " AND object_data_key = :"_ns +
                       kStmtParamNameObjectDataKey));
         }
 
         mozStorageStatementScoper scoper(writeStmt);
-        IDB_TRY(writeStmt->BindInt64ByName(kStmtParamNameIndexId,
-                                           aIndexMetadata.id()));
+        QM_TRY(writeStmt->BindInt64ByName(kStmtParamNameIndexId,
+                                          aIndexMetadata.id()));
 
         Key oldKey, objectStorePosition;
-        IDB_TRY(oldKey.SetFromStatement(&readStmt, 0));
-        IDB_TRY(oldKey.BindToStatement(writeStmt, kStmtParamNameValue));
-
-        IDB_TRY_INSPECT(const auto& newSortKey,
-                        oldKey.ToLocaleAwareKey(aLocale));
-
-        IDB_TRY(
+        QM_TRY(oldKey.SetFromStatement(&readStmt, 0));
+        QM_TRY(oldKey.BindToStatement(writeStmt, kStmtParamNameValue));
+
+        QM_TRY_INSPECT(const auto& newSortKey,
+                       oldKey.ToLocaleAwareKey(aLocale));
+
+        QM_TRY(
             newSortKey.BindToStatement(writeStmt, kStmtParamNameValueLocale));
-        IDB_TRY(objectStorePosition.SetFromStatement(&readStmt, 1));
-        IDB_TRY(objectStorePosition.BindToStatement(
+        QM_TRY(objectStorePosition.SetFromStatement(&readStmt, 1));
+        QM_TRY(objectStorePosition.BindToStatement(
             writeStmt, kStmtParamNameObjectDataKey));
 
-        IDB_TRY(writeStmt->Execute());
+        QM_TRY(writeStmt->Execute());
 
         return Ok{};
       }));
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
   static constexpr auto metaQuery =
       "UPDATE object_store_index SET "
       "locale = :locale WHERE id = :id"_ns;
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& metaStmt,
       MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<mozIStorageStatement>, aConnection,
                                  CreateStatement, metaQuery));
 
-  IDB_TRY(metaStmt->BindStringByIndex(0, NS_ConvertASCIItoUTF16(aLocale)));
-
-  IDB_TRY(metaStmt->BindInt64ByIndex(1, aIndexMetadata.id()));
-
-  IDB_TRY(metaStmt->Execute());
+  QM_TRY(metaStmt->BindStringByIndex(0, NS_ConvertASCIItoUTF16(aLocale)));
+
+  QM_TRY(metaStmt->BindInt64ByIndex(1, aIndexMetadata.id()));
+
+  QM_TRY(metaStmt->Execute());
 
   return NS_OK;
 }
 
 nsresult OpenDatabaseOp::BeginVersionChange() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::BeginVersionChange);
   MOZ_ASSERT(mMaybeBlockedDatabases.IsEmpty());
@@ -16520,19 +16505,19 @@ nsresult OpenDatabaseOp::BeginVersionCha
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   MOZ_ASSERT(info->mMetadata != mMetadata);
   mMetadata = info->mMetadata.clonePtr();
 
   const Maybe<uint64_t> newVersion = Some(mRequestedVersion);
 
-  IDB_TRY(SendVersionChangeMessages(info, mDatabase.maybeDeref(),
-                                    mMetadata->mCommonMetadata.version(),
-                                    newVersion));
+  QM_TRY(SendVersionChangeMessages(info, mDatabase.maybeDeref(),
+                                   mMetadata->mCommonMetadata.version(),
+                                   newVersion));
 
   mVersionChangeTransaction = std::move(transaction);
 
   if (mMaybeBlockedDatabases.IsEmpty()) {
     // We don't need to wait on any databases, just jump to the transaction
     // pool.
     WaitForTransactions();
     return NS_OK;
@@ -16816,17 +16801,17 @@ nsresult OpenDatabaseOp::EnsureDatabaseA
   EnsureDatabaseActor();
 
   if (mDatabase->IsActorAlive()) {
     return NS_OK;
   }
 
   auto* const factory = static_cast<Factory*>(Manager());
 
-  IDB_TRY_INSPECT(const auto& spec, MetadataToSpec());
+  QM_TRY_INSPECT(const auto& spec, MetadataToSpec());
 
   // Transfer ownership to IPDL.
   mDatabase->SetActorAlive();
 
   if (!factory->SendPBackgroundIDBDatabaseConstructor(
           mDatabase.unsafeGetRawPtr(), spec, this)) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
@@ -16837,47 +16822,47 @@ nsresult OpenDatabaseOp::EnsureDatabaseA
 
 Result<DatabaseSpec, nsresult> OpenDatabaseOp::MetadataToSpec() const {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mMetadata);
 
   DatabaseSpec spec;
   spec.metadata() = mMetadata->mCommonMetadata;
 
-  IDB_TRY_UNWRAP(
-      spec.objectStores(),
-      TransformIntoNewArrayAbortOnErr(
-          mMetadata->mObjectStores,
-          [](const auto& objectStoreEntry)
-              -> mozilla::Result<ObjectStoreSpec, nsresult> {
-            FullObjectStoreMetadata* metadata = objectStoreEntry.GetWeak();
-            MOZ_ASSERT(objectStoreEntry.GetKey());
-            MOZ_ASSERT(metadata);
-
-            ObjectStoreSpec objectStoreSpec;
-            objectStoreSpec.metadata() = metadata->mCommonMetadata;
-
-            IDB_TRY_UNWRAP(auto indexes,
-                           TransformIntoNewArray(
-                               metadata->mIndexes,
-                               [](const auto& indexEntry) {
-                                 FullIndexMetadata* indexMetadata =
-                                     indexEntry.GetWeak();
-                                 MOZ_ASSERT(indexEntry.GetKey());
-                                 MOZ_ASSERT(indexMetadata);
-
-                                 return indexMetadata->mCommonMetadata;
-                               },
-                               fallible));
-
-            objectStoreSpec.indexes() = std::move(indexes);
-
-            return objectStoreSpec;
-          },
-          fallible));
+  QM_TRY_UNWRAP(spec.objectStores(),
+                TransformIntoNewArrayAbortOnErr(
+                    mMetadata->mObjectStores,
+                    [](const auto& objectStoreEntry)
+                        -> mozilla::Result<ObjectStoreSpec, nsresult> {
+                      FullObjectStoreMetadata* metadata =
+                          objectStoreEntry.GetWeak();
+                      MOZ_ASSERT(objectStoreEntry.GetKey());
+                      MOZ_ASSERT(metadata);
+
+                      ObjectStoreSpec objectStoreSpec;
+                      objectStoreSpec.metadata() = metadata->mCommonMetadata;
+
+                      QM_TRY_UNWRAP(auto indexes,
+                                    TransformIntoNewArray(
+                                        metadata->mIndexes,
+                                        [](const auto& indexEntry) {
+                                          FullIndexMetadata* indexMetadata =
+                                              indexEntry.GetWeak();
+                                          MOZ_ASSERT(indexEntry.GetKey());
+                                          MOZ_ASSERT(indexMetadata);
+
+                                          return indexMetadata->mCommonMetadata;
+                                        },
+                                        fallible));
+
+                      objectStoreSpec.indexes() = std::move(indexes);
+
+                      return objectStoreSpec;
+                    },
+                    fallible));
 
   return spec;
 }
 
 #ifdef DEBUG
 
 void OpenDatabaseOp::AssertMetadataConsistency(
     const FullDatabaseMetadata& aMetadata) {
@@ -16989,26 +16974,25 @@ nsresult OpenDatabaseOp::VersionChangeOp
   AUTO_PROFILER_LABEL("OpenDatabaseOp::VersionChangeOp::DoDatabaseWork", DOM);
 
   IDB_LOG_MARK_PARENT_TRANSACTION("Beginning database work", "DB Start",
                                   IDB_LOG_ID_STRING(mBackgroundChildLoggingId),
                                   mTransactionLoggingSerialNumber);
 
   Transaction().SetActiveOnConnectionThread();
 
-  IDB_TRY(aConnection->BeginWriteTransaction());
+  QM_TRY(aConnection->BeginWriteTransaction());
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "UPDATE database SET version = :version;"_ns,
       ([&self = *this](
            mozIStorageStatement& updateStmt) -> mozilla::Result<Ok, nsresult> {
-        IDB_TRY(
-            updateStmt.BindInt64ByIndex(0, int64_t(self.mRequestedVersion)));
+        QM_TRY(updateStmt.BindInt64ByIndex(0, int64_t(self.mRequestedVersion)));
 
         return Ok{};
       })));
 
   return NS_OK;
 }
 
 nsresult OpenDatabaseOp::VersionChangeOp::SendSuccessResult() {
@@ -17087,49 +17071,49 @@ void DeleteDatabaseOp::LoadPreviousVersi
     if (!lockedPrivateBrowsingInfoHashtable->Get(mDatabaseId, &key)) {
       return Nothing{};
     }
     return Some(std::move(key));
   }();
 
   // Pass -1 as the directoryLockId to disable quota checking, since we might
   // temporarily exceed quota before deleting the database.
-  IDB_TRY_INSPECT(const auto& dbFileUrl,
-                  GetDatabaseFileURL(aDatabaseFile, -1, maybeKey), QM_VOID);
-
-  IDB_TRY_UNWRAP(const NotNull<nsCOMPtr<mozIStorageConnection>> connection,
-                 OpenDatabaseAndHandleBusy(*ss, *dbFileUrl), QM_VOID);
+  QM_TRY_INSPECT(const auto& dbFileUrl,
+                 GetDatabaseFileURL(aDatabaseFile, -1, maybeKey), QM_VOID);
+
+  QM_TRY_UNWRAP(const NotNull<nsCOMPtr<mozIStorageConnection>> connection,
+                OpenDatabaseAndHandleBusy(*ss, *dbFileUrl), QM_VOID);
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const auto& stmt,
-                    CreateAndExecuteSingleStepStatement<
-                        SingleStepResult::ReturnNullIfNoResult>(
-                        *connection, "SELECT name FROM database"_ns),
-                    QM_VOID);
-
-    IDB_TRY(OkIf(stmt), QM_VOID);
+    QM_TRY_INSPECT(const auto& stmt,
+                   CreateAndExecuteSingleStepStatement<
+                       SingleStepResult::ReturnNullIfNoResult>(
+                       *connection, "SELECT name FROM database"_ns),
+                   QM_VOID);
+
+    QM_TRY(OkIf(stmt), QM_VOID);
 
     nsString databaseName;
     rv = stmt->GetString(0, databaseName);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
     }
 
     MOZ_ASSERT(mCommonParams.metadata().name() == databaseName);
   }
 #endif
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  CreateAndExecuteSingleStepStatement<
-                      SingleStepResult::ReturnNullIfNoResult>(
-                      *connection, "SELECT version FROM database"_ns),
-                  QM_VOID);
-
-  IDB_TRY(OkIf(stmt), QM_VOID);
+  QM_TRY_INSPECT(const auto& stmt,
+                 CreateAndExecuteSingleStepStatement<
+                     SingleStepResult::ReturnNullIfNoResult>(
+                     *connection, "SELECT version FROM database"_ns),
+                 QM_VOID);
+
+  QM_TRY(OkIf(stmt), QM_VOID);
 
   int64_t version;
   rv = stmt->GetInt64(0, &version);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   mPreviousVersion = uint64_t(version);
@@ -17166,53 +17150,52 @@ nsresult DeleteDatabaseOp::DoDatabaseWor
 
   const nsString& databaseName = mCommonParams.metadata().name();
   const PersistenceType persistenceType =
       mCommonParams.metadata().persistenceType();
 
   QuotaManager* const quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
-  IDB_TRY_UNWRAP(auto directory, quotaManager->GetDirectoryForOrigin(
-                                     persistenceType, mOriginMetadata.mOrigin));
-
-  IDB_TRY(
-      directory->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
-
-  IDB_TRY_UNWRAP(mDatabaseDirectoryPath,
-                 MOZ_TO_RESULT_INVOKE_TYPED(nsString, directory, GetPath));
+  QM_TRY_UNWRAP(auto directory, quotaManager->GetDirectoryForOrigin(
+                                    persistenceType, mOriginMetadata.mOrigin));
+
+  QM_TRY(directory->Append(NS_LITERAL_STRING_FROM_CSTRING(IDB_DIRECTORY_NAME)));
+
+  QM_TRY_UNWRAP(mDatabaseDirectoryPath,
+                MOZ_TO_RESULT_INVOKE_TYPED(nsString, directory, GetPath));
 
   mDatabaseFilenameBase = GetDatabaseFilenameBase(databaseName);
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& dbFile,
       CloneFileAndAppend(*directory, mDatabaseFilenameBase + kSQLiteSuffix));
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const auto& databaseFilePath,
-                    MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
+    QM_TRY_INSPECT(const auto& databaseFilePath,
+                   MOZ_TO_RESULT_INVOKE_TYPED(nsString, dbFile, GetPath));
 
     MOZ_ASSERT(databaseFilePath == mDatabaseFilePath);
   }
 #endif
 
-  IDB_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(dbFile, Exists));
+  QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(dbFile, Exists));
 
   if (exists) {
     // Parts of this function may fail but that shouldn't prevent us from
     // deleting the file eventually.
     LoadPreviousVersion(*dbFile);
 
     mState = State::BeginVersionChange;
   } else {
     mState = State::SendingResults;
   }
 
-  IDB_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
+  QM_TRY(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
 nsresult DeleteDatabaseOp::BeginVersionChange() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::BeginVersionChange);
   MOZ_ASSERT(mMaybeBlockedDatabases.IsEmpty());
@@ -17769,24 +17752,23 @@ nsresult TransactionBase::CommitOp::Writ
       const int64_t nextAutoIncrementId = [&metadata] {
         const auto&& lockedAutoIncrementIds =
             metadata->mAutoIncrementIds.Lock();
         return lockedAutoIncrementIds->next;
       }();
 
       MOZ_ASSERT(nextAutoIncrementId > 1);
 
-      IDB_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
-
-      IDB_TRY(
-          borrowedStmt->BindInt64ByIndex(1, metadata->mCommonMetadata.id()));
-
-      IDB_TRY(borrowedStmt->BindInt64ByIndex(0, nextAutoIncrementId));
-
-      IDB_TRY(borrowedStmt->Execute());
+      QM_TRY_INSPECT(const auto& borrowedStmt, stmt.Borrow());
+
+      QM_TRY(borrowedStmt->BindInt64ByIndex(1, metadata->mCommonMetadata.id()));
+
+      QM_TRY(borrowedStmt->BindInt64ByIndex(0, nextAutoIncrementId));
+
+      QM_TRY(borrowedStmt->Execute());
     }
   }
 
   return NS_OK;
 }
 
 void TransactionBase::CommitOp::CommitOrRollbackAutoIncrementCounts() {
   MOZ_ASSERT(mTransaction);
@@ -17819,36 +17801,36 @@ void TransactionBase::CommitOp::CommitOr
 void TransactionBase::CommitOp::AssertForeignKeyConsistency(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   MOZ_ASSERT(mTransaction);
   mTransaction->AssertIsOnConnectionThread();
   MOZ_ASSERT(mTransaction->GetMode() != IDBTransaction::Mode::ReadOnly);
 
   {
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& pragmaStmt,
         CreateAndExecuteSingleStepStatement(
             aConnection->MutableStorageConnection(), "PRAGMA foreign_keys;"_ns),
         QM_ASSERT_UNREACHABLE_VOID);
 
     int32_t foreignKeysEnabled;
     MOZ_ALWAYS_SUCCEEDS(pragmaStmt->GetInt32(0, &foreignKeysEnabled));
 
     MOZ_ASSERT(foreignKeysEnabled,
                "Database doesn't have foreign keys enabled!");
   }
 
   {
-    IDB_TRY_INSPECT(const bool& foreignKeyError,
-                    CreateAndExecuteSingleStepStatement<
-                        SingleStepResult::ReturnNullIfNoResult>(
-                        aConnection->MutableStorageConnection(),
-                        "PRAGMA foreign_key_check;"_ns),
-                    QM_ASSERT_UNREACHABLE_VOID);
+    QM_TRY_INSPECT(const bool& foreignKeyError,
+                   CreateAndExecuteSingleStepStatement<
+                       SingleStepResult::ReturnNullIfNoResult>(
+                       aConnection->MutableStorageConnection(),
+                       "PRAGMA foreign_key_check;"_ns),
+                   QM_ASSERT_UNREACHABLE_VOID);
 
     MOZ_ASSERT(!foreignKeyError, "Database has inconsisistent foreign keys!");
   }
 }
 
 #endif  // DEBUG
 
 NS_IMPL_ISUPPORTS_INHERITED0(TransactionBase::CommitOp, DatabaseOperationBase)
@@ -18017,21 +17999,21 @@ DatabaseOp::Run() {
 
       MOZ_ALWAYS_SUCCEEDS(
           mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
     }
   };
 
   switch (mState) {
     case State::Initial:
-      IDB_TRY(SendToIOThread(), NS_OK, handleError);
+      QM_TRY(SendToIOThread(), NS_OK, handleError);
       break;
 
     case State::DatabaseWork:
-      IDB_TRY(DoDatabaseWork(), NS_OK, handleError);
+      QM_TRY(DoDatabaseWork(), NS_OK, handleError);
       break;
 
     case State::SendingResults:
       SendResults();
       break;
 
     default:
       MOZ_CRASH("Bad state!");
@@ -18050,31 +18032,31 @@ CreateFileOp::CreateFileOp(SafeRefPtr<Da
                            const DatabaseRequestParams& aParams)
     : DatabaseOp(std::move(aDatabase)),
       mParams(aParams.get_CreateFileParams()) {
   MOZ_ASSERT(aParams.type() == DatabaseRequestParams::TCreateFileParams);
 }
 
 Result<RefPtr<MutableFile>, nsresult> CreateFileOp::CreateMutableFile() {
   const nsCOMPtr<nsIFile> file = (*mFileInfo)->GetFileForFileInfo();
-  IDB_TRY(OkIf(file), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(file), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   const RefPtr<MutableFile> mutableFile =
       MutableFile::Create(file, mDatabase.clonePtr(), mFileInfo->clonePtr());
-  IDB_TRY(OkIf(mutableFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(mutableFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   // Transfer ownership to IPDL.
   mutableFile->SetActorAlive();
 
-  IDB_TRY(OkIf(mDatabase->SendPBackgroundMutableFileConstructor(
-              mutableFile, mParams.name(), mParams.type())),
-          Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(mDatabase->SendPBackgroundMutableFileConstructor(
+             mutableFile, mParams.name(), mParams.type())),
+         Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   return mutableFile;
 }
 
 nsresult CreateFileOp::DoDatabaseWork() {
   AssertIsOnIOThread();
   MOZ_ASSERT(mState == State::DatabaseWork);
 
@@ -18147,17 +18129,17 @@ void CreateFileOp::SendResults() {
 
   if (!IsActorDestroyed() && !mDatabase->IsInvalidated()) {
     const auto response = [this]() -> DatabaseRequestResponse {
       if (HasFailed()) {
         return ClampResultCode(ResultCode());
       }
 
       auto res = [this]() -> DatabaseRequestResponse {
-        IDB_TRY_RETURN(
+        QM_TRY_RETURN(
             CreateMutableFile().andThen(
                 [](const auto& mutableFile)
                     -> mozilla::Result<CreateFileRequestResponse, nsresult> {
                   // We successfully created a mutable file so use its actor
                   // as the success result for this request.
                   return CreateFileRequestResponse{mutableFile, nullptr};
                 }),
             ClampResultCode(tryTempError));
@@ -18218,89 +18200,89 @@ nsresult CreateObjectStoreOp::DoDatabase
 
 #ifdef DEBUG
   {
     // Make sure that we're not creating an object store with the same name as
     // another that already exists. This should be impossible because we should
     // have thrown an error long before now...
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const bool& hasResult,
         aConnection
             ->BorrowAndExecuteSingleStepStatement(
                 "SELECT name "
                 "FROM object_store "
                 "WHERE name = :name;"_ns,
                 [&self = *this](auto& stmt) -> Result<Ok, nsresult> {
-                  IDB_TRY(stmt.BindStringByIndex(0, self.mMetadata.name()));
+                  QM_TRY(stmt.BindStringByIndex(0, self.mMetadata.name()));
                   return Ok{};
                 })
             .map(IsSome),
         QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(!hasResult);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "INSERT INTO object_store (id, auto_increment, name, key_path) "
       "VALUES (:id, :auto_increment, :name, :key_path);"_ns,
       [&metadata =
            mMetadata](mozIStorageStatement& stmt) -> Result<Ok, nsresult> {
-        IDB_TRY(stmt.BindInt64ByIndex(0, metadata.id()));
-
-        IDB_TRY(stmt.BindInt32ByIndex(1, metadata.autoIncrement() ? 1 : 0));
-
-        IDB_TRY(stmt.BindStringByIndex(2, metadata.name()));
+        QM_TRY(stmt.BindInt64ByIndex(0, metadata.id()));
+
+        QM_TRY(stmt.BindInt32ByIndex(1, metadata.autoIncrement() ? 1 : 0));
+
+        QM_TRY(stmt.BindStringByIndex(2, metadata.name()));
 
         if (metadata.keyPath().IsValid()) {
-          IDB_TRY(stmt.BindStringByIndex(
+          QM_TRY(stmt.BindStringByIndex(
               3, metadata.keyPath().SerializeToString()));
         } else {
-          IDB_TRY(stmt.BindNullByIndex(3));
+          QM_TRY(stmt.BindNullByIndex(3));
         }
 
         return Ok{};
       }));
 
 #ifdef DEBUG
   {
     int64_t id;
     MOZ_ALWAYS_SUCCEEDS(
         aConnection->MutableStorageConnection().GetLastInsertRowID(&id));
     MOZ_ASSERT(mMetadata.id() == id);
   }
 #endif
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 nsresult DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL("DeleteObjectStoreOp::DoDatabaseWork", DOM);
 
 #ifdef DEBUG
   {
     // Make sure |mIsLastObjectStore| is telling the truth.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& stmt,
         aConnection->BorrowCachedStatement("SELECT id FROM object_store;"_ns),
         QM_ASSERT_UNREACHABLE);
 
     bool foundThisObjectStore = false;
     bool foundOtherObjectStore = false;
 
     while (true) {
@@ -18324,87 +18306,86 @@ nsresult DeleteObjectStoreOp::DoDatabase
     MOZ_ASSERT_IF(mIsLastObjectStore,
                   foundThisObjectStore && !foundOtherObjectStore);
     MOZ_ASSERT_IF(!mIsLastObjectStore,
                   foundThisObjectStore && foundOtherObjectStore);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   if (mIsLastObjectStore) {
     // We can just delete everything if this is the last object store.
-    IDB_TRY(aConnection->ExecuteCachedStatement("DELETE FROM index_data;"_ns));
-
-    IDB_TRY(aConnection->ExecuteCachedStatement(
+    QM_TRY(aConnection->ExecuteCachedStatement("DELETE FROM index_data;"_ns));
+
+    QM_TRY(aConnection->ExecuteCachedStatement(
         "DELETE FROM unique_index_data;"_ns));
 
-    IDB_TRY(aConnection->ExecuteCachedStatement("DELETE FROM object_data;"_ns));
-
-    IDB_TRY(aConnection->ExecuteCachedStatement(
+    QM_TRY(aConnection->ExecuteCachedStatement("DELETE FROM object_data;"_ns));
+
+    QM_TRY(aConnection->ExecuteCachedStatement(
         "DELETE FROM object_store_index;"_ns));
 
-    IDB_TRY(
-        aConnection->ExecuteCachedStatement("DELETE FROM object_store;"_ns));
+    QM_TRY(aConnection->ExecuteCachedStatement("DELETE FROM object_store;"_ns));
   } else {
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const bool& hasIndexes,
         ObjectStoreHasIndexes(*aConnection, mMetadata->mCommonMetadata.id()));
 
     const auto bindObjectStoreIdToFirstParameter =
         [this](mozIStorageStatement& stmt) -> nsresult {
-      IDB_TRY(stmt.BindInt64ByIndex(0, mMetadata->mCommonMetadata.id()));
+      QM_TRY(stmt.BindInt64ByIndex(0, mMetadata->mCommonMetadata.id()));
 
       return NS_OK;
     };
 
     // The parameter name :object_store_id in the SQL statements below is not
     // used for binding, parameters are bound by index only locally by
     // bindObjectStoreIdToFirstParameter.
     if (hasIndexes) {
-      IDB_TRY(DeleteObjectStoreDataTableRowsWithIndexes(
+      QM_TRY(DeleteObjectStoreDataTableRowsWithIndexes(
           aConnection, mMetadata->mCommonMetadata.id(), Nothing()));
 
       // Now clean up the object store index table.
-      IDB_TRY(aConnection->ExecuteCachedStatement(
+      QM_TRY(aConnection->ExecuteCachedStatement(
           "DELETE FROM object_store_index "
           "WHERE object_store_id = :object_store_id;"_ns,
           bindObjectStoreIdToFirstParameter));
     } else {
       // We only have to worry about object data if this object store has no
       // indexes.
-      IDB_TRY(aConnection->ExecuteCachedStatement(
+      QM_TRY(aConnection->ExecuteCachedStatement(
           "DELETE FROM object_data "
           "WHERE object_store_id = :object_store_id;"_ns,
           bindObjectStoreIdToFirstParameter));
     }
 
-    IDB_TRY(
+    QM_TRY(
         aConnection->ExecuteCachedStatement("DELETE FROM object_store "
                                             "WHERE id = :object_store_id;"_ns,
                                             bindObjectStoreIdToFirstParameter));
 
 #ifdef DEBUG
     {
       int32_t deletedRowCount;
       MOZ_ALWAYS_SUCCEEDS(
           aConnection->MutableStorageConnection().GetAffectedRows(
               &deletedRowCount));
       MOZ_ASSERT(deletedRowCount == 1);
     }
 #endif
   }
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   if (mMetadata->mCommonMetadata.autoIncrement()) {
     Transaction().ForgetModifiedAutoIncrementObjectStore(*mMetadata);
   }
 
   return NS_OK;
 }
 
@@ -18416,59 +18397,58 @@ nsresult RenameObjectStoreOp::DoDatabase
 
 #ifdef DEBUG
   {
     // Make sure that we're not renaming an object store with the same name as
     // another that already exists. This should be impossible because we should
     // have thrown an error long before now...
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(
-        const bool& hasResult,
-        aConnection
-            ->BorrowAndExecuteSingleStepStatement(
-                "SELECT name "
-                "FROM object_store "
-                "WHERE name = :name AND id != :id;"_ns,
-                [&self = *this](auto& stmt) -> Result<Ok, nsresult> {
-                  IDB_TRY(stmt.BindStringByIndex(0, self.mNewName));
-
-                  IDB_TRY(stmt.BindInt64ByIndex(1, self.mId));
-                  return Ok{};
-                })
-            .map(IsSome),
-        QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const bool& hasResult,
+                   aConnection
+                       ->BorrowAndExecuteSingleStepStatement(
+                           "SELECT name "
+                           "FROM object_store "
+                           "WHERE name = :name AND id != :id;"_ns,
+                           [&self = *this](auto& stmt) -> Result<Ok, nsresult> {
+                             QM_TRY(stmt.BindStringByIndex(0, self.mNewName));
+
+                             QM_TRY(stmt.BindInt64ByIndex(1, self.mId));
+                             return Ok{};
+                           })
+                       .map(IsSome),
+                   QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(!hasResult);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "UPDATE object_store "
       "SET name = :name "
       "WHERE id = :id;"_ns,
       [&self = *this](mozIStorageStatement& stmt) -> nsresult {
-        IDB_TRY(stmt.BindStringByIndex(0, self.mNewName));
-
-        IDB_TRY(stmt.BindInt64ByIndex(1, self.mId));
+        QM_TRY(stmt.BindStringByIndex(0, self.mNewName));
+
+        QM_TRY(stmt.BindInt64ByIndex(1, self.mId));
 
         return NS_OK;
       }));
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 CreateIndexOp::CreateIndexOp(SafeRefPtr<VersionChangeTransaction> aTransaction,
                              const IndexOrObjectStoreId aObjectStoreId,
                              const IndexMetadata& aMetadata)
     : VersionChangeTransactionOp(std::move(aTransaction)),
@@ -18520,24 +18500,24 @@ nsresult CreateIndexOp::InsertDataFromOb
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(mMaybeUniqueIndexTable);
 
   MOZ_ASSERT(aConnection->HasStorageConnection());
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "UPDATE object_data "
       "SET index_data_values = update_index_data_values "
       "(key, index_data_values, file_ids, data) "
       "WHERE object_store_id = :object_store_id;"_ns,
       [objectStoredId =
            mObjectStoreId](mozIStorageStatement& stmt) -> nsresult {
-        IDB_TRY(stmt.BindInt64ByIndex(0, objectStoredId));
+        QM_TRY(stmt.BindInt64ByIndex(0, objectStoredId));
 
         return NS_OK;
       }));
 
   return NS_OK;
 }
 
 bool CreateIndexOp::Init(TransactionBase& aTransaction) {
@@ -18583,86 +18563,86 @@ nsresult CreateIndexOp::DoDatabaseWork(D
 
 #ifdef DEBUG
   {
     // Make sure that we're not creating an index with the same name and object
     // store as another that already exists. This should be impossible because
     // we should have thrown an error long before now...
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const bool& hasResult,
         aConnection
             ->BorrowAndExecuteSingleStepStatement(
                 "SELECT name "
                 "FROM object_store_index "
                 "WHERE object_store_id = :object_store_id AND name = :name;"_ns,
                 [&self = *this](auto& stmt) -> Result<Ok, nsresult> {
-                  IDB_TRY(stmt.BindInt64ByIndex(0, self.mObjectStoreId));
-                  IDB_TRY(stmt.BindStringByIndex(1, self.mMetadata.name()));
+                  QM_TRY(stmt.BindInt64ByIndex(0, self.mObjectStoreId));
+                  QM_TRY(stmt.BindStringByIndex(1, self.mMetadata.name()));
                   return Ok{};
                 })
             .map(IsSome),
         QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(!hasResult);
   }
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "INSERT INTO object_store_index (id, name, key_path, unique_index, "
       "multientry, object_store_id, locale, "
       "is_auto_locale) "
       "VALUES (:id, :name, :key_path, :unique, :multientry, "
       ":object_store_id, :locale, :is_auto_locale)"_ns,
       [&metadata = mMetadata,
        objectStoreId = mObjectStoreId](mozIStorageStatement& stmt) -> nsresult {
-        IDB_TRY(stmt.BindInt64ByIndex(0, metadata.id()));
-
-        IDB_TRY(stmt.BindStringByIndex(1, metadata.name()));
-
-        IDB_TRY(
+        QM_TRY(stmt.BindInt64ByIndex(0, metadata.id()));
+
+        QM_TRY(stmt.BindStringByIndex(1, metadata.name()));
+
+        QM_TRY(
             stmt.BindStringByIndex(2, metadata.keyPath().SerializeToString()));
 
-        IDB_TRY(stmt.BindInt32ByIndex(3, metadata.unique() ? 1 : 0));
-
-        IDB_TRY(stmt.BindInt32ByIndex(4, metadata.multiEntry() ? 1 : 0));
-        IDB_TRY(stmt.BindInt64ByIndex(5, objectStoreId));
-
-        IDB_TRY(metadata.locale().IsEmpty()
-                    ? stmt.BindNullByIndex(6)
-                    : stmt.BindUTF8StringByIndex(6, metadata.locale()));
-
-        IDB_TRY(stmt.BindInt32ByIndex(7, metadata.autoLocale()));
+        QM_TRY(stmt.BindInt32ByIndex(3, metadata.unique() ? 1 : 0));
+
+        QM_TRY(stmt.BindInt32ByIndex(4, metadata.multiEntry() ? 1 : 0));
+        QM_TRY(stmt.BindInt64ByIndex(5, objectStoreId));
+
+        QM_TRY(metadata.locale().IsEmpty()
+                   ? stmt.BindNullByIndex(6)
+                   : stmt.BindUTF8StringByIndex(6, metadata.locale()));
+
+        QM_TRY(stmt.BindInt32ByIndex(7, metadata.autoLocale()));
 
         return NS_OK;
       }));
 
 #ifdef DEBUG
   {
     int64_t id;
     MOZ_ALWAYS_SUCCEEDS(
         aConnection->MutableStorageConnection().GetLastInsertRowID(&id));
     MOZ_ASSERT(mMetadata.id() == id);
   }
 #endif
 
-  IDB_TRY(InsertDataFromObjectStore(aConnection));
-
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(InsertDataFromObjectStore(aConnection));
+
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(CreateIndexOp::UpdateIndexDataValuesFunction,
                   mozIStorageFunction);
 
 NS_IMETHODIMP
@@ -18697,54 +18677,54 @@ CreateIndexOp::UpdateIndexDataValuesFunc
                valueType == mozIStorageValueArray::VALUE_TYPE_TEXT);
 
     MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(3, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB ||
                valueType == mozIStorageValueArray::VALUE_TYPE_INTEGER);
   }
 #endif
 
-  IDB_TRY_UNWRAP(auto cloneInfo, GetStructuredCloneReadInfoFromValueArray(
-                                     aValues,
-                                     /* aDataIndex */ 3,
-                                     /* aFileIdsIndex */ 2, *mOp->mFileManager,
-                                     mDatabase->MaybeKeyRef()));
+  QM_TRY_UNWRAP(auto cloneInfo, GetStructuredCloneReadInfoFromValueArray(
+                                    aValues,
+                                    /* aDataIndex */ 3,
+                                    /* aFileIdsIndex */ 2, *mOp->mFileManager,
+                                    mDatabase->MaybeKeyRef()));
 
   const IndexMetadata& metadata = mOp->mMetadata;
   const IndexOrObjectStoreId& objectStoreId = mOp->mObjectStoreId;
 
   // XXX does this really need a non-const cloneInfo?
-  IDB_TRY_INSPECT(const auto& updateInfos,
-                  DeserializeIndexValueToUpdateInfos(
-                      metadata.id(), metadata.keyPath(), metadata.multiEntry(),
-                      metadata.locale(), cloneInfo));
+  QM_TRY_INSPECT(const auto& updateInfos,
+                 DeserializeIndexValueToUpdateInfos(
+                     metadata.id(), metadata.keyPath(), metadata.multiEntry(),
+                     metadata.locale(), cloneInfo));
 
   if (updateInfos.IsEmpty()) {
     // XXX See if we can do this without copying...
 
     nsCOMPtr<nsIVariant> unmodifiedValue;
 
     // No changes needed, just return the original value.
-    IDB_TRY_INSPECT(const int32_t& valueType,
-                    MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 1));
+    QM_TRY_INSPECT(const int32_t& valueType,
+                   MOZ_TO_RESULT_INVOKE(aValues, GetTypeOfIndex, 1));
 
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_NULL ||
                valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
 
     if (valueType == mozIStorageValueArray::VALUE_TYPE_NULL) {
       unmodifiedValue = new storage::NullVariant();
       unmodifiedValue.forget(_retval);
       return NS_OK;
     }
 
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
 
     const uint8_t* blobData;
     uint32_t blobDataLength;
-    IDB_TRY(aValues->GetSharedBlob(1, &blobDataLength, &blobData));
+    QM_TRY(aValues->GetSharedBlob(1, &blobDataLength, &blobData));
 
     const std::pair<uint8_t*, int> copiedBlobDataPair(
         static_cast<uint8_t*>(malloc(blobDataLength)), blobDataLength);
 
     if (!copiedBlobDataPair.first) {
       IDB_REPORT_INTERNAL_ERR();
       return NS_ERROR_OUT_OF_MEMORY;
     }
@@ -18753,38 +18733,38 @@ CreateIndexOp::UpdateIndexDataValuesFunc
 
     unmodifiedValue = new storage::AdoptedBlobVariant(copiedBlobDataPair);
     unmodifiedValue.forget(_retval);
 
     return NS_OK;
   }
 
   Key key;
-  IDB_TRY(key.SetFromValueArray(aValues, 0));
-
-  IDB_TRY_UNWRAP(auto indexValues, ReadCompressedIndexDataValues(*aValues, 1));
+  QM_TRY(key.SetFromValueArray(aValues, 0));
+
+  QM_TRY_UNWRAP(auto indexValues, ReadCompressedIndexDataValues(*aValues, 1));
 
   const bool hadPreviousIndexValues = !indexValues.IsEmpty();
 
   const uint32_t updateInfoCount = updateInfos.Length();
 
-  IDB_TRY(OkIf(indexValues.SetCapacity(indexValues.Length() + updateInfoCount,
-                                       fallible)),
-          NS_ERROR_OUT_OF_MEMORY, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(indexValues.SetCapacity(indexValues.Length() + updateInfoCount,
+                                      fallible)),
+         NS_ERROR_OUT_OF_MEMORY, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   // First construct the full list to update the index_data_values row.
   for (const IndexUpdateInfo& info : updateInfos) {
     MOZ_ALWAYS_TRUE(indexValues.InsertElementSorted(
         IndexDataValue(metadata.id(), metadata.unique(), info.value(),
                        info.localizedValue()),
         fallible));
   }
 
-  IDB_TRY_UNWRAP((auto [indexValuesBlob, indexValuesBlobLength]),
-                 MakeCompressedIndexDataValues(indexValues));
+  QM_TRY_UNWRAP((auto [indexValuesBlob, indexValuesBlobLength]),
+                MakeCompressedIndexDataValues(indexValues));
 
   MOZ_ASSERT(!indexValuesBlobLength == !(indexValuesBlob.get()));
 
   nsCOMPtr<nsIVariant> value;
 
   if (!indexValuesBlob) {
     value = new storage::NullVariant();
 
@@ -18802,17 +18782,17 @@ CreateIndexOp::UpdateIndexDataValuesFunc
     for (const IndexUpdateInfo& info : updateInfos) {
       MOZ_ALWAYS_TRUE(indexValues.InsertElementSorted(
           IndexDataValue(metadata.id(), metadata.unique(), info.value(),
                          info.localizedValue()),
           fallible));
     }
   }
 
-  IDB_TRY(InsertIndexTableRows(mConnection, objectStoreId, key, indexValues));
+  QM_TRY(InsertIndexTableRows(mConnection, objectStoreId, key, indexValues));
 
   value = new storage::AdoptedBlobVariant(
       std::pair(indexValuesBlob.release(), indexValuesBlobLength));
 
   value.forget(_retval);
   return NS_OK;
 }
 
@@ -18838,29 +18818,29 @@ nsresult DeleteIndexOp::RemoveReferences
   MOZ_ASSERT(!aObjectStoreKey.IsUnset());
   MOZ_ASSERT_IF(!mIsLastIndex, !aIndexValues.IsEmpty());
 
   AUTO_PROFILER_LABEL("DeleteIndexOp::RemoveReferencesToIndex", DOM);
 
   if (mIsLastIndex) {
     // There is no need to parse the previous entry in the index_data_values
     // column if this is the last index. Simply set it to NULL.
-    IDB_TRY_INSPECT(const auto& stmt,
-                    aConnection->BorrowCachedStatement(
-                        "UPDATE object_data "
-                        "SET index_data_values = NULL "
-                        "WHERE object_store_id = :"_ns +
-                        kStmtParamNameObjectStoreId + " AND key = :"_ns +
-                        kStmtParamNameKey + ";"_ns));
-
-    IDB_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId));
-
-    IDB_TRY(aObjectStoreKey.BindToStatement(&*stmt, kStmtParamNameKey));
-
-    IDB_TRY(stmt->Execute());
+    QM_TRY_INSPECT(const auto& stmt,
+                   aConnection->BorrowCachedStatement(
+                       "UPDATE object_data "
+                       "SET index_data_values = NULL "
+                       "WHERE object_store_id = :"_ns +
+                       kStmtParamNameObjectStoreId + " AND key = :"_ns +
+                       kStmtParamNameKey + ";"_ns));
+
+    QM_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId));
+
+    QM_TRY(aObjectStoreKey.BindToStatement(&*stmt, kStmtParamNameKey));
+
+    QM_TRY(stmt->Execute());
 
     return NS_OK;
   }
 
   {
     IndexDataValue search;
     search.mIndexId = mIndexId;
 
@@ -18881,37 +18861,37 @@ nsresult DeleteIndexOp::RemoveReferences
     if (beginRange == end) {
       IDB_REPORT_INTERNAL_ERR();
       return NS_ERROR_FILE_CORRUPTED;
     }
 
     aIndexValues.RemoveElementsAt(beginRange - begin, endRange - beginRange);
   }
 
-  IDB_TRY(UpdateIndexValues(aConnection, mObjectStoreId, aObjectStoreKey,
-                            aIndexValues));
+  QM_TRY(UpdateIndexValues(aConnection, mObjectStoreId, aObjectStoreKey,
+                           aIndexValues));
 
   return NS_OK;
 }
 
 nsresult DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
 #ifdef DEBUG
   {
     // Make sure |mIsLastIndex| is telling the truth.
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(const auto& stmt,
-                    aConnection->BorrowCachedStatement(
-                        "SELECT id "
-                        "FROM object_store_index "
-                        "WHERE object_store_id = :object_store_id;"_ns),
-                    QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const auto& stmt,
+                   aConnection->BorrowCachedStatement(
+                       "SELECT id "
+                       "FROM object_store_index "
+                       "WHERE object_store_id = :object_store_id;"_ns),
+                   QM_ASSERT_UNREACHABLE);
 
     MOZ_ALWAYS_SUCCEEDS(stmt->BindInt64ByIndex(0, mObjectStoreId));
 
     bool foundThisIndex = false;
     bool foundOtherIndex = false;
 
     while (true) {
       bool hasResult;
@@ -18934,27 +18914,27 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
     MOZ_ASSERT_IF(mIsLastIndex, foundThisIndex && !foundOtherIndex);
     MOZ_ASSERT_IF(!mIsLastIndex, foundThisIndex && foundOtherIndex);
   }
 #endif
 
   AUTO_PROFILER_LABEL("DeleteIndexOp::DoDatabaseWork", DOM);
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   // mozStorage warns that these statements trigger a sort operation but we
   // don't care because this is a very rare call and we expect it to be slow.
   // The cost of having an index on this field is too high.
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& selectStmt,
       aConnection->BorrowCachedStatement(
           mUnique
               ? (mIsLastIndex
                      ? "/* do not warn (bug someone else) */ "
                        "SELECT value, object_data_key "
                        "FROM unique_index_data "
                        "WHERE index_id = :"_ns +
@@ -18989,27 +18969,27 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
                        "JOIN object_data "
                        "ON index_data.object_data_key = object_data.key "
                        "WHERE index_data.index_id = :"_ns +
                            kStmtParamNameIndexId +
                            " AND object_data.object_store_id = :"_ns +
                            kStmtParamNameObjectStoreId +
                            " ORDER BY index_data.object_data_key ASC;"_ns)));
 
-  IDB_TRY(selectStmt->BindInt64ByName(kStmtParamNameIndexId, mIndexId));
+  QM_TRY(selectStmt->BindInt64ByName(kStmtParamNameIndexId, mIndexId));
 
   if (!mUnique || !mIsLastIndex) {
-    IDB_TRY(selectStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
-                                        mObjectStoreId));
+    QM_TRY(selectStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
+                                       mObjectStoreId));
   }
 
   Key lastObjectStoreKey;
   IndexDataValuesAutoArray lastIndexValues;
 
-  IDB_TRY(CollectWhileHasResult(
+  QM_TRY(CollectWhileHasResult(
       *selectStmt,
       [this, &aConnection, &lastObjectStoreKey, &lastIndexValues,
        deleteIndexRowStmt =
            DatabaseConnection::LazyStatement{
                *aConnection,
                mUnique
                    ? "DELETE FROM unique_index_data "
                      "WHERE index_id = :"_ns +
@@ -19018,107 +18998,107 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
                    : "DELETE FROM index_data "
                      "WHERE index_id = :"_ns +
                          kStmtParamNameIndexId + " AND value = :"_ns +
                          kStmtParamNameValue + " AND object_data_key = :"_ns +
                          kStmtParamNameObjectDataKey + ";"_ns}](
           auto& selectStmt) mutable -> Result<Ok, nsresult> {
         // We always need the index key to delete the index row.
         Key indexKey;
-        IDB_TRY(indexKey.SetFromStatement(&selectStmt, 0));
-
-        IDB_TRY(OkIf(!indexKey.IsUnset()), Err(NS_ERROR_FILE_CORRUPTED),
-                IDB_REPORT_INTERNAL_ERR_LAMBDA);
+        QM_TRY(indexKey.SetFromStatement(&selectStmt, 0));
+
+        QM_TRY(OkIf(!indexKey.IsUnset()), Err(NS_ERROR_FILE_CORRUPTED),
+               IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
         // Don't call |lastObjectStoreKey.BindToStatement()| directly because we
         // don't want to copy the same key multiple times.
         const uint8_t* objectStoreKeyData;
         uint32_t objectStoreKeyDataLength;
-        IDB_TRY(selectStmt.GetSharedBlob(1, &objectStoreKeyDataLength,
-                                         &objectStoreKeyData));
-
-        IDB_TRY(OkIf(objectStoreKeyDataLength), Err(NS_ERROR_FILE_CORRUPTED),
-                IDB_REPORT_INTERNAL_ERR_LAMBDA);
+        QM_TRY(selectStmt.GetSharedBlob(1, &objectStoreKeyDataLength,
+                                        &objectStoreKeyData));
+
+        QM_TRY(OkIf(objectStoreKeyDataLength), Err(NS_ERROR_FILE_CORRUPTED),
+               IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
         const nsDependentCString currentObjectStoreKeyBuffer(
             reinterpret_cast<const char*>(objectStoreKeyData),
             objectStoreKeyDataLength);
         if (currentObjectStoreKeyBuffer != lastObjectStoreKey.GetBuffer()) {
           // We just walked to the next object store key.
           if (!lastObjectStoreKey.IsUnset()) {
             // Before we move on to the next key we need to update the previous
             // key's index_data_values column.
-            IDB_TRY(RemoveReferencesToIndex(aConnection, lastObjectStoreKey,
-                                            lastIndexValues));
+            QM_TRY(RemoveReferencesToIndex(aConnection, lastObjectStoreKey,
+                                           lastIndexValues));
           }
 
           // Save the object store key.
           lastObjectStoreKey = Key(currentObjectStoreKeyBuffer);
 
           // And the |index_data_values| row if this isn't the only index.
           if (!mIsLastIndex) {
             lastIndexValues.ClearAndRetainStorage();
-            IDB_TRY(
+            QM_TRY(
                 ReadCompressedIndexDataValues(selectStmt, 2, lastIndexValues));
 
-            IDB_TRY(OkIf(!lastIndexValues.IsEmpty()),
-                    Err(NS_ERROR_FILE_CORRUPTED),
-                    IDB_REPORT_INTERNAL_ERR_LAMBDA);
+            QM_TRY(OkIf(!lastIndexValues.IsEmpty()),
+                   Err(NS_ERROR_FILE_CORRUPTED),
+                   IDB_REPORT_INTERNAL_ERR_LAMBDA);
           }
         }
 
         // Now delete the index row.
         {
-          IDB_TRY_INSPECT(const auto& borrowedDeleteIndexRowStmt,
-                          deleteIndexRowStmt.Borrow());
-
-          IDB_TRY(borrowedDeleteIndexRowStmt->BindInt64ByName(
+          QM_TRY_INSPECT(const auto& borrowedDeleteIndexRowStmt,
+                         deleteIndexRowStmt.Borrow());
+
+          QM_TRY(borrowedDeleteIndexRowStmt->BindInt64ByName(
               kStmtParamNameIndexId, mIndexId));
 
-          IDB_TRY(indexKey.BindToStatement(&*borrowedDeleteIndexRowStmt,
-                                           kStmtParamNameValue));
+          QM_TRY(indexKey.BindToStatement(&*borrowedDeleteIndexRowStmt,
+                                          kStmtParamNameValue));
 
           if (!mUnique) {
-            IDB_TRY(lastObjectStoreKey.BindToStatement(
+            QM_TRY(lastObjectStoreKey.BindToStatement(
                 &*borrowedDeleteIndexRowStmt, kStmtParamNameObjectDataKey));
           }
 
-          IDB_TRY(borrowedDeleteIndexRowStmt->Execute());
+          QM_TRY(borrowedDeleteIndexRowStmt->Execute());
         }
 
         return Ok{};
       }));
 
   // Take care of the last key.
   if (!lastObjectStoreKey.IsUnset()) {
     MOZ_ASSERT_IF(!mIsLastIndex, !lastIndexValues.IsEmpty());
 
-    IDB_TRY(RemoveReferencesToIndex(aConnection, lastObjectStoreKey,
-                                    lastIndexValues));
-  }
-
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+    QM_TRY(RemoveReferencesToIndex(aConnection, lastObjectStoreKey,
+                                   lastIndexValues));
+  }
+
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "DELETE FROM object_store_index "
       "WHERE id = :index_id;"_ns,
       [indexId = mIndexId](mozIStorageStatement& deleteStmt) -> nsresult {
-        IDB_TRY(deleteStmt.BindInt64ByIndex(0, indexId));
+        QM_TRY(deleteStmt.BindInt64ByIndex(0, indexId));
 
         return NS_OK;
       }));
 
 #ifdef DEBUG
   {
     int32_t deletedRowCount;
     MOZ_ALWAYS_SUCCEEDS(aConnection->MutableStorageConnection().GetAffectedRows(
         &deletedRowCount));
     MOZ_ASSERT(deletedRowCount == 1);
   }
 #endif
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 nsresult RenameIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
@@ -19126,86 +19106,86 @@ nsresult RenameIndexOp::DoDatabaseWork(D
 
 #ifdef DEBUG
   {
     // Make sure that we're not renaming an index with the same name as another
     // that already exists. This should be impossible because we should have
     // thrown an error long before now...
     // The parameter names are not used, parameters are bound by index only
     // locally in the same function.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const bool& hasResult,
         aConnection
             ->BorrowAndExecuteSingleStepStatement(
                 "SELECT name "
                 "FROM object_store_index "
                 "WHERE object_store_id = :object_store_id "
                 "AND name = :name "
                 "AND id != :id;"_ns,
                 [&self = *this](auto& stmt) -> Result<Ok, nsresult> {
-                  IDB_TRY(stmt.BindInt64ByIndex(0, self.mObjectStoreId));
-                  IDB_TRY(stmt.BindStringByIndex(1, self.mNewName));
-                  IDB_TRY(stmt.BindInt64ByIndex(2, self.mIndexId));
+                  QM_TRY(stmt.BindInt64ByIndex(0, self.mObjectStoreId));
+                  QM_TRY(stmt.BindStringByIndex(1, self.mNewName));
+                  QM_TRY(stmt.BindInt64ByIndex(2, self.mIndexId));
 
                   return Ok{};
                 })
             .map(IsSome),
         QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(!hasResult);
   }
 #else
   Unused << mObjectStoreId;
 #endif
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(aConnection->ExecuteCachedStatement(
+  QM_TRY(aConnection->ExecuteCachedStatement(
       "UPDATE object_store_index "
       "SET name = :name "
       "WHERE id = :id;"_ns,
       [&self = *this](mozIStorageStatement& stmt) -> nsresult {
-        IDB_TRY(stmt.BindStringByIndex(0, self.mNewName));
-
-        IDB_TRY(stmt.BindInt64ByIndex(1, self.mIndexId));
+        QM_TRY(stmt.BindStringByIndex(0, self.mNewName));
+
+        QM_TRY(stmt.BindInt64ByIndex(1, self.mIndexId));
 
         return NS_OK;
       }));
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 Result<bool, nsresult> NormalTransactionOp::ObjectStoreHasIndexes(
     DatabaseConnection& aConnection, const IndexOrObjectStoreId aObjectStoreId,
     const bool aMayHaveIndexes) {
   aConnection.AssertIsOnConnectionThread();
   MOZ_ASSERT(aObjectStoreId);
 
   if (Transaction().GetMode() == IDBTransaction::Mode::VersionChange &&
       aMayHaveIndexes) {
     // If this is a version change transaction then mObjectStoreMayHaveIndexes
     // could be wrong (e.g. if a unique index failed to be created due to a
     // constraint error). We have to check on this thread by asking the database
     // directly.
-    IDB_TRY_RETURN(DatabaseOperationBase::ObjectStoreHasIndexes(
-        aConnection, aObjectStoreId));
-  }
-
-#ifdef DEBUG
-  IDB_TRY_INSPECT(
+    QM_TRY_RETURN(DatabaseOperationBase::ObjectStoreHasIndexes(aConnection,
+                                                               aObjectStoreId));
+  }
+
+#ifdef DEBUG
+  QM_TRY_INSPECT(
       const bool& hasIndexes,
       DatabaseOperationBase::ObjectStoreHasIndexes(aConnection, aObjectStoreId),
       QM_ASSERT_UNREACHABLE);
   MOZ_ASSERT(aMayHaveIndexes == hasIndexes);
 #endif
 
   return aMayHaveIndexes;
 }
@@ -19213,17 +19193,17 @@ Result<bool, nsresult> NormalTransaction
 Result<PreprocessParams, nsresult> NormalTransactionOp::GetPreprocessParams() {
   return PreprocessParams{};
 }
 
 nsresult NormalTransactionOp::SendPreprocessInfo() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(!IsActorDestroyed());
 
-  IDB_TRY_INSPECT(const auto& params, GetPreprocessParams());
+  QM_TRY_INSPECT(const auto& params, GetPreprocessParams());
 
   MOZ_ASSERT(params.type() != PreprocessParams::T__None);
 
   if (NS_WARN_IF(!PBackgroundIDBRequestParent::SendPreprocess(params))) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
@@ -19375,48 +19355,48 @@ nsresult ObjectStoreAddOrPutRequestOp::R
     DatabaseConnection* aConnection) {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(aConnection);
   MOZ_ASSERT(mOverwrite);
   MOZ_ASSERT(!mResponse.IsUnset());
 
 #ifdef DEBUG
   {
-    IDB_TRY_INSPECT(const bool& hasIndexes,
-                    DatabaseOperationBase::ObjectStoreHasIndexes(
-                        *aConnection, mParams.objectStoreId()),
-                    QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const bool& hasIndexes,
+                   DatabaseOperationBase::ObjectStoreHasIndexes(
+                       *aConnection, mParams.objectStoreId()),
+                   QM_ASSERT_UNREACHABLE);
 
     MOZ_ASSERT(hasIndexes,
                "Don't use this slow method if there are no indexes!");
   }
 #endif
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& indexValuesStmt,
       aConnection->BorrowAndExecuteSingleStepStatement(
           "SELECT index_data_values "
           "FROM object_data "
           "WHERE object_store_id = :"_ns +
               kStmtParamNameObjectStoreId + " AND key = :"_ns +
               kStmtParamNameKey + ";"_ns,
           [&self = *this](auto& stmt) -> mozilla::Result<Ok, nsresult> {
-            IDB_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
-                                         self.mParams.objectStoreId()));
-
-            IDB_TRY(self.mResponse.BindToStatement(&stmt, kStmtParamNameKey));
+            QM_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
+                                        self.mParams.objectStoreId()));
+
+            QM_TRY(self.mResponse.BindToStatement(&stmt, kStmtParamNameKey));
 
             return Ok{};
           }));
 
   if (indexValuesStmt) {
-    IDB_TRY_INSPECT(const auto& existingIndexValues,
-                    ReadCompressedIndexDataValues(**indexValuesStmt, 0));
-
-    IDB_TRY(
+    QM_TRY_INSPECT(const auto& existingIndexValues,
+                   ReadCompressedIndexDataValues(**indexValuesStmt, 0));
+
+    QM_TRY(
         DeleteIndexDataTableRows(aConnection, mResponse, existingIndexValues));
   }
 
   return NS_OK;
 }
 
 bool ObjectStoreAddOrPutRequestOp::Init(TransactionBase& aTransaction) {
   AssertIsOnOwningThread();
@@ -19449,17 +19429,17 @@ bool ObjectStoreAddOrPutRequestOp::Init(
   } else if (mOverwrite) {
     mUniqueIndexTable.emplace();
   }
 
   if (mUniqueIndexTable.isSome()) {
     mUniqueIndexTable.ref().MarkImmutable();
   }
 
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       mStoredFileInfos,
       TransformIntoNewArray(
           mParams.fileAddInfos(),
           [](const auto& fileAddInfo) {
             MOZ_ASSERT(fileAddInfo.type() == StructuredCloneFileBase::eBlob ||
                        fileAddInfo.type() ==
                            StructuredCloneFileBase::eMutableFile);
 
@@ -19518,60 +19498,60 @@ nsresult ObjectStoreAddOrPutRequestOp::D
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(aConnection->HasStorageConnection());
 
   AUTO_PROFILER_LABEL("ObjectStoreAddOrPutRequestOp::DoDatabaseWork", DOM);
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
-  IDB_TRY_INSPECT(const bool& objectStoreHasIndexes,
-                  ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
-                                        mObjectStoreMayHaveIndexes));
+  QM_TRY_INSPECT(const bool& objectStoreHasIndexes,
+                 ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
+                                       mObjectStoreMayHaveIndexes));
 
   // This will be the final key we use.
   Key& key = mResponse;
   key = mParams.key();
 
   const bool keyUnset = key.IsUnset();
   const IndexOrObjectStoreId osid = mParams.objectStoreId();
 
   // First delete old index_data_values if we're overwriting something and we
   // have indexes.
   if (mOverwrite && !keyUnset && objectStoreHasIndexes) {
-    IDB_TRY(RemoveOldIndexDataValues(aConnection));
+    QM_TRY(RemoveOldIndexDataValues(aConnection));
   }
 
   int64_t autoIncrementNum = 0;
 
   {
     // The "|| keyUnset" here is mostly a debugging tool. If a key isn't
     // specified we should never have a collision and so it shouldn't matter
     // if we allow overwrite or not. By not allowing overwrite we raise
     // detectable errors rather than corrupting data.
     const auto optReplaceDirective =
         (!mOverwrite || keyUnset) ? ""_ns : "OR REPLACE "_ns;
-    IDB_TRY_INSPECT(const auto& stmt,
-                    aConnection->BorrowCachedStatement(
-                        "INSERT "_ns + optReplaceDirective +
-                        "INTO object_data "
-                        "(object_store_id, key, file_ids, data) "
-                        "VALUES (:"_ns +
-                        kStmtParamNameObjectStoreId + ", :"_ns +
-                        kStmtParamNameKey + ", :"_ns + kStmtParamNameFileIds +
-                        ", :"_ns + kStmtParamNameData + ");"_ns));
-
-    IDB_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, osid));
+    QM_TRY_INSPECT(const auto& stmt,
+                   aConnection->BorrowCachedStatement(
+                       "INSERT "_ns + optReplaceDirective +
+                       "INTO object_data "
+                       "(object_store_id, key, file_ids, data) "
+                       "VALUES (:"_ns +
+                       kStmtParamNameObjectStoreId + ", :"_ns +
+                       kStmtParamNameKey + ", :"_ns + kStmtParamNameFileIds +
+                       ", :"_ns + kStmtParamNameData + ");"_ns));
+
+    QM_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, osid));
 
     const SerializedStructuredCloneWriteInfo& cloneInfo = mParams.cloneInfo();
     const JSStructuredCloneData& cloneData = cloneInfo.data().data;
     const size_t cloneDataSize = cloneData.Size();
 
     MOZ_ASSERT(!keyUnset || mMetadata->mCommonMetadata.autoIncrement(),
                "Should have key unless autoIncrement");
 
@@ -19640,17 +19620,17 @@ nsresult ObjectStoreAddOrPutRequestOp::D
 
       uint32_t flags = 0;
       flags |= kCompressedFlag;
 
       const uint32_t index = mStoredFileInfos.Length() - 1;
 
       const int64_t data = (uint64_t(flags) << 32) | index;
 
-      IDB_TRY(stmt->BindInt64ByName(kStmtParamNameData, data));
+      QM_TRY(stmt->BindInt64ByName(kStmtParamNameData, data));
     } else {
       nsCString flatCloneData;
       if (!flatCloneData.SetLength(cloneDataSize, fallible)) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
       {
         auto iter = cloneData.Start();
         MOZ_ALWAYS_TRUE(cloneData.ReadBytes(iter, flatCloneData.BeginWriting(),
@@ -19671,109 +19651,109 @@ nsresult ObjectStoreAddOrPutRequestOp::D
 
       snappy::RawCompress(uncompressed, uncompressedLength, compressed.get(),
                           &compressedLength);
 
       uint8_t* const dataBuffer =
           reinterpret_cast<uint8_t*>(compressed.release());
       const size_t dataBufferLength = compressedLength;
 
-      IDB_TRY(stmt->BindAdoptedBlobByName(kStmtParamNameData, dataBuffer,
-                                          dataBufferLength));
+      QM_TRY(stmt->BindAdoptedBlobByName(kStmtParamNameData, dataBuffer,
+                                         dataBufferLength));
     }
 
     if (!mStoredFileInfos.IsEmpty()) {
       // Moved outside the loop to allow it to be cached when demanded by the
       // first write.  (We may have mStoredFileInfos without any required
       // writes.)
       Maybe<FileHelper> fileHelper;
       nsAutoString fileIds;
 
       for (auto& storedFileInfo : mStoredFileInfos) {
         MOZ_ASSERT(storedFileInfo.IsValid());
 
-        IDB_TRY_INSPECT(const auto& inputStream,
-                        storedFileInfo.GetInputStream());
+        QM_TRY_INSPECT(const auto& inputStream,
+                       storedFileInfo.GetInputStream());
 
         if (inputStream) {
           if (fileHelper.isNothing()) {
             fileHelper.emplace(Transaction().GetDatabase().GetFileManagerPtr());
-            IDB_TRY(fileHelper->Init(), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-                    IDB_REPORT_INTERNAL_ERR_LAMBDA);
+            QM_TRY(fileHelper->Init(), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+                   IDB_REPORT_INTERNAL_ERR_LAMBDA);
           }
 
           const FileInfo& fileInfo = storedFileInfo.GetFileInfo();
 
           const auto file = fileHelper->GetFile(fileInfo);
-          IDB_TRY(OkIf(file), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-                  IDB_REPORT_INTERNAL_ERR_LAMBDA);
+          QM_TRY(OkIf(file), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+                 IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
           const auto journalFile = fileHelper->GetJournalFile(fileInfo);
-          IDB_TRY(OkIf(journalFile), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-                  IDB_REPORT_INTERNAL_ERR_LAMBDA);
-
-          IDB_TRY(
+          QM_TRY(OkIf(journalFile), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+                 IDB_REPORT_INTERNAL_ERR_LAMBDA);
+
+          QM_TRY(
               ToResult(fileHelper->CreateFileFromStream(
                            *file, *journalFile, *inputStream,
                            storedFileInfo.ShouldCompress(),
                            Transaction().GetDatabase().MaybeKeyRef()))
                   .mapErr([](const nsresult rv) {
                     if (NS_ERROR_GET_MODULE(rv) !=
                         NS_ERROR_MODULE_DOM_INDEXEDDB) {
                       IDB_REPORT_INTERNAL_ERR();
                       return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
                     }
                     return rv;
                   }),
               QM_PROPAGATE,
               ([this, &file = *file, &journalFile = *journalFile](const auto) {
                 // Try to remove the file if the copy failed.
-                IDB_TRY(
+                QM_TRY(
                     Transaction().GetDatabase().GetFileManager().SyncDeleteFile(
                         file, journalFile),
                     QM_VOID);
               }));
 
           storedFileInfo.NotifyWriteSucceeded();
         }
 
         if (!fileIds.IsEmpty()) {
           fileIds.Append(' ');
         }
         storedFileInfo.Serialize(fileIds);
       }
 
-      IDB_TRY(stmt->BindStringByName(kStmtParamNameFileIds, fileIds));
+      QM_TRY(stmt->BindStringByName(kStmtParamNameFileIds, fileIds));
     } else {
-      IDB_TRY(stmt->BindNullByName(kStmtParamNameFileIds));
-    }
-
-    IDB_TRY(stmt->Execute(), QM_PROPAGATE,
-            [keyUnset = DebugOnly{keyUnset}](const nsresult rv) {
-              if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
-                MOZ_ASSERT(!keyUnset, "Generated key had a collision!");
-              }
-            });
+      QM_TRY(stmt->BindNullByName(kStmtParamNameFileIds));
+    }
+
+    QM_TRY(stmt->Execute(), QM_PROPAGATE,
+           [keyUnset = DebugOnly{keyUnset}](const nsresult rv) {
+             if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
+               MOZ_ASSERT(!keyUnset, "Generated key had a collision!");
+             }
+           });
   }
 
   // Update our indexes if needed.
   if (!mParams.indexUpdateInfos().IsEmpty()) {
     MOZ_ASSERT(mUniqueIndexTable.isSome());
 
     // Write the index_data_values column.
-    IDB_TRY_INSPECT(const auto& indexValues,
-                    IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(),
-                                                   mUniqueIndexTable.ref()));
-
-    IDB_TRY(UpdateIndexValues(aConnection, osid, key, indexValues));
-
-    IDB_TRY(InsertIndexTableRows(aConnection, osid, key, indexValues));
-  }
-
-  IDB_TRY(autoSave.Commit());
+    QM_TRY_INSPECT(const auto& indexValues,
+                   IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(),
+                                                  mUniqueIndexTable.ref()));
+
+    QM_TRY(UpdateIndexValues(aConnection, osid, key, indexValues));
+
+    QM_TRY(InsertIndexTableRows(aConnection, osid, key, indexValues));
+  }
+
+  QM_TRY(autoSave.Commit());
 
   if (autoIncrementNum) {
     {
       auto&& lockedAutoIncrementIds = mMetadata->mAutoIncrementIds.Lock();
 
       lockedAutoIncrementIds->next = autoIncrementNum + 1;
     }
 
@@ -19893,19 +19873,18 @@ Result<T, nsresult> ObjectStoreGetReques
   static_assert(std::is_same_v<T, SerializedStructuredCloneReadInfo> ||
                 std::is_same_v<T, PreprocessInfo>);
 
   if constexpr (std::is_same_v<T, SerializedStructuredCloneReadInfo>) {
     result.data().data = aInfo.ReleaseData();
     result.hasPreprocessInfo() = aInfo.HasPreprocessInfo();
   }
 
-  IDB_TRY_UNWRAP(
-      result.files(),
-      SerializeStructuredCloneFiles(mBackgroundParent, mDatabase, aInfo.Files(),
+  QM_TRY_UNWRAP(result.files(), SerializeStructuredCloneFiles(
+                                    mBackgroundParent, mDatabase, aInfo.Files(),
                                     std::is_same_v<T, PreprocessInfo>));
 
   return result;
 }
 
 nsresult ObjectStoreGetRequestOp::DoDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
@@ -19919,37 +19898,37 @@ nsresult ObjectStoreGetRequestOp::DoData
       "SELECT file_ids, data "
       "FROM object_data "
       "WHERE object_store_id = :"_ns +
       kStmtParamNameObjectStoreId +
       MaybeGetBindingClauseForKeyRange(mOptionalKeyRange, kColumnNameKey) +
       " ORDER BY key ASC"_ns +
       (mLimit ? kOpenLimit + IntToCString(mLimit) : EmptyCString());
 
-  IDB_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId));
+  QM_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId));
 
   if (mOptionalKeyRange.isSome()) {
-    IDB_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
-  }
-
-  IDB_TRY(CollectWhileHasResult(
+    QM_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
+  }
+
+  QM_TRY(CollectWhileHasResult(
       *stmt, [this](auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
-        IDB_TRY_UNWRAP(auto cloneInfo,
-                       GetStructuredCloneReadInfoFromStatement(
-                           &stmt, 1, 0, mDatabase->GetFileManager(),
-                           mDatabase->MaybeKeyRef()));
+        QM_TRY_UNWRAP(auto cloneInfo,
+                      GetStructuredCloneReadInfoFromStatement(
+                          &stmt, 1, 0, mDatabase->GetFileManager(),
+                          mDatabase->MaybeKeyRef()));
 
         if (cloneInfo.HasPreprocessInfo()) {
           mPreprocessInfoCount++;
         }
 
-        IDB_TRY(OkIf(mResponse.EmplaceBack(fallible, std::move(cloneInfo))),
-                Err(NS_ERROR_OUT_OF_MEMORY));
+        QM_TRY(OkIf(mResponse.EmplaceBack(fallible, std::move(cloneInfo))),
+               Err(NS_ERROR_OUT_OF_MEMORY));
 
         return Ok{};
       }));
 
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   return NS_OK;
 }
@@ -19967,46 +19946,46 @@ ObjectStoreGetRequestOp::GetPreprocessPa
     auto params = ObjectStoreGetAllPreprocessParams();
 
     auto& preprocessInfos = params.preprocessInfos();
     if (NS_WARN_IF(
             !preprocessInfos.SetCapacity(mPreprocessInfoCount, fallible))) {
       return Err(NS_ERROR_OUT_OF_MEMORY);
     }
 
-    IDB_TRY(TransformIfAbortOnErr(
+    QM_TRY(TransformIfAbortOnErr(
         std::make_move_iterator(mResponse.begin()),
         std::make_move_iterator(mResponse.end()),
         MakeBackInserter(preprocessInfos),
         [](const auto& info) { return info.HasPreprocessInfo(); },
         [&self = *this](StructuredCloneReadInfoParent&& info) {
           return self.ConvertResponse<PreprocessInfo>(std::move(info));
         }));
 
     return PreprocessParams{std::move(params)};
   }
 
   auto params = ObjectStoreGetPreprocessParams();
 
-  IDB_TRY_UNWRAP(params.preprocessInfo(),
-                 ConvertResponse<PreprocessInfo>(std::move(mResponse[0])));
+  QM_TRY_UNWRAP(params.preprocessInfo(),
+                ConvertResponse<PreprocessInfo>(std::move(mResponse[0])));
 
   return PreprocessParams{std::move(params)};
 }
 
 void ObjectStoreGetRequestOp::GetResponse(RequestResponse& aResponse,
                                           size_t* aResponseSize) {
   MOZ_ASSERT_IF(mLimit, mResponse.Length() <= mLimit);
 
   if (mGetAll) {
     aResponse = ObjectStoreGetAllResponse();
     *aResponseSize = 0;
 
     if (!mResponse.IsEmpty()) {
-      IDB_TRY_UNWRAP(
+      QM_TRY_UNWRAP(
           aResponse.get_ObjectStoreGetAllResponse().cloneInfos(),
           TransformIntoNewArrayAbortOnErr(
               std::make_move_iterator(mResponse.begin()),
               std::make_move_iterator(mResponse.end()),
               [this, &aResponseSize](StructuredCloneReadInfoParent&& info) {
                 *aResponseSize += info.Size();
                 return ConvertResponse<SerializedStructuredCloneReadInfo>(
                     std::move(info));
@@ -20021,21 +20000,21 @@ void ObjectStoreGetRequestOp::GetRespons
   aResponse = ObjectStoreGetResponse();
   *aResponseSize = 0;
 
   if (!mResponse.IsEmpty()) {
     SerializedStructuredCloneReadInfo& serializedInfo =
         aResponse.get_ObjectStoreGetResponse().cloneInfo();
 
     *aResponseSize += mResponse[0].Size();
-    IDB_TRY_UNWRAP(serializedInfo,
-                   ConvertResponse<SerializedStructuredCloneReadInfo>(
-                       std::move(mResponse[0])),
-                   QM_VOID,
-                   [&aResponse](const nsresult result) { aResponse = result; });
+    QM_TRY_UNWRAP(serializedInfo,
+                  ConvertResponse<SerializedStructuredCloneReadInfo>(
+                      std::move(mResponse[0])),
+                  QM_VOID,
+                  [&aResponse](const nsresult result) { aResponse = result; });
   }
 }
 
 ObjectStoreGetKeyRequestOp::ObjectStoreGetKeyRequestOp(
     SafeRefPtr<TransactionBase> aTransaction, const RequestParams& aParams,
     bool aGetAll)
     : NormalTransactionOp(std::move(aTransaction)),
       mObjectStoreId(
@@ -20063,36 +20042,36 @@ nsresult ObjectStoreGetKeyRequestOp::DoD
       "SELECT key "
       "FROM object_data "
       "WHERE object_store_id = :"_ns +
       kStmtParamNameObjectStoreId +
       MaybeGetBindingClauseForKeyRange(mOptionalKeyRange, kColumnNameKey) +
       " ORDER BY key ASC"_ns +
       (mLimit ? " LIMIT "_ns + IntToCString(mLimit) : EmptyCString());
 
-  IDB_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
+  QM_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
 
   nsresult rv =
       stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (mOptionalKeyRange.isSome()) {
     rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
-  IDB_TRY(CollectWhileHasResult(
+  QM_TRY(CollectWhileHasResult(
       *stmt, [this](auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
         Key* const key = mResponse.AppendElement(fallible);
-        IDB_TRY(OkIf(key), Err(NS_ERROR_OUT_OF_MEMORY));
-        IDB_TRY(key->SetFromStatement(&stmt, 0));
+        QM_TRY(OkIf(key), Err(NS_ERROR_OUT_OF_MEMORY));
+        QM_TRY(key->SetFromStatement(&stmt, 0));
 
         return Ok{};
       }));
 
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   return NS_OK;
 }
@@ -20139,49 +20118,49 @@ ObjectStoreDeleteRequestOp::ObjectStoreD
 
 nsresult ObjectStoreDeleteRequestOp::DoDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   AUTO_PROFILER_LABEL("ObjectStoreDeleteRequestOp::DoDatabaseWork", DOM);
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
-  IDB_TRY_INSPECT(const bool& objectStoreHasIndexes,
-                  ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
-                                        mObjectStoreMayHaveIndexes));
+  QM_TRY_INSPECT(const bool& objectStoreHasIndexes,
+                 ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
+                                       mObjectStoreMayHaveIndexes));
 
   if (objectStoreHasIndexes) {
-    IDB_TRY(DeleteObjectStoreDataTableRowsWithIndexes(
+    QM_TRY(DeleteObjectStoreDataTableRowsWithIndexes(
         aConnection, mParams.objectStoreId(), Some(mParams.keyRange())));
   } else {
     const auto keyRangeClause =
         GetBindingClauseForKeyRange(mParams.keyRange(), kColumnNameKey);
 
-    IDB_TRY(aConnection->ExecuteCachedStatement(
+    QM_TRY(aConnection->ExecuteCachedStatement(
         "DELETE FROM object_data "
         "WHERE object_store_id = :"_ns +
             kStmtParamNameObjectStoreId + keyRangeClause + ";"_ns,
         [&params = mParams](mozIStorageStatement& stmt) -> nsresult {
-          IDB_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
-                                       params.objectStoreId()));
-
-          IDB_TRY(BindKeyRangeToStatement(params.keyRange(), &stmt));
+          QM_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
+                                      params.objectStoreId()));
+
+          QM_TRY(BindKeyRangeToStatement(params.keyRange(), &stmt));
 
           return NS_OK;
         }));
   }
 
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 ObjectStoreClearRequestOp::ObjectStoreClearRequestOp(
     SafeRefPtr<TransactionBase> aTransaction,
     const ObjectStoreClearParams& aParams)
     : NormalTransactionOp(std::move(aTransaction)),
@@ -20199,88 +20178,88 @@ ObjectStoreClearRequestOp::ObjectStoreCl
 nsresult ObjectStoreClearRequestOp::DoDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL("ObjectStoreClearRequestOp::DoDatabaseWork", DOM);
 
   DatabaseConnection::AutoSavepoint autoSave;
-  IDB_TRY(autoSave.Start(Transaction())
+  QM_TRY(autoSave.Start(Transaction())
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-              ,
-          QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
+             ,
+         QM_PROPAGATE, MakeAutoSavepointCleanupHandler(*aConnection)
 #endif
   );
 
-  IDB_TRY_INSPECT(const bool& objectStoreHasIndexes,
-                  ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
-                                        mObjectStoreMayHaveIndexes));
+  QM_TRY_INSPECT(const bool& objectStoreHasIndexes,
+                 ObjectStoreHasIndexes(*aConnection, mParams.objectStoreId(),
+                                       mObjectStoreMayHaveIndexes));
 
   // The parameter names are not used, parameters are bound by index only
   // locally in the same function.
-  IDB_TRY(objectStoreHasIndexes
-              ? DeleteObjectStoreDataTableRowsWithIndexes(
-                    aConnection, mParams.objectStoreId(), Nothing())
-              : aConnection->ExecuteCachedStatement(
-                    "DELETE FROM object_data "
-                    "WHERE object_store_id = :object_store_id;"_ns,
-                    [objectStoreId = mParams.objectStoreId()](
-                        mozIStorageStatement& stmt) -> nsresult {
-                      IDB_TRY(stmt.BindInt64ByIndex(0, objectStoreId));
-
-                      return NS_OK;
-                    }));
-
-  IDB_TRY(autoSave.Commit());
+  QM_TRY(objectStoreHasIndexes
+             ? DeleteObjectStoreDataTableRowsWithIndexes(
+                   aConnection, mParams.objectStoreId(), Nothing())
+             : aConnection->ExecuteCachedStatement(
+                   "DELETE FROM object_data "
+                   "WHERE object_store_id = :object_store_id;"_ns,
+                   [objectStoreId = mParams.objectStoreId()](
+                       mozIStorageStatement& stmt) -> nsresult {
+                     QM_TRY(stmt.BindInt64ByIndex(0, objectStoreId));
+
+                     return NS_OK;
+                   }));
+
+  QM_TRY(autoSave.Commit());
 
   return NS_OK;
 }
 
 nsresult ObjectStoreCountRequestOp::DoDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 
   AUTO_PROFILER_LABEL("ObjectStoreCountRequestOp::DoDatabaseWork", DOM);
 
   const auto keyRangeClause = MaybeGetBindingClauseForKeyRange(
       mParams.optionalKeyRange(), kColumnNameKey);
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& maybeStmt,
       aConnection->BorrowAndExecuteSingleStepStatement(
           "SELECT count(*) "
           "FROM object_data "
           "WHERE object_store_id = :"_ns +
               kStmtParamNameObjectStoreId + keyRangeClause,
           [&params = mParams](auto& stmt) -> mozilla::Result<Ok, nsresult> {
-            IDB_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
-                                         params.objectStoreId()));
+            QM_TRY(stmt.BindInt64ByName(kStmtParamNameObjectStoreId,
+                                        params.objectStoreId()));
 
             if (params.optionalKeyRange().isSome()) {
-              IDB_TRY(BindKeyRangeToStatement(params.optionalKeyRange().ref(),
-                                              &stmt));
+              QM_TRY(BindKeyRangeToStatement(params.optionalKeyRange().ref(),
+                                             &stmt));
             }
 
             return Ok{};
           }));
 
-  IDB_TRY(OkIf(maybeStmt.isSome()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-          [](const auto) {
-            // XXX Why do we have an assertion here, but not at most other
-            // places using IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
-            MOZ_ASSERT(false, "This should never be possible!");
-            IDB_REPORT_INTERNAL_ERR();
-          });
+  QM_TRY(OkIf(maybeStmt.isSome()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+         [](const auto) {
+           // XXX Why do we have an assertion here, but not at most other
+           // places using IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
+           MOZ_ASSERT(false, "This should never be possible!");
+           IDB_REPORT_INTERNAL_ERR();
+         });
 
   const auto& stmt = *maybeStmt;
 
   const int64_t count = stmt->AsInt64(0);
-  IDB_TRY(OkIf(count >= 0), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, [](const auto) {
+  QM_TRY(OkIf(count >= 0), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, [](const auto) {
     // XXX Why do we have an assertion here, but not at most other places using
     // IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
     MOZ_ASSERT(false, "This should never be possible!");
     IDB_REPORT_INTERNAL_ERR();
   });
 
   mResponse.count() = count;
 
@@ -20375,17 +20354,17 @@ nsresult IndexGetRequestOp::DoDatabaseWo
   MOZ_ASSERT_IF(!mGetAll, mLimit == 1);
 
   AUTO_PROFILER_LABEL("IndexGetRequestOp::DoDatabaseWork", DOM);
 
   const auto indexTable = mMetadata->mCommonMetadata.unique()
                               ? "unique_index_data "_ns
                               : "index_data "_ns;
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& stmt,
       aConnection->BorrowCachedStatement(
           "SELECT file_ids, data "
           "FROM object_data "
           "INNER JOIN "_ns +
           indexTable +
           "AS index_table "
           "ON object_data.object_store_id = "
@@ -20393,37 +20372,37 @@ nsresult IndexGetRequestOp::DoDatabaseWo
           "AND object_data.key = "
           "index_table.object_data_key "
           "WHERE index_id = :"_ns +
           kStmtParamNameIndexId +
           MaybeGetBindingClauseForKeyRange(mOptionalKeyRange,
                                            kColumnNameValue) +
           (mLimit ? kOpenLimit + IntToCString(mLimit) : EmptyCString())));
 
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameIndexId,
-                                mMetadata->mCommonMetadata.id()));
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameIndexId,
+                               mMetadata->mCommonMetadata.id()));
 
   if (mOptionalKeyRange.isSome()) {
-    IDB_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
-  }
-
-  IDB_TRY(CollectWhileHasResult(
+    QM_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
+  }
+
+  QM_TRY(CollectWhileHasResult(
       *stmt, [this](auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
-        IDB_TRY_UNWRAP(auto cloneInfo,
-                       GetStructuredCloneReadInfoFromStatement(
-                           &stmt, 1, 0, mDatabase->GetFileManager(),
-                           mDatabase->MaybeKeyRef()));
+        QM_TRY_UNWRAP(auto cloneInfo,
+                      GetStructuredCloneReadInfoFromStatement(
+                          &stmt, 1, 0, mDatabase->GetFileManager(),
+                          mDatabase->MaybeKeyRef()));
 
         if (cloneInfo.HasPreprocessInfo()) {
           IDB_WARNING("Preprocessing for indexes not yet implemented!");
           return Err(NS_ERROR_NOT_IMPLEMENTED);
         }
 
-        IDB_TRY(OkIf(mResponse.EmplaceBack(fallible, std::move(cloneInfo))),
-                Err(NS_ERROR_OUT_OF_MEMORY));
+        QM_TRY(OkIf(mResponse.EmplaceBack(fallible, std::move(cloneInfo))),
+               Err(NS_ERROR_OUT_OF_MEMORY));
 
         return Ok{};
       }));
 
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   return NS_OK;
 }
@@ -20434,29 +20413,29 @@ void IndexGetRequestOp::GetResponse(Requ
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   auto convertResponse = [this](StructuredCloneReadInfoParent&& info)
       -> mozilla::Result<SerializedStructuredCloneReadInfo, nsresult> {
     SerializedStructuredCloneReadInfo result;
 
     result.data().data = info.ReleaseData();
 
-    IDB_TRY_UNWRAP(result.files(),
-                   SerializeStructuredCloneFiles(mBackgroundParent, mDatabase,
-                                                 info.Files(), false));
+    QM_TRY_UNWRAP(result.files(),
+                  SerializeStructuredCloneFiles(mBackgroundParent, mDatabase,
+                                                info.Files(), false));
 
     return result;
   };
 
   if (mGetAll) {
     aResponse = IndexGetAllResponse();
     *aResponseSize = 0;
 
     if (!mResponse.IsEmpty()) {
-      IDB_TRY_UNWRAP(
+      QM_TRY_UNWRAP(
           aResponse.get_IndexGetAllResponse().cloneInfos(),
           TransformIntoNewArrayAbortOnErr(
               std::make_move_iterator(mResponse.begin()),
               std::make_move_iterator(mResponse.end()),
               [convertResponse,
                &aResponseSize](StructuredCloneReadInfoParent&& info) {
                 *aResponseSize += info.Size();
                 return convertResponse(std::move(info));
@@ -20471,19 +20450,19 @@ void IndexGetRequestOp::GetResponse(Requ
   aResponse = IndexGetResponse();
   *aResponseSize = 0;
 
   if (!mResponse.IsEmpty()) {
     SerializedStructuredCloneReadInfo& serializedInfo =
         aResponse.get_IndexGetResponse().cloneInfo();
 
     *aResponseSize += mResponse[0].Size();
-    IDB_TRY_UNWRAP(serializedInfo, convertResponse(std::move(mResponse[0])),
-                   QM_VOID,
-                   [&aResponse](const nsresult result) { aResponse = result; });
+    QM_TRY_UNWRAP(serializedInfo, convertResponse(std::move(mResponse[0])),
+                  QM_VOID,
+                  [&aResponse](const nsresult result) { aResponse = result; });
   }
 }
 
 IndexGetKeyRequestOp::IndexGetKeyRequestOp(
     SafeRefPtr<TransactionBase> aTransaction, const RequestParams& aParams,
     bool aGetAll)
     : IndexRequestOpBase(std::move(aTransaction), aParams),
       mOptionalKeyRange(
@@ -20512,30 +20491,30 @@ nsresult IndexGetKeyRequestOp::DoDatabas
 
   const nsCString query =
       "SELECT object_data_key "
       "FROM "_ns +
       indexTable + "WHERE index_id = :"_ns + kStmtParamNameIndexId +
       MaybeGetBindingClauseForKeyRange(mOptionalKeyRange, kColumnNameValue) +
       (mLimit ? kOpenLimit + IntToCString(mLimit) : EmptyCString());
 
-  IDB_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameIndexId,
-                                mMetadata->mCommonMetadata.id()));
+  QM_TRY_INSPECT(const auto& stmt, aConnection->BorrowCachedStatement(query));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameIndexId,
+                               mMetadata->mCommonMetadata.id()));
 
   if (hasKeyRange) {
-    IDB_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
-  }
-
-  IDB_TRY(CollectWhileHasResult(
+    QM_TRY(BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt));
+  }
+
+  QM_TRY(CollectWhileHasResult(
       *stmt, [this](auto& stmt) mutable -> mozilla::Result<Ok, nsresult> {
         Key* const key = mResponse.AppendElement(fallible);
-        IDB_TRY(OkIf(key), Err(NS_ERROR_OUT_OF_MEMORY));
-        IDB_TRY(key->SetFromStatement(&stmt, 0));
+        QM_TRY(OkIf(key), Err(NS_ERROR_OUT_OF_MEMORY));
+        QM_TRY(key->SetFromStatement(&stmt, 0));
 
         return Ok{};
       }));
 
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   return NS_OK;
 }
@@ -20573,47 +20552,47 @@ nsresult IndexCountRequestOp::DoDatabase
 
   const auto indexTable = mMetadata->mCommonMetadata.unique()
                               ? "unique_index_data "_ns
                               : "index_data "_ns;
 
   const auto keyRangeClause = MaybeGetBindingClauseForKeyRange(
       mParams.optionalKeyRange(), kColumnNameValue);
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& maybeStmt,
       aConnection->BorrowAndExecuteSingleStepStatement(
           "SELECT count(*) "
           "FROM "_ns +
               indexTable + "WHERE index_id = :"_ns + kStmtParamNameIndexId +
               keyRangeClause,
           [&self = *this](auto& stmt) -> mozilla::Result<Ok, nsresult> {
-            IDB_TRY(stmt.BindInt64ByName(kStmtParamNameIndexId,
-                                         self.mMetadata->mCommonMetadata.id()));
+            QM_TRY(stmt.BindInt64ByName(kStmtParamNameIndexId,
+                                        self.mMetadata->mCommonMetadata.id()));
 
             if (self.mParams.optionalKeyRange().isSome()) {
-              IDB_TRY(BindKeyRangeToStatement(
+              QM_TRY(BindKeyRangeToStatement(
                   self.mParams.optionalKeyRange().ref(), &stmt));
             }
 
             return Ok{};
           }));
 
-  IDB_TRY(OkIf(maybeStmt.isSome()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-          [](const auto) {
-            // XXX Why do we have an assertion here, but not at most other
-            // places using IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
-            MOZ_ASSERT(false, "This should never be possible!");
-            IDB_REPORT_INTERNAL_ERR();
-          });
+  QM_TRY(OkIf(maybeStmt.isSome()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
+         [](const auto) {
+           // XXX Why do we have an assertion here, but not at most other
+           // places using IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
+           MOZ_ASSERT(false, "This should never be possible!");
+           IDB_REPORT_INTERNAL_ERR();
+         });
 
   const auto& stmt = *maybeStmt;
 
   const int64_t count = stmt->AsInt64(0);
-  IDB_TRY(OkIf(count >= 0), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, [](const auto) {
+  QM_TRY(OkIf(count >= 0), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, [](const auto) {
     // XXX Why do we have an assertion here, but not at most other places using
     // IDB_REPORT_INTERNAL_ERR(_LAMBDA)?
     MOZ_ASSERT(false, "This should never be possible!");
     IDB_REPORT_INTERNAL_ERR();
   });
 
   mResponse.count() = count;
 
@@ -20689,37 +20668,37 @@ CursorOpBaseHelperBase<CursorType>::Popu
           (mOp.mResponse.type() ==
                CursorResponse::TArrayOfObjectStoreCursorResponse ||
            mOp.mResponse.type() == CursorResponse::TArrayOfIndexCursorResponse),
       aInitializeResponse);
 
   auto populateResponseHelper = PopulateResponseHelper<CursorType>{mOp};
   auto previousKey = aOptOutSortKey ? std::move(*aOptOutSortKey) : Key{};
 
-  IDB_TRY(populateResponseHelper.GetKeys(aStmt, aOptOutSortKey));
+  QM_TRY(populateResponseHelper.GetKeys(aStmt, aOptOutSortKey));
 
   // aOptOutSortKey must be set iff the cursor is a unique cursor. For unique
   // cursors, we need to skip records with the same key. The SQL queries
   // currently do not filter these out.
   if (aOptOutSortKey && !previousKey.IsUnset() &&
       previousKey == *aOptOutSortKey) {
     return 0;
   }
 
-  IDB_TRY(populateResponseHelper.MaybeGetCloneInfo(aStmt, GetCursor()));
+  QM_TRY(populateResponseHelper.MaybeGetCloneInfo(aStmt, GetCursor()));
 
   // CAUTION: It is important that only the part of the function above this
   // comment may fail, and modifications to the data structure (in particular
   // mResponse and mFiles) may only be made below. This is necessary to allow to
   // discard entries that were attempted to be preloaded without causing an
   // inconsistent state.
 
   if (aInitializeResponse) {
-    mOp.mResponse = std::remove_reference_t<decltype(
-        populateResponseHelper.GetTypedResponse(&mOp.mResponse))>();
+    mOp.mResponse = std::remove_reference_t<
+        decltype(populateResponseHelper.GetTypedResponse(&mOp.mResponse))>();
   }
 
   auto& responses = populateResponseHelper.GetTypedResponse(&mOp.mResponse);
   auto& response = *responses.AppendElement();
 
   populateResponseHelper.FillKeys(response);
   if constexpr (!CursorTypeTraits<CursorType>::IsKeyOnlyCursor) {
     populateResponseHelper.MaybeFillCloneInfo(response, &mOp.mFiles);
@@ -20754,17 +20733,17 @@ void CursorOpBaseHelperBase<CursorType>:
         break;
       }
 
       // PopulateResponseFromStatement does not modify the data in case of
       // failure, so we can just use the results already populated, and discard
       // any remaining entries, and signal overall success. Probably, future
       // attempts to access the same entry will fail as well, but it might never
       // be accessed by the application.
-      IDB_TRY_INSPECT(
+      QM_TRY_INSPECT(
           const auto& responseSize,
           PopulateResponseFromStatement(aStmt, false, aOptPreviousSortKey),
           extraCount, [](const auto&) {
             // TODO: Maybe disable preloading for this cursor? The problem will
             // probably reoccur on the next attempt, and disabling preloading
             // will reduce latency. However, if some problematic entry will be
             // skipped over, after that it might be fine again. To judge this,
             // the causes for such failures would need to be analyzed more
@@ -20815,18 +20794,18 @@ void Cursor<CursorType>::SetOptionalKeyR
     *aOpen =
         !range.isOnly() && (lowerBound ? range.lowerOpen() : range.upperOpen());
 
     const auto& bound =
         (range.isOnly() || lowerBound) ? range.lower() : range.upper();
     if constexpr (IsIndexCursor) {
       if (this->IsLocaleAware()) {
         // XXX Don't we need to propagate the error?
-        IDB_TRY_UNWRAP(localeAwareRangeBound,
-                       bound.ToLocaleAwareKey(this->mLocale), QM_VOID);
+        QM_TRY_UNWRAP(localeAwareRangeBound,
+                      bound.ToLocaleAwareKey(this->mLocale), QM_VOID);
       } else {
         localeAwareRangeBound = bound;
       }
     } else {
       localeAwareRangeBound = bound;
     }
   } else {
     *aOpen = false;
@@ -20954,30 +20933,30 @@ void IndexOpenOpHelper<CursorType>::Prep
   GetCursor().mContinueQueries.init(std::move(continueQuery),
                                     std::move(continueToQuery),
                                     std::move(continuePrimaryKeyQuery));
 }
 
 template <IDBCursorType CursorType>
 nsresult CommonOpenOpHelper<CursorType>::ProcessStatementSteps(
     mozIStorageStatement* const aStmt) {
-  IDB_TRY_INSPECT(const bool& hasResult,
-                  MOZ_TO_RESULT_INVOKE(aStmt, ExecuteStep));
+  QM_TRY_INSPECT(const bool& hasResult,
+                 MOZ_TO_RESULT_INVOKE(aStmt, ExecuteStep));
 
   if (!hasResult) {
     SetResponse(void_t{});
     return NS_OK;
   }
 
   Key previousKey;
   auto* optPreviousKey =
       IsUnique(GetCursor().mDirection) ? &previousKey : nullptr;
 
-  IDB_TRY_INSPECT(const auto& responseSize,
-                  PopulateResponseFromStatement(aStmt, true, optPreviousKey));
+  QM_TRY_INSPECT(const auto& responseSize,
+                 PopulateResponseFromStatement(aStmt, true, optPreviousKey));
 
   // The degree to which extra responses on OpenOp can actually be used depends
   // on the parameters of subsequent ContinueOp operations, see also comment in
   // ContinueOp::DoDatabaseWork.
   //
   // TODO: We should somehow evaluate the effects of this. Maybe use a smaller
   // extra count than for ContinueOp?
   PopulateExtraResponses(aStmt, GetCursor().mMaxExtraCount, responseSize,
@@ -21009,23 +20988,23 @@ nsresult OpenOpHelper<IDBCursorType::Obj
   const auto& directionClause = MakeDirectionClause(GetCursor().mDirection);
 
   // Note: Changing the number or order of SELECT columns in the query will
   // require changes to CursorOpBase::PopulateResponseFromStatement.
   const nsCString firstQuery = queryStart + keyRangeClause + directionClause +
                                kOpenLimit +
                                IntToCString(1 + GetCursor().mMaxExtraCount);
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  aConnection->BorrowCachedStatement(firstQuery));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mObjectStoreId));
+  QM_TRY_INSPECT(const auto& stmt,
+                 aConnection->BorrowCachedStatement(firstQuery));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mObjectStoreId));
 
   if (usingKeyRange) {
-    IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+    QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
         GetOptionalKeyRange().ref(), &*stmt));
   }
 
   // Now we need to make the query for ContinueOp.
   PrepareKeyConditionClauses(directionClause, queryStart);
 
   return ProcessStatementSteps(&*stmt);
 }
@@ -21051,23 +21030,23 @@ nsresult OpenOpHelper<IDBCursorType::Obj
 
   const auto& directionClause = MakeDirectionClause(GetCursor().mDirection);
 
   // Note: Changing the number or order of SELECT columns in the query will
   // require changes to CursorOpBase::PopulateResponseFromStatement.
   const nsCString firstQuery =
       queryStart + keyRangeClause + directionClause + kOpenLimit + "1"_ns;
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  aConnection->BorrowCachedStatement(firstQuery));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mObjectStoreId));
+  QM_TRY_INSPECT(const auto& stmt,
+                 aConnection->BorrowCachedStatement(firstQuery));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mObjectStoreId));
 
   if (usingKeyRange) {
-    IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+    QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
         GetOptionalKeyRange().ref(), &*stmt));
   }
 
   // Now we need to make the query to get the next match.
   PrepareKeyConditionClauses(directionClause, queryStart);
 
   return ProcessStatementSteps(&*stmt);
 }
@@ -21135,27 +21114,27 @@ nsresult OpenOpHelper<IDBCursorType::Ind
   }
 
   // Note: Changing the number or order of SELECT columns in the query will
   // require changes to CursorOpBase::PopulateResponseFromStatement.
   const nsCString firstQuery = queryStart + keyRangeClause + directionClause +
                                kOpenLimit +
                                IntToCString(1 + GetCursor().mMaxExtraCount);
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  aConnection->BorrowCachedStatement(firstQuery));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mIndexId));
+  QM_TRY_INSPECT(const auto& stmt,
+                 aConnection->BorrowCachedStatement(firstQuery));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mIndexId));
 
   if (usingKeyRange) {
     if (GetCursor().IsLocaleAware()) {
-      IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+      QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
           GetOptionalKeyRange().ref(), &*stmt, GetCursor().mLocale));
     } else {
-      IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+      QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
           GetOptionalKeyRange().ref(), &*stmt));
     }
   }
 
   // TODO: At least the last two statements are almost the same in all
   // DoDatabaseWork variants, consider removing this duplication.
 
   // Now we need to make the query to get the next match.
@@ -21217,27 +21196,27 @@ nsresult OpenOpHelper<IDBCursorType::Ind
       MOZ_CRASH("Should never get here!");
   }
 
   // Note: Changing the number or order of SELECT columns in the query will
   // require changes to CursorOpBase::PopulateResponseFromStatement.
   const nsCString firstQuery =
       queryStart + keyRangeClause + directionClause + kOpenLimit + "1"_ns;
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  aConnection->BorrowCachedStatement(firstQuery));
-
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mIndexId));
+  QM_TRY_INSPECT(const auto& stmt,
+                 aConnection->BorrowCachedStatement(firstQuery));
+
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameId, GetCursor().mIndexId));
 
   if (usingKeyRange) {
     if (GetCursor().IsLocaleAware()) {
-      IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+      QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
           GetOptionalKeyRange().ref(), &*stmt, GetCursor().mLocale));
     } else {
-      IDB_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
+      QM_TRY(DatabaseOperationBase::BindKeyRangeToStatement(
           GetOptionalKeyRange().ref(), &*stmt));
     }
   }
 
   // Now we need to make the query to get the next match.
   PrepareKeyConditionClauses(directionClause, std::move(queryStart));
 
   return ProcessStatementSteps(&*stmt);
@@ -21363,73 +21342,72 @@ nsresult Cursor<CursorType>::ContinueOp:
   //
   // Based on that, we could in both cases either preload for any assumed
   // subsequent operations, or only for the basic operations. For now, we
   // preload only for an assumed basic operation. Other operations would require
   // more work on the client side for invalidation, and may not make any sense
   // at all.
   const uint32_t maxExtraCount = hasContinueKey ? 0 : mCursor->mMaxExtraCount;
 
-  IDB_TRY_INSPECT(const auto& stmt,
-                  aConnection->BorrowCachedStatement(
-                      mCursor->mContinueQueries->GetContinueQuery(
-                          hasContinueKey, hasContinuePrimaryKey)));
-
-  IDB_TRY(stmt->BindUTF8StringByName(
+  QM_TRY_INSPECT(const auto& stmt,
+                 aConnection->BorrowCachedStatement(
+                     mCursor->mContinueQueries->GetContinueQuery(
+                         hasContinueKey, hasContinuePrimaryKey)));
+
+  QM_TRY(stmt->BindUTF8StringByName(
       kStmtParamNameLimit,
       IntToCString(advanceCount + mCursor->mMaxExtraCount)));
 
-  IDB_TRY(stmt->BindInt64ByName(kStmtParamNameId, mCursor->Id()));
+  QM_TRY(stmt->BindInt64ByName(kStmtParamNameId, mCursor->Id()));
 
   // Bind current key.
   const auto& continueKey =
       hasContinueKey ? explicitContinueKey
                      : mCurrentPosition.GetSortKey(mCursor->IsLocaleAware());
-  IDB_TRY(continueKey.BindToStatement(&*stmt, kStmtParamNameCurrentKey));
+  QM_TRY(continueKey.BindToStatement(&*stmt, kStmtParamNameCurrentKey));
 
   // Bind range bound if it is specified.
   if (!mCursor->mLocaleAwareRangeBound->IsUnset()) {
-    IDB_TRY(mCursor->mLocaleAwareRangeBound->BindToStatement(
+    QM_TRY(mCursor->mLocaleAwareRangeBound->BindToStatement(
         &*stmt, kStmtParamNameRangeBound));
   }
 
   // Bind object store position if duplicates are allowed and we're not
   // continuing to a specific key.
   if constexpr (IsIndexCursor) {
     if (!hasContinueKey && (mCursor->mDirection == IDBCursorDirection::Next ||
                             mCursor->mDirection == IDBCursorDirection::Prev)) {
-      IDB_TRY(mCurrentPosition.mObjectStoreKey.BindToStatement(
+      QM_TRY(mCurrentPosition.mObjectStoreKey.BindToStatement(
           &*stmt, kStmtParamNameObjectStorePosition));
     } else if (hasContinuePrimaryKey) {
-      IDB_TRY(
+      QM_TRY(
           mParams.get_ContinuePrimaryKeyParams().primaryKey().BindToStatement(
               &*stmt, kStmtParamNameObjectStorePosition));
     }
   }
 
   // TODO: Why do we query the records we don't need and skip them here, rather
   // than using a OFFSET clause in the query?
   for (uint32_t index = 0; index < advanceCount; index++) {
-    IDB_TRY_INSPECT(const bool& hasResult,
-                    MOZ_TO_RESULT_INVOKE(&*stmt, ExecuteStep));
+    QM_TRY_INSPECT(const bool& hasResult,
+                   MOZ_TO_RESULT_INVOKE(&*stmt, ExecuteStep));
 
     if (!hasResult) {
       mResponse = void_t();
       return NS_OK;
     }
   }
 
   Key previousKey;
   auto* const optPreviousKey =
       IsUnique(mCursor->mDirection) ? &previousKey : nullptr;
 
   auto helper = CursorOpBaseHelperBase<CursorType>{*this};
-  IDB_TRY_INSPECT(
-      const auto& responseSize,
-      helper.PopulateResponseFromStatement(&*stmt, true, optPreviousKey));
+  QM_TRY_INSPECT(const auto& responseSize, helper.PopulateResponseFromStatement(
+                                               &*stmt, true, optPreviousKey));
 
   helper.PopulateExtraResponses(&*stmt, maxExtraCount, responseSize,
                                 "ContinueOp"_ns, optPreviousKey);
 
   return NS_OK;
 }
 
 Utils::Utils()
@@ -21584,61 +21562,61 @@ nsCOMPtr<nsIFile> FileHelper::GetJournal
 }
 
 nsresult FileHelper::CreateFileFromStream(nsIFile& aFile, nsIFile& aJournalFile,
                                           nsIInputStream& aInputStream,
                                           bool aCompress,
                                           const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
-  IDB_TRY_INSPECT(const auto& exists, MOZ_TO_RESULT_INVOKE(aFile, Exists));
+  QM_TRY_INSPECT(const auto& exists, MOZ_TO_RESULT_INVOKE(aFile, Exists));
 
   // DOM blobs that are being stored in IDB are cached by calling
   // IDBDatabase::GetOrCreateFileActorForBlob. So if the same DOM blob is stored
   // again under a different key or in a different object store, we just add
   // a new reference instead of creating a new copy (all such stored blobs share
   // the same id).
   // However, it can happen that CreateFileFromStream failed due to quota
   // exceeded error and for some reason the orphaned file couldn't be deleted
   // immediately. Now, if the operation is being repeated, the DOM blob is
   // already cached, so it has the same file id which clashes with the orphaned
   // file. We could do some tricks to restore previous copy loop, but it's safer
   // to just delete the orphaned file and start from scratch.
   // This corner case is partially simulated in test_file_copy_failure.js
   if (exists) {
-    IDB_TRY_INSPECT(const auto& isFile, MOZ_TO_RESULT_INVOKE(aFile, IsFile));
-
-    IDB_TRY(OkIf(isFile), NS_ERROR_FAILURE);
-
-    IDB_TRY_INSPECT(const auto& journalExists,
-                    MOZ_TO_RESULT_INVOKE(aJournalFile, Exists));
-
-    IDB_TRY(OkIf(journalExists), NS_ERROR_FAILURE);
-
-    IDB_TRY_INSPECT(const auto& journalIsFile,
-                    MOZ_TO_RESULT_INVOKE(aJournalFile, IsFile));
-
-    IDB_TRY(OkIf(journalIsFile), NS_ERROR_FAILURE);
+    QM_TRY_INSPECT(const auto& isFile, MOZ_TO_RESULT_INVOKE(aFile, IsFile));
+
+    QM_TRY(OkIf(isFile), NS_ERROR_FAILURE);
+
+    QM_TRY_INSPECT(const auto& journalExists,
+                   MOZ_TO_RESULT_INVOKE(aJournalFile, Exists));
+
+    QM_TRY(OkIf(journalExists), NS_ERROR_FAILURE);
+
+    QM_TRY_INSPECT(const auto& journalIsFile,
+                   MOZ_TO_RESULT_INVOKE(aJournalFile, IsFile));
+
+    QM_TRY(OkIf(journalIsFile), NS_ERROR_FAILURE);
 
     IDB_WARNING("Deleting orphaned file!");
 
-    IDB_TRY(mFileManager->SyncDeleteFile(aFile, aJournalFile));
+    QM_TRY(mFileManager->SyncDeleteFile(aFile, aJournalFile));
   }
 
   // Create a journal file first.
-  IDB_TRY(aJournalFile.Create(nsIFile::NORMAL_FILE_TYPE, 0644));
+  QM_TRY(aJournalFile.Create(nsIFile::NORMAL_FILE_TYPE, 0644));
 
   // Now try to copy the stream.
-  IDB_TRY_UNWRAP(auto fileOutputStream,
-                 CreateFileOutputStream(mFileManager->Type(),
-                                        mFileManager->OriginMetadata(),
-                                        Client::IDB, &aFile)
-                     .map([](NotNull<RefPtr<FileOutputStream>>&& stream) {
-                       return nsCOMPtr<nsIOutputStream>{stream.get()};
-                     }));
+  QM_TRY_UNWRAP(auto fileOutputStream,
+                CreateFileOutputStream(mFileManager->Type(),
+                                       mFileManager->OriginMetadata(),
+                                       Client::IDB, &aFile)
+                    .map([](NotNull<RefPtr<FileOutputStream>>&& stream) {
+                      return nsCOMPtr<nsIOutputStream>{stream.get()};
+                    }));
 
   AutoTArray<char, kFileCopyBufferSize> buffer;
   const auto actualOutputStream =
       [aCompress, &aMaybeKey, &buffer,
        baseOutputStream =
            std::move(fileOutputStream)]() mutable -> nsCOMPtr<nsIOutputStream> {
     if (aMaybeKey) {
       baseOutputStream =
@@ -21655,18 +21633,18 @@ nsresult FileHelper::CreateFileFromStrea
 
       return snappyOutputStream;
     }
 
     buffer.SetLength(kFileCopyBufferSize);
     return std::move(baseOutputStream);
   }();
 
-  IDB_TRY(SyncCopy(aInputStream, *actualOutputStream, buffer.Elements(),
-                   buffer.Length()));
+  QM_TRY(SyncCopy(aInputStream, *actualOutputStream, buffer.Elements(),
+                  buffer.Length()));
 
   return NS_OK;
 }
 
 class FileHelper::ReadCallback final : public nsIInputStreamCallback {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
--- a/dom/indexedDB/ActorsParentCommon.cpp
+++ b/dom/indexedDB/ActorsParentCommon.cpp
@@ -93,17 +93,17 @@ int32_t ToInteger(const nsAString& aStr,
 
 Result<StructuredCloneFileParent, nsresult> DeserializeStructuredCloneFile(
     const FileManager& aFileManager, const nsDependentSubstring& aText) {
   MOZ_ASSERT(!aText.IsEmpty());
 
   const StructuredCloneFileBase::FileType type =
       ToStructuredCloneFileType(aText.First());
 
-  IDB_TRY_INSPECT(
+  QM_TRY_INSPECT(
       const auto& id,
       ToResultGet<int32_t>(
           ToInteger, type == StructuredCloneFileBase::eBlob
                          ? aText
                          : static_cast<const nsAString&>(Substring(aText, 1))));
 
   SafeRefPtr<FileInfo> fileInfo = aFileManager.GetFileInfo(id);
   MOZ_ASSERT(fileInfo);
@@ -149,17 +149,17 @@ class SandboxHolder final {
       nsIXPConnect* const xpc = nsContentUtils::XPConnect();
       MOZ_ASSERT(xpc, "This should never be null!");
 
       // Let's use a null principal.
       const nsCOMPtr<nsIPrincipal> principal =
           NullPrincipal::CreateWithoutOriginAttributes();
 
       JS::Rooted<JSObject*> sandbox(aCx);
-      IDB_TRY(xpc->CreateSandbox(aCx, principal, sandbox.address()), nullptr);
+      QM_TRY(xpc->CreateSandbox(aCx, principal, sandbox.address()), nullptr);
 
       mSandbox = new JSObjectHolder(aCx, sandbox);
     }
 
     return mSandbox->GetJSObject();
   }
 
   RefPtr<JSObjectHolder> mSandbox;
@@ -231,104 +231,104 @@ nsresult ReadCompressedIndexDataValuesFr
   MOZ_ASSERT(!aBlobData.IsEmpty());
   MOZ_ASSERT(aOutIndexValues);
   MOZ_ASSERT(aOutIndexValues->IsEmpty());
 
   AUTO_PROFILER_LABEL("ReadCompressedIndexDataValuesFromBlob", DOM);
 
   // XXX Is this check still necessary with a Span? Or should it rather be moved
   // to the caller?
-  IDB_TRY(OkIf(uintptr_t(aBlobData.Elements()) <=
-               UINTPTR_MAX - aBlobData.LengthBytes()),
-          NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(uintptr_t(aBlobData.Elements()) <=
+              UINTPTR_MAX - aBlobData.LengthBytes()),
+         NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   for (auto remainder = aBlobData; !remainder.IsEmpty();) {
-    IDB_TRY_INSPECT((const auto& [indexId, unique, remainderAfterIndexId]),
-                    ReadCompressedIndexId(remainder));
+    QM_TRY_INSPECT((const auto& [indexId, unique, remainderAfterIndexId]),
+                   ReadCompressedIndexId(remainder));
 
-    IDB_TRY(OkIf(!remainderAfterIndexId.IsEmpty()), NS_ERROR_FILE_CORRUPTED,
-            IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_TRY(OkIf(!remainderAfterIndexId.IsEmpty()), NS_ERROR_FILE_CORRUPTED,
+           IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
     // Read key buffer length.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         (const auto& [keyBufferLength, remainderAfterKeyBufferLength]),
         ReadCompressedNumber(remainderAfterIndexId));
 
-    IDB_TRY(OkIf(!remainderAfterKeyBufferLength.IsEmpty()),
-            NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_TRY(OkIf(!remainderAfterKeyBufferLength.IsEmpty()),
+           NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
-    IDB_TRY(OkIf(keyBufferLength <= uint64_t(UINT32_MAX)),
-            NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_TRY(OkIf(keyBufferLength <= uint64_t(UINT32_MAX)),
+           NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
-    IDB_TRY(OkIf(keyBufferLength <= remainderAfterKeyBufferLength.Length()),
-            NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_TRY(OkIf(keyBufferLength <= remainderAfterKeyBufferLength.Length()),
+           NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
     const auto [keyBuffer, remainderAfterKeyBuffer] =
         remainderAfterKeyBufferLength.SplitAt(keyBufferLength);
     auto idv =
         IndexDataValue{indexId, unique, Key{nsCString{AsChars(keyBuffer)}}};
 
     // Read sort key buffer length.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         (const auto& [sortKeyBufferLength, remainderAfterSortKeyBufferLength]),
         ReadCompressedNumber(remainderAfterKeyBuffer));
 
     remainder = remainderAfterSortKeyBufferLength;
     if (sortKeyBufferLength > 0) {
-      IDB_TRY(OkIf(!remainder.IsEmpty()), NS_ERROR_FILE_CORRUPTED,
-              IDB_REPORT_INTERNAL_ERR_LAMBDA);
+      QM_TRY(OkIf(!remainder.IsEmpty()), NS_ERROR_FILE_CORRUPTED,
+             IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
-      IDB_TRY(OkIf(sortKeyBufferLength <= uint64_t(UINT32_MAX)),
-              NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+      QM_TRY(OkIf(sortKeyBufferLength <= uint64_t(UINT32_MAX)),
+             NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
-      IDB_TRY(OkIf(sortKeyBufferLength <= remainder.Length()),
-              NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+      QM_TRY(OkIf(sortKeyBufferLength <= remainder.Length()),
+             NS_ERROR_FILE_CORRUPTED, IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
       const auto [sortKeyBuffer, remainderAfterSortKeyBuffer] =
           remainder.SplitAt(sortKeyBufferLength);
       idv.mLocaleAwarePosition = Key{nsCString{AsChars(sortKeyBuffer)}};
       remainder = remainderAfterSortKeyBuffer;
     }
 
-    IDB_TRY(OkIf(aOutIndexValues->AppendElement(std::move(idv), fallible)),
-            NS_ERROR_OUT_OF_MEMORY, IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_TRY(OkIf(aOutIndexValues->AppendElement(std::move(idv), fallible)),
+           NS_ERROR_OUT_OF_MEMORY, IDB_REPORT_INTERNAL_ERR_LAMBDA);
   }
   aOutIndexValues->Sort();
 
   return NS_OK;
 }
 
 // aOutIndexValues is an output parameter, since its storage is reused.
 template <typename T>
 nsresult ReadCompressedIndexDataValuesFromSource(
     T& aSource, uint32_t aColumnIndex,
     nsTArray<IndexDataValue>* aOutIndexValues) {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aOutIndexValues);
   MOZ_ASSERT(aOutIndexValues->IsEmpty());
 
-  IDB_TRY_INSPECT(const int32_t& columnType,
-                  MOZ_TO_RESULT_INVOKE(aSource, GetTypeOfIndex, aColumnIndex));
+  QM_TRY_INSPECT(const int32_t& columnType,
+                 MOZ_TO_RESULT_INVOKE(aSource, GetTypeOfIndex, aColumnIndex));
 
   switch (columnType) {
     case mozIStorageStatement::VALUE_TYPE_NULL:
       return NS_OK;
 
     case mozIStorageStatement::VALUE_TYPE_BLOB: {
       // XXX ToResultInvoke does not support multiple output parameters yet, so
-      // we also can't use IDB_TRY_UNWRAP/IDB_TRY_INSPECT here.
+      // we also can't use QM_TRY_UNWRAP/QM_TRY_INSPECT here.
       const uint8_t* blobData;
       uint32_t blobDataLength;
-      IDB_TRY(aSource.GetSharedBlob(aColumnIndex, &blobDataLength, &blobData));
+      QM_TRY(aSource.GetSharedBlob(aColumnIndex, &blobDataLength, &blobData));
 
-      IDB_TRY(OkIf(blobDataLength), NS_ERROR_FILE_CORRUPTED,
-              IDB_REPORT_INTERNAL_ERR_LAMBDA);
+      QM_TRY(OkIf(blobDataLength), NS_ERROR_FILE_CORRUPTED,
+             IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
-      IDB_TRY(ReadCompressedIndexDataValuesFromBlob(
+      QM_TRY(ReadCompressedIndexDataValuesFromBlob(
           Span(blobData, blobDataLength), aOutIndexValues));
 
       return NS_OK;
     }
 
     default:
       return NS_ERROR_FILE_CORRUPTED;
   }
@@ -343,39 +343,39 @@ GetStructuredCloneReadInfoFromBlob(const
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("GetStructuredCloneReadInfoFromBlob", DOM);
 
   const char* const compressed = reinterpret_cast<const char*>(aBlobData);
   const size_t compressedLength = size_t(aBlobDataLength);
 
   size_t uncompressedLength;
-  IDB_TRY(OkIf(snappy::GetUncompressedLength(compressed, compressedLength,
-                                             &uncompressedLength)),
-          Err(NS_ERROR_FILE_CORRUPTED));
+  QM_TRY(OkIf(snappy::GetUncompressedLength(compressed, compressedLength,
+                                            &uncompressedLength)),
+         Err(NS_ERROR_FILE_CORRUPTED));
 
   AutoTArray<uint8_t, 512> uncompressed;
-  IDB_TRY(OkIf(uncompressed.SetLength(uncompressedLength, fallible)),
-          Err(NS_ERROR_OUT_OF_MEMORY));
+  QM_TRY(OkIf(uncompressed.SetLength(uncompressedLength, fallible)),
+         Err(NS_ERROR_OUT_OF_MEMORY));
 
   char* const uncompressedBuffer =
       reinterpret_cast<char*>(uncompressed.Elements());
 
-  IDB_TRY(OkIf(snappy::RawUncompress(compressed, compressedLength,
-                                     uncompressedBuffer)),
-          Err(NS_ERROR_FILE_CORRUPTED));
+  QM_TRY(OkIf(snappy::RawUncompress(compressed, compressedLength,
+                                    uncompressedBuffer)),
+         Err(NS_ERROR_FILE_CORRUPTED));
 
   JSStructuredCloneData data(JS::StructuredCloneScope::DifferentProcess);
-  IDB_TRY(OkIf(data.AppendBytes(uncompressedBuffer, uncompressed.Length())),
-          Err(NS_ERROR_OUT_OF_MEMORY));
+  QM_TRY(OkIf(data.AppendBytes(uncompressedBuffer, uncompressed.Length())),
+         Err(NS_ERROR_OUT_OF_MEMORY));
 
   nsTArray<StructuredCloneFileParent> files;
   if (!aFileIds.IsVoid()) {
-    IDB_TRY_UNWRAP(files,
-                   DeserializeStructuredCloneFiles(aFileManager, aFileIds));
+    QM_TRY_UNWRAP(files,
+                  DeserializeStructuredCloneFiles(aFileManager, aFileIds));
   }
 
   return StructuredCloneReadInfoParent{std::move(data), std::move(files),
                                        false};
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromExternalBlob(uint64_t aIntData,
@@ -383,103 +383,103 @@ GetStructuredCloneReadInfoFromExternalBl
                                            const nsAString& aFileIds,
                                            const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("GetStructuredCloneReadInfoFromExternalBlob", DOM);
 
   nsTArray<StructuredCloneFileParent> files;
   if (!aFileIds.IsVoid()) {
-    IDB_TRY_UNWRAP(files,
-                   DeserializeStructuredCloneFiles(aFileManager, aFileIds));
+    QM_TRY_UNWRAP(files,
+                  DeserializeStructuredCloneFiles(aFileManager, aFileIds));
   }
 
   // Higher and lower 32 bits described
   // in ObjectStoreAddOrPutRequestOp::DoDatabaseWork.
   const uint32_t index = uint32_t(aIntData & UINT32_MAX);
 
-  IDB_TRY(OkIf(index < files.Length()), Err(NS_ERROR_UNEXPECTED),
-          [](const auto&) { MOZ_ASSERT(false, "Bad index value!"); });
+  QM_TRY(OkIf(index < files.Length()), Err(NS_ERROR_UNEXPECTED),
+         [](const auto&) { MOZ_ASSERT(false, "Bad index value!"); });
 
   if (IndexedDatabaseManager::PreprocessingEnabled()) {
     return StructuredCloneReadInfoParent{
         JSStructuredCloneData{JS::StructuredCloneScope::DifferentProcess},
         std::move(files), true};
   }
 
   // XXX Why can there be multiple files, but we use only a single one here?
   const StructuredCloneFileParent& file = files[index];
   MOZ_ASSERT(file.Type() == StructuredCloneFileBase::eStructuredClone);
 
   auto data = JSStructuredCloneData{JS::StructuredCloneScope::DifferentProcess};
 
   {
     const nsCOMPtr<nsIFile> nativeFile = file.FileInfo().GetFileForFileInfo();
-    IDB_TRY(OkIf(nativeFile), Err(NS_ERROR_FAILURE));
+    QM_TRY(OkIf(nativeFile), Err(NS_ERROR_FAILURE));
 
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& fileInputStream,
         NS_NewLocalFileInputStream(nativeFile)
             .andThen([aMaybeKey](auto fileInputStream)
                          -> Result<nsCOMPtr<nsIInputStream>, nsresult> {
               if (aMaybeKey) {
                 return nsCOMPtr<nsIInputStream>{MakeRefPtr<
                     quota::DecryptingInputStream<IndexedDBCipherStrategy>>(
                     WrapNotNull(std::move(fileInputStream)),
                     kEncryptedStreamBlockSize, *aMaybeKey)};
               }
 
               return fileInputStream;
             }));
 
-    IDB_TRY(SnappyUncompressStructuredCloneData(*fileInputStream, data));
+    QM_TRY(SnappyUncompressStructuredCloneData(*fileInputStream, data));
   }
 
   return StructuredCloneReadInfoParent{std::move(data), std::move(files),
                                        false};
 }
 
 template <typename T>
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromSource(T* aSource, uint32_t aDataIndex,
                                      uint32_t aFileIdsIndex,
                                      const FileManager& aFileManager,
                                      const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aSource);
 
-  IDB_TRY_INSPECT(const int32_t& columnType,
-                  MOZ_TO_RESULT_INVOKE(aSource, GetTypeOfIndex, aDataIndex));
+  QM_TRY_INSPECT(const int32_t& columnType,
+                 MOZ_TO_RESULT_INVOKE(aSource, GetTypeOfIndex, aDataIndex));
 
-  IDB_TRY_INSPECT(const bool& isNull,
-                  MOZ_TO_RESULT_INVOKE(aSource, GetIsNull, aFileIdsIndex));
+  QM_TRY_INSPECT(const bool& isNull,
+                 MOZ_TO_RESULT_INVOKE(aSource, GetIsNull, aFileIdsIndex));
 
-  IDB_TRY_INSPECT(const nsString& fileIds, ([aSource, aFileIdsIndex, isNull] {
-                    return isNull ? Result<nsString, nsresult>{VoidString()}
-                                  : MOZ_TO_RESULT_INVOKE_TYPED(
-                                        nsString, aSource, GetString,
-                                        aFileIdsIndex);
-                  }()));
+  QM_TRY_INSPECT(const nsString& fileIds, ([aSource, aFileIdsIndex, isNull] {
+                   return isNull ? Result<nsString, nsresult>{VoidString()}
+                                 : MOZ_TO_RESULT_INVOKE_TYPED(nsString, aSource,
+                                                              GetString,
+                                                              aFileIdsIndex);
+                 }()));
 
   switch (columnType) {
     case mozIStorageStatement::VALUE_TYPE_INTEGER: {
-      IDB_TRY_INSPECT(const int64_t& intData,
-                      MOZ_TO_RESULT_INVOKE(aSource, GetInt64, aDataIndex));
+      QM_TRY_INSPECT(const int64_t& intData,
+                     MOZ_TO_RESULT_INVOKE(aSource, GetInt64, aDataIndex));
 
       uint64_t uintData;
       memcpy(&uintData, &intData, sizeof(uint64_t));
 
       return GetStructuredCloneReadInfoFromExternalBlob(uintData, aFileManager,
                                                         fileIds, aMaybeKey);
     }
 
     case mozIStorageStatement::VALUE_TYPE_BLOB: {
       const uint8_t* blobData;
       uint32_t blobDataLength;
-      IDB_TRY(aSource->GetSharedBlob(aDataIndex, &blobDataLength, &blobData));
+      QM_TRY(aSource->GetSharedBlob(aDataIndex, &blobDataLength, &blobData));
 
       return GetStructuredCloneReadInfoFromBlob(
           blobData, blobDataLength, aFileManager, fileIds, aMaybeKey);
     }
 
     default:
       return Err(NS_ERROR_FILE_CORRUPTED);
   }
@@ -573,24 +573,24 @@ MakeCompressedIndexDataValues(const nsTA
         MOZ_ASSERT(!keyBuffer.IsEmpty());
 
         return sum + CompressedByteCountForIndexId(info.mIndexId) +
                CompressedByteCountForNumber(keyBufferLength) +
                CompressedByteCountForNumber(sortKeyBufferLength) +
                keyBufferLength + sortKeyBufferLength;
       });
 
-  IDB_TRY(OkIf(blobDataLength.isValid()),
-          Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(blobDataLength.isValid()),
+         Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   UniqueFreePtr<uint8_t> blobData(
       static_cast<uint8_t*>(malloc(blobDataLength.value())));
-  IDB_TRY(OkIf(static_cast<bool>(blobData)), Err(NS_ERROR_OUT_OF_MEMORY),
-          IDB_REPORT_INTERNAL_ERR_LAMBDA);
+  QM_TRY(OkIf(static_cast<bool>(blobData)), Err(NS_ERROR_OUT_OF_MEMORY),
+         IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
   uint8_t* blobDataIter = blobData.get();
 
   for (const IndexDataValue& info : aIndexValues) {
     const nsCString& keyBuffer = info.mPosition.GetBuffer();
     const nsCString& sortKeyBuffer = info.mLocaleAwarePosition.GetBuffer();
     const uint32_t keyBufferLength = keyBuffer.Length();
     const uint32_t sortKeyBufferLength = sortKeyBuffer.Length();
@@ -631,18 +631,18 @@ ReadCompressedIndexDataValues<mozIStorag
                                                      uint32_t);
 
 template Result<IndexDataValuesAutoArray, nsresult>
 ReadCompressedIndexDataValues<mozIStorageStatement>(mozIStorageStatement&,
                                                     uint32_t);
 
 Result<std::tuple<IndexOrObjectStoreId, bool, Span<const uint8_t>>, nsresult>
 ReadCompressedIndexId(const Span<const uint8_t> aData) {
-  IDB_TRY_INSPECT((const auto& [indexId, remainder]),
-                  ReadCompressedNumber(aData));
+  QM_TRY_INSPECT((const auto& [indexId, remainder]),
+                 ReadCompressedNumber(aData));
 
   MOZ_ASSERT(UINT64_MAX / 2 >= uint64_t(indexId), "Bad index id!");
 
   return std::tuple{IndexOrObjectStoreId(indexId >> 1), indexId % 2 == 1,
                     remainder};
 }
 
 Result<std::pair<uint64_t, mozilla::Span<const uint8_t>>, nsresult>
@@ -657,17 +657,17 @@ ReadCompressedNumber(const Span<const ui
         MOZ_ASSERT(shiftCounter <= 56, "Shifted too many bits!");
 
         result += (uint64_t(byte & 0x7f) << shiftCounter);
         shiftCounter += 7;
 
         return !(byte & 0x80);
       });
 
-  IDB_TRY(OkIf(newPos != end), Err(NS_ERROR_FILE_CORRUPTED), [](const auto&) {
+  QM_TRY(OkIf(newPos != end), Err(NS_ERROR_FILE_CORRUPTED), [](const auto&) {
     MOZ_ASSERT(false);
     IDB_REPORT_INTERNAL_ERR();
   });
 
   return std::pair{result, Span{newPos + 1, end}};
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
@@ -696,30 +696,30 @@ DeserializeStructuredCloneFiles(const Fi
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   nsTArray<StructuredCloneFileParent> result;
   for (const auto& token :
        nsCharSeparatedTokenizerTemplate<NS_TokenizerIgnoreNothing>(aText, ' ')
            .ToRange()) {
     MOZ_ASSERT(!token.IsEmpty());
 
-    IDB_TRY_UNWRAP(auto structuredCloneFile,
-                   DeserializeStructuredCloneFile(aFileManager, token));
+    QM_TRY_UNWRAP(auto structuredCloneFile,
+                  DeserializeStructuredCloneFile(aFileManager, token));
 
     result.EmplaceBack(std::move(structuredCloneFile));
   }
 
   return result;
 }
 
 nsresult ExecuteSimpleSQLSequence(mozIStorageConnection& aConnection,
                                   Span<const nsLiteralCString> aSQLCommands) {
   for (const auto& aSQLCommand : aSQLCommands) {
     const auto extraInfo = quota::ScopedLogExtraInfo{
         quota::ScopedLogExtraInfo::kTagQuery, aSQLCommand};
 
-    IDB_TRY(aConnection.ExecuteSimpleSQL(aSQLCommand));
+    QM_TRY(aConnection.ExecuteSimpleSQL(aSQLCommand));
   }
 
   return NS_OK;
 }
 
 }  // namespace mozilla::dom::indexedDB
--- a/dom/indexedDB/DBSchema.cpp
+++ b/dom/indexedDB/DBSchema.cpp
@@ -63,17 +63,17 @@ nsresult CreateFileTables(mozIStorageCon
       "END;"_ns,
       "CREATE TRIGGER file_update_trigger "
       "AFTER UPDATE ON file "
       "FOR EACH ROW WHEN NEW.refcount = 0 "
       "BEGIN "
       "DELETE FROM file WHERE id = OLD.id; "
       "END;"_ns};
 
-  IDB_TRY(ExecuteSimpleSQLSequence(aConnection, commands));
+  QM_TRY(ExecuteSimpleSQLSequence(aConnection, commands));
 
   return NS_OK;
 }
 
 nsresult CreateTables(mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
 
   AUTO_PROFILER_LABEL("CreateTables", DOM);
@@ -155,18 +155,18 @@ nsresult CreateTables(mozIStorageConnect
       "REFERENCES object_store_index(id) "
       ", FOREIGN KEY (object_store_id, object_data_key) "
       "REFERENCES object_data(object_store_id, key) "
       ") WITHOUT ROWID;"_ns,
       "CREATE INDEX unique_index_data_value_locale_index "
       "ON unique_index_data (index_id, value_locale, object_data_key, value) "
       "WHERE value_locale IS NOT NULL;"_ns};
 
-  IDB_TRY(ExecuteSimpleSQLSequence(aConnection, commands));
+  QM_TRY(ExecuteSimpleSQLSequence(aConnection, commands));
 
-  IDB_TRY(CreateFileTables(aConnection));
+  QM_TRY(CreateFileTables(aConnection));
 
-  IDB_TRY(aConnection.SetSchemaVersion(kSQLiteSchemaVersion));
+  QM_TRY(aConnection.SetSchemaVersion(kSQLiteSchemaVersion));
 
   return NS_OK;
 }
 
 }  // namespace mozilla::dom::indexedDB
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -885,19 +885,19 @@ nsresult IDBDatabase::GetQuotaInfo(nsACS
     case PrincipalInfo::TNullPrincipalInfo:
       MOZ_CRASH("Is this needed?!");
 
     case PrincipalInfo::TSystemPrincipalInfo:
       aOrigin = QuotaManager::GetOriginForChrome();
       return NS_OK;
 
     case PrincipalInfo::TContentPrincipalInfo: {
-      IDB_TRY_UNWRAP(auto principal, PrincipalInfoToPrincipal(*principalInfo));
+      QM_TRY_UNWRAP(auto principal, PrincipalInfoToPrincipal(*principalInfo));
 
-      IDB_TRY_UNWRAP(aOrigin, QuotaManager::GetOriginFromPrincipal(principal));
+      QM_TRY_UNWRAP(aOrigin, QuotaManager::GetOriginFromPrincipal(principal));
 
       return NS_OK;
     }
 
     default:
       MOZ_CRASH("Unknown PrincipalInfo type!");
   }
 
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -61,18 +61,18 @@ using namespace mozilla::ipc;
 namespace {
 
 Result<IndexUpdateInfo, nsresult> MakeIndexUpdateInfo(
     const int64_t aIndexID, const Key& aKey, const nsCString& aLocale) {
   IndexUpdateInfo indexUpdateInfo;
   indexUpdateInfo.indexId() = aIndexID;
   indexUpdateInfo.value() = aKey;
   if (!aLocale.IsEmpty()) {
-    IDB_TRY_UNWRAP(indexUpdateInfo.localizedValue(),
-                   aKey.ToLocaleAwareKey(aLocale));
+    QM_TRY_UNWRAP(indexUpdateInfo.localizedValue(),
+                  aKey.ToLocaleAwareKey(aLocale));
   }
   return indexUpdateInfo;
 }
 
 }  // namespace
 
 struct IDBObjectStore::StructuredCloneWriteInfo {
   JSAutoStructuredCloneBuffer mCloneBuffer;
@@ -510,19 +510,19 @@ void IDBObjectStore::AppendIndexUpdateIn
       aRv->SuppressException();
       return;
     }
 
     if (aRv->Failed()) {
       return;
     }
 
-    IDB_TRY_UNWRAP(auto item, MakeIndexUpdateInfo(aIndexID, key, aLocale),
-                   QM_VOID,
-                   [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
+    QM_TRY_UNWRAP(auto item, MakeIndexUpdateInfo(aIndexID, key, aLocale),
+                  QM_VOID,
+                  [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
 
     aUpdateInfoArray->AppendElement(std::move(item));
     return;
   }
 
   JS::Rooted<JS::Value> val(aCx);
   if (NS_FAILED(aKeyPath.ExtractKeyAsJSVal(aCx, aVal, val.address()))) {
     return;
@@ -576,36 +576,36 @@ void IDBObjectStore::AppendIndexUpdateIn
         // Not a value we can do anything with, ignore it.
         if (result.isErr() &&
             result.inspectErr().Is(SpecialValues::Exception)) {
           result.unwrapErr().AsException().SuppressException();
         }
         continue;
       }
 
-      IDB_TRY_UNWRAP(
-          auto item, MakeIndexUpdateInfo(aIndexID, value, aLocale), QM_VOID,
-          [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
+      QM_TRY_UNWRAP(auto item, MakeIndexUpdateInfo(aIndexID, value, aLocale),
+                    QM_VOID,
+                    [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
 
       aUpdateInfoArray->AppendElement(std::move(item));
     }
   } else {
     Key value;
     auto result = value.SetFromJSVal(aCx, val);
     if (result.isErr() || value.IsUnset()) {
       // Not a value we can do anything with, ignore it.
       if (result.isErr() && result.inspectErr().Is(SpecialValues::Exception)) {
         result.unwrapErr().AsException().SuppressException();
       }
       return;
     }
 
-    IDB_TRY_UNWRAP(auto item, MakeIndexUpdateInfo(aIndexID, value, aLocale),
-                   QM_VOID,
-                   [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
+    QM_TRY_UNWRAP(auto item, MakeIndexUpdateInfo(aIndexID, value, aLocale),
+                  QM_VOID,
+                  [aRv](const nsresult tryResult) { aRv->Throw(tryResult); });
 
     aUpdateInfoArray->AppendElement(std::move(item));
   }
 }
 
 // static
 void IDBObjectStore::ClearCloneReadInfo(
     StructuredCloneReadInfoChild& aReadInfo) {
@@ -822,17 +822,17 @@ RefPtr<IDBRequest> IDBObjectStore::AddOr
   commonParams.objectStoreId() = Id();
   commonParams.cloneInfo().data().data =
       std::move(cloneWriteInfo.mCloneBuffer.data());
   commonParams.cloneInfo().offsetToKeyProp() = cloneWriteInfo.mOffsetToKeyProp;
   commonParams.key() = key;
   commonParams.indexUpdateInfos() = std::move(updateInfos);
 
   // Convert any blobs or mutable files into FileAddInfo.
-  IDB_TRY_UNWRAP(
+  QM_TRY_UNWRAP(
       commonParams.fileAddInfos(),
       TransformIntoNewArrayAbortOnErr(
           cloneWriteInfo.mFiles,
           [&database = *mTransaction->Database()](
               auto& file) -> Result<FileAddInfo, nsresult> {
             switch (file.Type()) {
               case StructuredCloneFileBase::eBlob: {
                 MOZ_ASSERT(file.HasBlob());
@@ -1385,26 +1385,26 @@ RefPtr<IDBIndex> IDBObjectStore::CreateI
 
     return keyPath;
   };
 
   QM_NOTEONLY_TRY_UNWRAP(
       const auto maybeKeyPath,
       ([&aKeyPath, checkValid]() -> Result<KeyPath, nsresult> {
         if (aKeyPath.IsString()) {
-          IDB_TRY_RETURN(
+          QM_TRY_RETURN(
               KeyPath::Parse(aKeyPath.GetAsString()).andThen(checkValid));
         }
 
         MOZ_ASSERT(aKeyPath.IsStringSequence());
         if (aKeyPath.GetAsStringSequence().IsEmpty()) {
           return Err(NS_ERROR_DOM_SYNTAX_ERR);
         }
 
-        IDB_TRY_RETURN(
+        QM_TRY_RETURN(
             KeyPath::Parse(aKeyPath.GetAsStringSequence()).andThen(checkValid));
       })());
   if (!maybeKeyPath) {
     aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return nullptr;
   }
 
   const auto& keyPath = maybeKeyPath.ref();
--- a/dom/indexedDB/IndexedDBCommon.cpp
+++ b/dom/indexedDB/IndexedDBCommon.cpp
@@ -16,25 +16,25 @@ namespace mozilla::dom::indexedDB {
 // reason. Maybe this could be changed.
 nsresult SnappyUncompressStructuredCloneData(
     nsIInputStream& aInputStream, JSStructuredCloneData& aStructuredCloneData) {
   const auto snappyInputStream =
       MakeRefPtr<SnappyUncompressInputStream>(&aInputStream);
 
   char buffer[kFileCopyBufferSize];
 
-  IDB_TRY(CollectEach(
+  QM_TRY(CollectEach(
       [&snappyInputStream = *snappyInputStream, &buffer] {
-        IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(snappyInputStream, Read, buffer,
-                                            sizeof(buffer)));
+        QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE(snappyInputStream, Read, buffer,
+                                           sizeof(buffer)));
       },
       [&aStructuredCloneData,
        &buffer](const uint32_t& numRead) -> Result<Ok, nsresult> {
-        IDB_TRY(OkIf(aStructuredCloneData.AppendBytes(buffer, numRead)),
-                Err(NS_ERROR_OUT_OF_MEMORY));
+        QM_TRY(OkIf(aStructuredCloneData.AppendBytes(buffer, numRead)),
+               Err(NS_ERROR_OUT_OF_MEMORY));
 
         return Ok{};
       }));
 
   return NS_OK;
 }
 
 }  // namespace mozilla::dom::indexedDB
--- a/dom/indexedDB/IndexedDBCommon.h
+++ b/dom/indexedDB/IndexedDBCommon.h
@@ -7,23 +7,16 @@
 #ifndef mozilla_dom_indexeddb_IndexedDBCommon_h
 #define mozilla_dom_indexeddb_IndexedDBCommon_h
 
 #include "mozilla/dom/quota/QuotaCommon.h"
 
 class JSStructuredCloneData;
 class nsIInputStream;
 
-// XXX Replace all uses by the QM_* variants and remove these aliases
-#define IDB_TRY QM_TRY
-#define IDB_TRY_UNWRAP QM_TRY_UNWRAP
-#define IDB_TRY_INSPECT QM_TRY_INSPECT
-#define IDB_TRY_RETURN QM_TRY_RETURN
-#define IDB_FAIL QM_FAIL
-
 namespace mozilla::dom::indexedDB {
 
 static constexpr uint32_t kFileCopyBufferSize = 32768;
 
 nsresult SnappyUncompressStructuredCloneData(
     nsIInputStream& aInputStream, JSStructuredCloneData& aStructuredCloneData);
 
 }  // namespace mozilla::dom::indexedDB
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -248,17 +248,17 @@ IndexedDatabaseManager* IndexedDatabaseM
     return nullptr;
   }
 
   if (!gDBManager) {
     sIsMainProcess = XRE_IsParentProcess();
 
     RefPtr<IndexedDatabaseManager> instance(new IndexedDatabaseManager());
 
-    IDB_TRY(instance->Init(), nullptr);
+    QM_TRY(instance->Init(), nullptr);
 
     if (gInitialized.exchange(true)) {
       NS_ERROR("Initialized more than once?!");
     }
 
     gDBManager = instance;
 
     ClearOnShutdown(&gDBManager);
@@ -519,18 +519,17 @@ bool IndexedDatabaseManager::DefineIndex
   MOZ_ASSERT(JS::GetClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
              "Passed object is not a global object!");
 
   nsIGlobalObject* global = xpc::CurrentNativeGlobal(aCx);
   if (NS_WARN_IF(!global)) {
     return false;
   }
 
-  IDB_TRY_UNWRAP(auto factory, IDBFactory::CreateForMainThreadJS(global),
-                 false);
+  QM_TRY_UNWRAP(auto factory, IDBFactory::CreateForMainThreadJS(global), false);
 
   MOZ_ASSERT(factory, "This should never fail for chrome!");
 
   JS::Rooted<JS::Value> indexedDB(aCx);
   js::AssertSameCompartment(aCx, aGlobal);
   if (!GetOrCreateDOMReflector(aCx, factory, &indexedDB)) {
     return false;
   }
--- a/dom/indexedDB/Key.cpp
+++ b/dom/indexedDB/Key.cpp
@@ -474,18 +474,18 @@ nsresult Key::DecodeJSValInternal(const 
     if (aTypeOffset == eMaxType * kMaxArrayCollapse) {
       ++aPos;
       aTypeOffset = 0;
     }
 
     uint32_t index = 0;
     JS::Rooted<JS::Value> val(aCx);
     while (aPos < aEnd && *aPos - aTypeOffset != eTerminator) {
-      IDB_TRY(DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset, &val,
-                                  aRecursionDepth + 1));
+      QM_TRY(DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset, &val,
+                                 aRecursionDepth + 1));
 
       aTypeOffset = 0;
 
       if (!JS_DefineElement(aCx, array, index++, val, JSPROP_ENUMERATE)) {
         NS_WARNING("Failed to set array element!");
         IDB_REPORT_INTERNAL_ERR();
         return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
       }
--- a/dom/indexedDB/KeyPath.cpp
+++ b/dom/indexedDB/KeyPath.cpp
@@ -91,20 +91,20 @@ nsresult GetJSValFromKeyPathString(
       if (!currentVal.isObject()) {
         return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
       }
       obj = &currentVal.toObject();
 
       // We call JS_GetOwnUCPropertyDescriptor on purpose (as opposed to
       // JS_GetUCPropertyDescriptor) to avoid searching the prototype chain.
       JS::Rooted<JS::PropertyDescriptor> desc(aCx);
-      IDB_TRY(OkIf(JS_GetOwnUCPropertyDescriptor(aCx, obj, keyPathChars,
-                                                 keyPathLen, &desc)),
-              NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-              IDB_REPORT_INTERNAL_ERR_LAMBDA);
+      QM_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;
 
       if (desc.object()) {
         intermediate = desc.value();
         hasProp = true;
       } else {
@@ -238,23 +238,23 @@ nsresult GetJSValFromKeyPathString(
     // If this fails, we lose, and the web page sees a magical property
     // appear on the object :-(
     JS::ObjectOpResult succeeded;
     if (!JS_DeleteUCProperty(aCx, targetObject, targetObjectPropName.get(),
                              targetObjectPropName.Length(), succeeded)) {
       IDB_REPORT_INTERNAL_ERR();
       return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
     }
-    IDB_TRY(OkIf(succeeded.ok()), NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR,
-            IDB_REPORT_INTERNAL_ERR_LAMBDA);
+    QM_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.
-  //       This last IDB_TRY could be removed then.
-  IDB_TRY(rv);
+  //       This last QM_TRY could be removed then.
+  QM_TRY(rv);
   return NS_OK;
 }
 
 }  // namespace
 
 // static
 Result<KeyPath, nsresult> KeyPath::Parse(const nsAString& aString) {
   KeyPath keyPath(0);
--- a/dom/indexedDB/PermissionRequestBase.cpp
+++ b/dom/indexedDB/PermissionRequestBase.cpp
@@ -56,22 +56,21 @@ PermissionRequestBase::PermissionRequest
 PermissionRequestBase::~PermissionRequestBase() { AssertSanity(); }
 
 // static
 Result<PermissionRequestBase::PermissionValue, nsresult>
 PermissionRequestBase::GetCurrentPermission(nsIPrincipal& aPrincipal) {
   AssertSanity();
 
   const nsCOMPtr<nsIPermissionManager> permMan = GetPermissionManager();
-  IDB_TRY(OkIf(permMan), Err(NS_ERROR_FAILURE));
+  QM_TRY(OkIf(permMan), Err(NS_ERROR_FAILURE));
 
-  IDB_TRY_INSPECT(
-      const uint32_t& intPermission,
-      MOZ_TO_RESULT_INVOKE(permMan, TestExactPermissionFromPrincipal,
-                           &aPrincipal, kPermissionString));
+  QM_TRY_INSPECT(const uint32_t& intPermission,
+                 MOZ_TO_RESULT_INVOKE(permMan, TestExactPermissionFromPrincipal,
+                                      &aPrincipal, kPermissionString));
 
   const PermissionValue permission =
       PermissionValueForIntPermission(intPermission);
 
   MOZ_ASSERT(permission == kPermissionAllowed ||
              permission == kPermissionDenied ||
              permission == kPermissionPrompt);
 
@@ -102,35 +101,35 @@ PermissionRequestBase::PromptIfNeeded() 
   AssertSanity();
   MOZ_ASSERT(mPrincipal);
 
   // Tricky, we want to release the window and principal in all cases except
   // when we successfully prompt.
   nsCOMPtr<Element> element = std::move(mOwnerElement);
   nsCOMPtr<nsIPrincipal> principal = std::move(mPrincipal);
 
-  IDB_TRY_INSPECT(const PermissionValue& currentValue,
-                  GetCurrentPermission(*principal));
+  QM_TRY_INSPECT(const PermissionValue& currentValue,
+                 GetCurrentPermission(*principal));
   MOZ_ASSERT(currentValue != kPermissionDefault);
 
   if (currentValue == kPermissionPrompt) {
     nsCOMPtr<nsIObserverService> obsSvc = GetObserverService();
-    IDB_TRY(OkIf(obsSvc), Err(NS_ERROR_FAILURE));
+    QM_TRY(OkIf(obsSvc), Err(NS_ERROR_FAILURE));
 
     // We're about to prompt so move the members back.
     mOwnerElement = std::move(element);
     mPrincipal = std::move(principal);
 
-    IDB_TRY(obsSvc->NotifyObservers(static_cast<nsIObserver*>(this),
-                                    kPermissionPromptTopic, nullptr),
-            QM_PROPAGATE, [this](const auto&) {
-              // Finally release if we failed the prompt.
-              mOwnerElement = nullptr;
-              mPrincipal = nullptr;
-            });
+    QM_TRY(obsSvc->NotifyObservers(static_cast<nsIObserver*>(this),
+                                   kPermissionPromptTopic, nullptr),
+           QM_PROPAGATE, [this](const auto&) {
+             // Finally release if we failed the prompt.
+             mOwnerElement = nullptr;
+             mPrincipal = nullptr;
+           });
   }
 
   return currentValue;
 }
 
 void PermissionRequestBase::SetExplicitPermission(nsIPrincipal* aPrincipal,
                                                   uint32_t aIntPermission) {
   AssertSanity();
--- a/dom/indexedDB/SchemaUpgrades.cpp
+++ b/dom/indexedDB/SchemaUpgrades.cpp
@@ -102,18 +102,18 @@ nsresult UpgradeSchemaFrom4To5(mozIStora
 
   nsString name;
   int32_t intVersion;
   int64_t dataVersion;
 
   {
     mozStorageStatementScoper scoper(stmt);
 
-    IDB_TRY_INSPECT(const bool& hasResults,
-                    MOZ_TO_RESULT_INVOKE(stmt, ExecuteStep));
+    QM_TRY_INSPECT(const bool& hasResults,
+                   MOZ_TO_RESULT_INVOKE(stmt, ExecuteStep));
 
     if (NS_WARN_IF(!hasResults)) {
       return NS_ERROR_FAILURE;
     }
 
     nsString version;
     rv = stmt->GetString(1, version);
     if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -1030,34 +1030,34 @@ class EncodeKeysFunction final : public 
     }
 
     int32_t type;
     rv = aArguments->GetTypeOfIndex(0, &type);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         const auto& key, ([type, aArguments]() -> Result<Key, nsresult> {
           switch (type) {
             case mozIStorageStatement::VALUE_TYPE_INTEGER: {
               int64_t intKey;
               aArguments->GetInt64(0, &intKey);
 
               Key key;
               key.SetFromInteger(intKey);
 
               return key;
             }
             case mozIStorageStatement::VALUE_TYPE_TEXT: {
               nsString stringKey;
               aArguments->GetString(0, stringKey);
 
               Key key;
-              IDB_TRY(key.SetFromString(stringKey));
+              QM_TRY(key.SetFromString(stringKey));
 
               return key;
             }
             default:
               NS_WARNING("Don't call me with the wrong type of arguments!");
               return Err(NS_ERROR_UNEXPECTED);
           }
         }()));
@@ -1451,17 +1451,17 @@ UpgradeSchemaFrom17_0To18_0Helper::Inser
 
     MOZ_ALWAYS_SUCCEEDS(aValues->GetTypeOfIndex(3, &valueType));
     MOZ_ASSERT(valueType == mozIStorageValueArray::VALUE_TYPE_BLOB);
   }
 #endif
 
   // Read out the previous value. It may be NULL, in which case we'll just end
   // up with an empty array.
-  IDB_TRY_UNWRAP(auto indexValues, ReadCompressedIndexDataValues(*aValues, 0));
+  QM_TRY_UNWRAP(auto indexValues, ReadCompressedIndexDataValues(*aValues, 0));
 
   IndexOrObjectStoreId indexId;
   nsresult rv = aValues->GetInt64(1, &indexId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   int32_t unique;
@@ -1479,18 +1479,18 @@ UpgradeSchemaFrom17_0To18_0Helper::Inser
   // Update the array with the new addition.
   if (NS_WARN_IF(!indexValues.InsertElementSorted(
           IndexDataValue(indexId, !!unique, value), fallible))) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   // Compress the array.
-  IDB_TRY_UNWRAP((auto [indexValuesBlob, indexValuesBlobLength]),
-                 MakeCompressedIndexDataValues(indexValues));
+  QM_TRY_UNWRAP((auto [indexValuesBlob, indexValuesBlobLength]),
+                MakeCompressedIndexDataValues(indexValues));
 
   // The compressed blob is the result of this function.
   nsCOMPtr<nsIVariant> result = new storage::AdoptedBlobVariant(
       std::pair(indexValuesBlob.release(), indexValuesBlobLength));
 
   result.forget(_retval);
   return NS_OK;
 }
@@ -2122,20 +2122,20 @@ nsresult UpgradeSchemaFrom17_0To18_0Help
       "RENAME TO database;"_ns);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
 #ifdef DEBUG
   {
     // Make sure there's only one entry in the |database| table.
-    IDB_TRY_INSPECT(const auto& stmt,
-                    quota::CreateAndExecuteSingleStepStatement(
-                        aConnection, "SELECT COUNT(*) FROM database;"_ns),
-                    QM_ASSERT_UNREACHABLE);
+    QM_TRY_INSPECT(const auto& stmt,
+                   quota::CreateAndExecuteSingleStepStatement(
+                       aConnection, "SELECT COUNT(*) FROM database;"_ns),
+                   QM_ASSERT_UNREACHABLE);
 
     int64_t count;
     MOZ_ASSERT(NS_SUCCEEDED(stmt->GetInt64(0, &count)));
 
     MOZ_ASSERT(count == 1);
   }
 #endif
 
@@ -2302,18 +2302,18 @@ nsresult UpgradeSchemaFrom19_0To20_0(nsI
     return rv;
   }
 
   int64_t count;
 
   {
     mozStorageStatementScoper scoper(stmt);
 
-    IDB_TRY_INSPECT(const bool& hasResult,
-                    MOZ_TO_RESULT_INVOKE(stmt, ExecuteStep));
+    QM_TRY_INSPECT(const bool& hasResult,
+                   MOZ_TO_RESULT_INVOKE(stmt, ExecuteStep));
 
     if (NS_WARN_IF(!hasResult)) {
       MOZ_ASSERT(false, "This should never be possible!");
       return NS_ERROR_FAILURE;
     }
 
     count = stmt->AsInt64(0);
     if (NS_WARN_IF(count < 0)) {
@@ -2415,28 +2415,28 @@ UpgradeIndexDataValuesFunction::ReadOldC
 
   IndexOrObjectStoreId indexId;
   bool unique;
   bool nextIndexIdAlreadyRead = false;
 
   IndexDataValuesArray result;
   for (auto remainder = aBlobData; !remainder.IsEmpty();) {
     if (!nextIndexIdAlreadyRead) {
-      IDB_TRY_UNWRAP((std::tie(indexId, unique, remainder)),
-                     ReadCompressedIndexId(remainder));
+      QM_TRY_UNWRAP((std::tie(indexId, unique, remainder)),
+                    ReadCompressedIndexId(remainder));
     }
     nextIndexIdAlreadyRead = false;
 
     if (NS_WARN_IF(remainder.IsEmpty())) {
       IDB_REPORT_INTERNAL_ERR();
       return Err(NS_ERROR_FILE_CORRUPTED);
     }
 
     // Read key buffer length.
-    IDB_TRY_INSPECT(
+    QM_TRY_INSPECT(
         (const auto& [keyBufferLength, remainderAfterKeyBufferLength]),
         ReadCompressedNumber(remainder));
 
     if (NS_WARN_IF(remainderAfterKeyBufferLength.IsEmpty()) ||
         NS_WARN_IF(keyBufferLength > uint64_t(UINT32_MAX)) ||
         NS_WARN_IF(keyBufferLength > remainderAfterKeyBufferLength.Length())) {
       IDB_REPORT_INTERNAL_ERR();
       return Err(NS_ERROR_FILE_CORRUPTED);
@@ -2448,18 +2448,18 @@ UpgradeIndexDataValuesFunction::ReadOldC
                                        Key{nsCString{AsChars(keyBuffer)}}))) {
       IDB_REPORT_INTERNAL_ERR();
       return Err(NS_ERROR_OUT_OF_MEMORY);
     }
 
     remainder = remainderAfterKeyBuffer;
     if (!remainder.IsEmpty()) {
       // Read either a sort key buffer length or an index id.
-      IDB_TRY_INSPECT((const auto& [maybeIndexId, remainderAfterIndexId]),
-                      ReadCompressedNumber(remainder));
+      QM_TRY_INSPECT((const auto& [maybeIndexId, remainderAfterIndexId]),
+                     ReadCompressedNumber(remainder));
 
       // Locale-aware indexes haven't been around long enough to have any users,
       // we can safely assume all sort key buffer lengths will be zero.
       // XXX This duplicates logic from ReadCompressedIndexId.
       if (maybeIndexId != 0) {
         unique = maybeIndexId % 2 == 1;
         indexId = maybeIndexId / 2;
         nextIndexIdAlreadyRead = true;
@@ -2505,21 +2505,21 @@ UpgradeIndexDataValuesFunction::OnFuncti
 
   const uint8_t* oldBlob;
   uint32_t oldBlobLength;
   rv = aArguments->GetSharedBlob(0, &oldBlobLength, &oldBlob);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  IDB_TRY_INSPECT(const auto& oldIdv,
-                  ReadOldCompressedIDVFromBlob(Span(oldBlob, oldBlobLength)));
-
-  IDB_TRY_UNWRAP((auto [newIdv, newIdvLength]),
-                 MakeCompressedIndexDataValues(oldIdv));
+  QM_TRY_INSPECT(const auto& oldIdv,
+                 ReadOldCompressedIDVFromBlob(Span(oldBlob, oldBlobLength)));
+
+  QM_TRY_UNWRAP((auto [newIdv, newIdvLength]),
+                MakeCompressedIndexDataValues(oldIdv));
 
   nsCOMPtr<nsIVariant> result = new storage::AdoptedBlobVariant(
       std::pair(newIdv.release(), newIdvLength));
 
   result.forget(aResult);
   return NS_OK;
 }
 
@@ -2887,19 +2887,19 @@ UpgradeFileIdsFunction::OnFunctionCall(m
     return rv;
   }
 
   if (argc != 2) {
     NS_WARNING("Don't call me with the wrong number of arguments!");
     return NS_ERROR_UNEXPECTED;
   }
 
-  IDB_TRY_UNWRAP(auto cloneInfo,
-                 GetStructuredCloneReadInfoFromValueArray(
-                     aArguments, 1, 0, *mFileManager, Nothing{}));
+  QM_TRY_UNWRAP(auto cloneInfo,
+                GetStructuredCloneReadInfoFromValueArray(
+                    aArguments, 1, 0, *mFileManager, Nothing{}));
 
   nsAutoString fileIds;
   // XXX does this really need non-const cloneInfo?
   rv = DeserializeUpgradeValueToFileIds(cloneInfo, fileIds);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return NS_ERROR_DOM_DATA_CLONE_ERR;
   }
 
@@ -2920,93 +2920,93 @@ Result<bool, nsresult> MaybeUpgradeSchem
 
   // This logic needs to change next time we change the schema!
   static_assert(kSQLiteSchemaVersion == int32_t((26 << 4) + 0),
                 "Upgrade function needed due to schema version increase.");
 
   while (schemaVersion != kSQLiteSchemaVersion) {
     switch (schemaVersion) {
       case 4:
-        IDB_TRY(UpgradeSchemaFrom4To5(aConnection));
+        QM_TRY(UpgradeSchemaFrom4To5(aConnection));
         break;
       case 5:
-        IDB_TRY(UpgradeSchemaFrom5To6(aConnection));
+        QM_TRY(UpgradeSchemaFrom5To6(aConnection));
         break;
       case 6:
-        IDB_TRY(UpgradeSchemaFrom6To7(aConnection));
+        QM_TRY(UpgradeSchemaFrom6To7(aConnection));
         break;
       case 7:
-        IDB_TRY(UpgradeSchemaFrom7To8(aConnection));
+        QM_TRY(UpgradeSchemaFrom7To8(aConnection));
         break;
       case 8:
-        IDB_TRY(UpgradeSchemaFrom8To9_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom8To9_0(aConnection));
         vacuumNeeded = true;
         break;
       case MakeSchemaVersion(9, 0):
-        IDB_TRY(UpgradeSchemaFrom9_0To10_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom9_0To10_0(aConnection));
         break;
       case MakeSchemaVersion(10, 0):
-        IDB_TRY(UpgradeSchemaFrom10_0To11_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom10_0To11_0(aConnection));
         break;
       case MakeSchemaVersion(11, 0):
-        IDB_TRY(UpgradeSchemaFrom11_0To12_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom11_0To12_0(aConnection));
         break;
       case MakeSchemaVersion(12, 0):
-        IDB_TRY(UpgradeSchemaFrom12_0To13_0(aConnection, &vacuumNeeded));
+        QM_TRY(UpgradeSchemaFrom12_0To13_0(aConnection, &vacuumNeeded));
         break;
       case MakeSchemaVersion(13, 0):
-        IDB_TRY(UpgradeSchemaFrom13_0To14_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom13_0To14_0(aConnection));
         break;
       case MakeSchemaVersion(14, 0):
-        IDB_TRY(UpgradeSchemaFrom14_0To15_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom14_0To15_0(aConnection));
         break;
       case MakeSchemaVersion(15, 0):
-        IDB_TRY(UpgradeSchemaFrom15_0To16_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom15_0To16_0(aConnection));
         break;
       case MakeSchemaVersion(16, 0):
-        IDB_TRY(UpgradeSchemaFrom16_0To17_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom16_0To17_0(aConnection));
         break;
       case MakeSchemaVersion(17, 0):
-        IDB_TRY(UpgradeSchemaFrom17_0To18_0(aConnection, aOrigin));
+        QM_TRY(UpgradeSchemaFrom17_0To18_0(aConnection, aOrigin));
         vacuumNeeded = true;
         break;
       case MakeSchemaVersion(18, 0):
-        IDB_TRY(UpgradeSchemaFrom18_0To19_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom18_0To19_0(aConnection));
         break;
       case MakeSchemaVersion(19, 0):
-        IDB_TRY(UpgradeSchemaFrom19_0To20_0(&aFMDirectory, aConnection));
+        QM_TRY(UpgradeSchemaFrom19_0To20_0(&aFMDirectory, aConnection));
         break;
       case MakeSchemaVersion(20, 0):
-        IDB_TRY(UpgradeSchemaFrom20_0To21_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom20_0To21_0(aConnection));
         break;
       case MakeSchemaVersion(21, 0):
-        IDB_TRY(UpgradeSchemaFrom21_0To22_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom21_0To22_0(aConnection));
         break;
       case MakeSchemaVersion(22, 0):
-        IDB_TRY(UpgradeSchemaFrom22_0To23_0(aConnection, aOrigin));
+        QM_TRY(UpgradeSchemaFrom22_0To23_0(aConnection, aOrigin));
         break;
       case MakeSchemaVersion(23, 0):
-        IDB_TRY(UpgradeSchemaFrom23_0To24_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom23_0To24_0(aConnection));
         break;
       case MakeSchemaVersion(24, 0):
-        IDB_TRY(UpgradeSchemaFrom24_0To25_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom24_0To25_0(aConnection));
         break;
       case MakeSchemaVersion(25, 0):
-        IDB_TRY(UpgradeSchemaFrom25_0To26_0(aConnection));
+        QM_TRY(UpgradeSchemaFrom25_0To26_0(aConnection));
         break;
       default:
-        IDB_FAIL(Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR), []() {
+        QM_FAIL(Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR), []() {
           IDB_WARNING(
               "Unable to open IndexedDB database, no upgrade path is "
               "available!");
         });
     }
 
-    IDB_TRY_UNWRAP(schemaVersion,
-                   MOZ_TO_RESULT_INVOKE(aConnection, GetSchemaVersion));
+    QM_TRY_UNWRAP(schemaVersion,
+                  MOZ_TO_RESULT_INVOKE(aConnection, GetSchemaVersion));
   }
 
   MOZ_ASSERT(schemaVersion == kSQLiteSchemaVersion);
 
   return vacuumNeeded;
 }
 
 }  // namespace mozilla::dom::indexedDB
--- a/dom/quota/CheckedUnsafePtr.h
+++ b/dom/quota/CheckedUnsafePtr.h
@@ -80,20 +80,20 @@ class CheckedUnsafePtrBaseAccess {
     aBase.mIsDangling = true;
   }
 };
 
 template <typename T, CheckingSupport = T::SupportsChecking::value>
 class CheckedUnsafePtrBase;
 
 template <typename T, typename U, typename S = std::nullptr_t>
-using EnableIfCompatible =
-    std::enable_if_t<std::is_base_of<T, std::remove_reference_t<decltype(
-                                            *std::declval<U>())>>::value,
-                     S>;
+using EnableIfCompatible = std::enable_if_t<
+    std::is_base_of<
+        T, std::remove_reference_t<decltype(*std::declval<U>())>>::value,
+    S>;
 
 template <typename T>
 class CheckedUnsafePtrBase<T, CheckingSupport::Enabled>
     : detail::CheckedUnsafePtrBaseCheckingEnabled {
  public:
   MOZ_IMPLICIT constexpr CheckedUnsafePtrBase(const std::nullptr_t = nullptr)
       : mRawPtr(nullptr) {}