Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d3d6027

Browse files
committed
Bug 1372823 Part 3: Annotate crash with database name when storage connection not closed. r=janv
1 parent fffd219 commit d3d6027

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

storage/mozStorageService.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
#include "sqlite3.h"
2727
#include "mozilla/AutoSQLiteLifetime.h"
2828

29-
#ifdef SQLITE_OS_WIN
29+
#ifdef MOZ_CRASHREPORTER
30+
#include "nsExceptionHandler.h"
31+
#endif
32+
33+
#ifdef XP_WIN
3034
// "windows.h" was included and it can #define lots of things we care about...
3135
#undef CompareString
3236
#endif
@@ -824,6 +828,17 @@ Service::Observe(nsISupports *, const char *aTopic, const char16_t *)
824828
getConnections(connections);
825829
for (uint32_t i = 0, n = connections.Length(); i < n; i++) {
826830
if (!connections[i]->isClosed()) {
831+
#ifdef MOZ_CRASHREPORTER
832+
// getFilename is only the leaf name for the database file,
833+
// so it shouldn't contain privacy-sensitive information.
834+
CrashReporter::AnnotateCrashReport(
835+
NS_LITERAL_CSTRING("StorageConnectionNotClosed"),
836+
connections[i]->getFilename());
837+
#endif
838+
#ifdef DEBUG
839+
printf_stderr("Storage connection not closed: %s",
840+
connections[i]->getFilename().get());
841+
#endif
827842
MOZ_CRASH();
828843
}
829844
}

0 commit comments

Comments
 (0)