From 5bd9082ece8f8e54698b2857bac799e9b38f6c86 Mon Sep 17 00:00:00 2001 From: Jan Varga Date: Tue, 3 Feb 2015 07:29:51 +0100 Subject: [PATCH] Bug 1124189 - IndexedDB Unkown Error @ ActorsParent.cpp:414 when calling indexedDB.open; r=bent --- dom/quota/QuotaCommon.h | 11 +++++++++++ dom/quota/QuotaManager.cpp | 30 +++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/dom/quota/QuotaCommon.h b/dom/quota/QuotaCommon.h index d3231666491..d008ef34bab 100644 --- a/dom/quota/QuotaCommon.h +++ b/dom/quota/QuotaCommon.h @@ -10,6 +10,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsDebug.h" +#include "nsPrintfCString.h" #include "nsString.h" #include "nsTArray.h" @@ -22,6 +23,13 @@ #define DSSTORE_FILE_NAME ".DS_Store" +#define QM_WARNING(...) \ + do { \ + nsPrintfCString str(__VA_ARGS__); \ + mozilla::dom::quota::ReportInternalError(__FILE__, __LINE__, str.get()); \ + NS_WARNING(str.get()); \ + } while (0) + BEGIN_QUOTA_NAMESPACE void @@ -33,6 +41,9 @@ AssertCurrentThreadOwnsQuotaMutex(); bool IsOnIOThread(); +void +ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr); + END_QUOTA_NAMESPACE #endif // mozilla_dom_quota_quotacommon_h__ diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index 80066345e59..60b314cefeb 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -88,8 +88,6 @@ #define MB * 1024ULL KB #define GB * 1024ULL MB -#define QM_WARNING(...) NS_WARNING(nsPrintfCString(__VA_ARGS__).get()) - USING_QUOTA_NAMESPACE using namespace mozilla; using namespace mozilla::dom; @@ -489,6 +487,22 @@ AssertCurrentThreadOwnsQuotaMutex() #endif } +void +ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) +{ + // Get leaf of file path + for (const char* p = aFile; *p; ++p) { + if (*p == '/' && *(p + 1)) { + aFile = p + 1; + } + } + + nsContentUtils::LogSimpleConsoleError( + NS_ConvertUTF8toUTF16(nsPrintfCString( + "Quota %s: %s:%lu", aStr, aFile, aLine)), + "quota"); +} + END_QUOTA_NAMESPACE namespace { @@ -1910,9 +1924,8 @@ QuotaManager::InitializeRepository(PersistenceType aPersistenceType) continue; } - nsPrintfCString message("Something (%s) in the repository that doesn't " - "belong!", NS_ConvertUTF16toUTF8(leafName).get()); - NS_WARNING(message.get()); + QM_WARNING("Something (%s) in the repository that doesn't belong!", + NS_ConvertUTF16toUTF8(leafName).get()); return NS_ERROR_UNEXPECTED; } @@ -4802,9 +4815,8 @@ OriginParser::Parse(uint32_t* aAppId, } if (mError) { - nsPrintfCString message("Origin '%s' failed to parse, handled tokens: %s", - mOrigin.get(), mHandledTokens.get()); - NS_WARNING(message.get()); + QM_WARNING("Origin '%s' failed to parse, handled tokens: %s", mOrigin.get(), + mHandledTokens.get()); return false; } @@ -5059,7 +5071,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken) MOZ_ASSERT(mSchemaType == eFile); if (aToken.IsEmpty()) { - QM_WARNING("Expected a driver letter or pathname component " + QM_WARNING("Expected a drive letter or pathname component " "(not an empty string)!"); mError = true;