Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_dom_indexeddb_reportinternalerror_h__ |
michael@0 | 8 | #define mozilla_dom_indexeddb_reportinternalerror_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsDebug.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "IndexedDatabase.h" |
michael@0 | 13 | |
michael@0 | 14 | #define IDB_WARNING(x) \ |
michael@0 | 15 | mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, x); \ |
michael@0 | 16 | NS_WARNING(x) |
michael@0 | 17 | |
michael@0 | 18 | #define IDB_REPORT_INTERNAL_ERR() \ |
michael@0 | 19 | mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, \ |
michael@0 | 20 | "UnknownErr") |
michael@0 | 21 | |
michael@0 | 22 | // Based on NS_ENSURE_TRUE |
michael@0 | 23 | #define IDB_ENSURE_TRUE(x, ret) \ |
michael@0 | 24 | do { \ |
michael@0 | 25 | if (MOZ_UNLIKELY(!(x))) { \ |
michael@0 | 26 | IDB_REPORT_INTERNAL_ERR(); \ |
michael@0 | 27 | NS_WARNING("IDB_ENSURE_TRUE(" #x ") failed"); \ |
michael@0 | 28 | return ret; \ |
michael@0 | 29 | } \ |
michael@0 | 30 | } while(0) |
michael@0 | 31 | |
michael@0 | 32 | // Based on NS_ENSURE_SUCCESS |
michael@0 | 33 | #define IDB_ENSURE_SUCCESS(res, ret) \ |
michael@0 | 34 | do { \ |
michael@0 | 35 | nsresult __rv = res; /* Don't evaluate |res| more than once */ \ |
michael@0 | 36 | if (NS_FAILED(__rv)) { \ |
michael@0 | 37 | IDB_REPORT_INTERNAL_ERR(); \ |
michael@0 | 38 | NS_ENSURE_SUCCESS_BODY(res, ret) \ |
michael@0 | 39 | return ret; \ |
michael@0 | 40 | } \ |
michael@0 | 41 | } while(0) |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | BEGIN_INDEXEDDB_NAMESPACE |
michael@0 | 45 | |
michael@0 | 46 | void |
michael@0 | 47 | ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr); |
michael@0 | 48 | |
michael@0 | 49 | END_INDEXEDDB_NAMESPACE |
michael@0 | 50 | |
michael@0 | 51 | #endif // mozilla_dom_indexeddb_reportinternalerror_h__ |