1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/ReportInternalError.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_indexeddb_reportinternalerror_h__ 1.11 +#define mozilla_dom_indexeddb_reportinternalerror_h__ 1.12 + 1.13 +#include "nsDebug.h" 1.14 + 1.15 +#include "IndexedDatabase.h" 1.16 + 1.17 +#define IDB_WARNING(x) \ 1.18 + mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, x); \ 1.19 + NS_WARNING(x) 1.20 + 1.21 +#define IDB_REPORT_INTERNAL_ERR() \ 1.22 + mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, \ 1.23 + "UnknownErr") 1.24 + 1.25 +// Based on NS_ENSURE_TRUE 1.26 +#define IDB_ENSURE_TRUE(x, ret) \ 1.27 + do { \ 1.28 + if (MOZ_UNLIKELY(!(x))) { \ 1.29 + IDB_REPORT_INTERNAL_ERR(); \ 1.30 + NS_WARNING("IDB_ENSURE_TRUE(" #x ") failed"); \ 1.31 + return ret; \ 1.32 + } \ 1.33 + } while(0) 1.34 + 1.35 +// Based on NS_ENSURE_SUCCESS 1.36 +#define IDB_ENSURE_SUCCESS(res, ret) \ 1.37 + do { \ 1.38 + nsresult __rv = res; /* Don't evaluate |res| more than once */ \ 1.39 + if (NS_FAILED(__rv)) { \ 1.40 + IDB_REPORT_INTERNAL_ERR(); \ 1.41 + NS_ENSURE_SUCCESS_BODY(res, ret) \ 1.42 + return ret; \ 1.43 + } \ 1.44 + } while(0) 1.45 + 1.46 + 1.47 +BEGIN_INDEXEDDB_NAMESPACE 1.48 + 1.49 +void 1.50 +ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr); 1.51 + 1.52 +END_INDEXEDDB_NAMESPACE 1.53 + 1.54 +#endif // mozilla_dom_indexeddb_reportinternalerror_h__