Bug 1651016 - Introduce IDB_TRY and IDB_TRY_VAR macros; r=ttung
☠☠ backed out by ded0022e1004 ☠ ☠
authorJan Varga <jvarga@mozilla.com>
Thu, 23 Jul 2020 09:18:47 +0000
changeset 541807 5e566996d34e4d424750bf184a13e751a7e3b95f
parent 541806 002ddedb37dc6ec9312a73e36be981964d534f5f
child 541808 9cbebb8e39f3a6893a8171e248fe940f88ae335c
push id37633
push userccoroiu@mozilla.com
push dateFri, 24 Jul 2020 09:32:06 +0000
treeherdermozilla-central@141543043270 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttung
bugs1651016
milestone80.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 1651016 - Introduce IDB_TRY and IDB_TRY_VAR macros; r=ttung Differential Revision: https://phabricator.services.mozilla.com/D84314
dom/indexedDB/IndexedDBCommon.cpp
dom/indexedDB/IndexedDBCommon.h
dom/indexedDB/moz.build
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IndexedDBCommon.cpp
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "IndexedDBCommon.h"
+
+#include "nsPrintfCString.h"
+#include "nsXPCOM.h"
+
+namespace mozilla::dom::indexedDB {
+
+void HandleError(const nsLiteralCString& aExpr,
+                 const nsLiteralCString& aSourceFile, int32_t aSourceLine) {
+#ifdef DEBUG
+  NS_DebugBreak(NS_DEBUG_WARNING, "Error", aExpr.get(), aSourceFile.get(),
+                aSourceLine);
+#endif
+
+  // TODO: Report to browser console
+}
+
+}  // namespace mozilla::dom::indexedDB
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IndexedDBCommon.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_indexeddb_IndexedDBCommon_h
+#define mozilla_dom_indexeddb_IndexedDBCommon_h
+
+#include "mozilla/dom/quota/QuotaCommon.h"
+
+// IndexedDB equivalent of QM_TRY.
+#define IDB_TRY(...) QM_TRY_META(mozilla::dom::indexedDB, ##__VA_ARGS__)
+
+// IndexedDB equivalent of QM_TRY_VAR.
+#define IDB_TRY_VAR(...) QM_TRY_VAR_META(mozilla::dom::indexedDB, ##__VA_ARGS__)
+
+namespace mozilla::dom::indexedDB {
+
+void HandleError(const nsLiteralCString& aExpr,
+                 const nsLiteralCString& aSourceFile, int32_t aSourceLine);
+
+}  // namespace mozilla::dom::indexedDB
+
+#endif  // mozilla_dom_indexeddb_IndexedDBCommon_h
--- a/dom/indexedDB/moz.build
+++ b/dom/indexedDB/moz.build
@@ -68,16 +68,17 @@ UNIFIED_SOURCES += [
     'IDBIndex.cpp',
     'IDBKeyRange.cpp',
     'IDBMutableFile.cpp',
     'IDBObjectStore.cpp',
     'IDBRequest.cpp',
     'IDBTransaction.cpp',
     'IndexedDatabase.cpp',
     'IndexedDatabaseManager.cpp',
+    'IndexedDBCommon.cpp',
     'KeyPath.cpp',
     'PermissionRequestBase.cpp',
     'ProfilerHelpers.cpp',
     'ReportInternalError.cpp',
     'ScriptErrorHelper.cpp',
 ]
 
 SOURCES += [