зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1415103 - Remove dead code in crash reporting. r=gsvelto
This removes dead code using headlessClient and lastRunCrashID in crash reporting. headlessClient is unconditional now. nsIXULRuntime.lastRunCrashID is not used anymore so remove code for implementing it. MozReview-Commit-ID: AU4bUeIx3O0
This commit is contained in:
Родитель
f26c326098
Коммит
688b2f09c8
|
@ -206,9 +206,6 @@ static char* currentSessionId = nullptr;
|
|||
// If this is false, we don't launch the crash reporter
|
||||
static bool doReport = true;
|
||||
|
||||
// If this is true, we don't have a crash reporter
|
||||
static bool headlessClient = false;
|
||||
|
||||
// if this is true, we pass the exception on to the OS crash reporter
|
||||
static bool showOSCrashReporter = false;
|
||||
|
||||
|
@ -217,15 +214,6 @@ static time_t lastCrashTime = 0;
|
|||
// The pathname of a file to store the crash time in
|
||||
static XP_CHAR lastCrashTimeFilename[XP_PATH_MAX] = {0};
|
||||
|
||||
// A marker file to hold the path to the last dump written, which
|
||||
// will be checked on startup.
|
||||
static XP_CHAR crashMarkerFilename[XP_PATH_MAX] = {0};
|
||||
|
||||
// Whether we've already looked for the marker file.
|
||||
static bool lastRunCrashID_checked = false;
|
||||
// The minidump ID contained in the marker file.
|
||||
static nsString* lastRunCrashID = nullptr;
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
// on Android 4.2 and above there is a user serial number associated
|
||||
// with the current process that gets lost when we fork so we need to
|
||||
|
@ -986,17 +974,6 @@ MinidumpCallback(
|
|||
#endif
|
||||
}
|
||||
|
||||
if (headlessClient) {
|
||||
// Leave a marker indicating that there was a crash.
|
||||
PlatformWriter markerFile(crashMarkerFilename);
|
||||
#if defined(XP_WIN)
|
||||
markerFile.WriteBuffer(reinterpret_cast<const char*>(minidumpPath),
|
||||
2*wcslen(minidumpPath));
|
||||
#elif defined(XP_UNIX)
|
||||
markerFile.WriteBuffer(minidumpPath, my_strlen(minidumpPath));
|
||||
#endif
|
||||
}
|
||||
|
||||
char oomAllocationSizeBuffer[32] = "";
|
||||
if (gOOMAllocationSize) {
|
||||
XP_STOA(gOOMAllocationSize, oomAllocationSizeBuffer, 10);
|
||||
|
@ -1593,29 +1570,28 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
|
|||
notesField = new nsCString();
|
||||
NS_ENSURE_TRUE(notesField, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!headlessClient) {
|
||||
#if !defined(MOZ_WIDGET_ANDROID)
|
||||
// Locate the crash reporter executable
|
||||
nsAutoString crashReporterPath_temp;
|
||||
nsresult rv = LocateExecutable(aXREDirectory,
|
||||
NS_LITERAL_CSTRING(CRASH_REPORTER_FILENAME),
|
||||
crashReporterPath_temp);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
// Locate the crash reporter executable
|
||||
nsAutoString crashReporterPath_temp;
|
||||
nsresult rv = LocateExecutable(aXREDirectory,
|
||||
NS_LITERAL_CSTRING(CRASH_REPORTER_FILENAME),
|
||||
crashReporterPath_temp);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
nsCOMPtr<nsIFile> libPath;
|
||||
rv = aXREDirectory->Clone(getter_AddRefs(libPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIFile> libPath;
|
||||
rv = aXREDirectory->Clone(getter_AddRefs(libPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString libraryPath_temp;
|
||||
rv = libPath->GetPath(libraryPath_temp);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
nsAutoString libraryPath_temp;
|
||||
rv = libPath->GetPath(libraryPath_temp);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
#endif // XP_MACOSX
|
||||
|
||||
#ifdef XP_WIN32
|
||||
|
@ -1628,20 +1604,19 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
|
|||
#endif
|
||||
#endif // XP_WIN32
|
||||
#else
|
||||
// On Android, we launch using the application package name instead of a
|
||||
// filename, so use the dynamically set MOZ_ANDROID_PACKAGE_NAME, or fall
|
||||
// back to the static ANDROID_PACKAGE_NAME.
|
||||
const char* androidPackageName = PR_GetEnv("MOZ_ANDROID_PACKAGE_NAME");
|
||||
if (androidPackageName != nullptr) {
|
||||
nsCString package(androidPackageName);
|
||||
package.AppendLiteral("/org.mozilla.gecko.CrashReporter");
|
||||
crashReporterPath = ToNewCString(package);
|
||||
} else {
|
||||
nsCString package(ANDROID_PACKAGE_NAME "/org.mozilla.gecko.CrashReporter");
|
||||
crashReporterPath = ToNewCString(package);
|
||||
}
|
||||
#endif // !defined(MOZ_WIDGET_ANDROID)
|
||||
// On Android, we launch using the application package name instead of a
|
||||
// filename, so use the dynamically set MOZ_ANDROID_PACKAGE_NAME, or fall
|
||||
// back to the static ANDROID_PACKAGE_NAME.
|
||||
const char* androidPackageName = PR_GetEnv("MOZ_ANDROID_PACKAGE_NAME");
|
||||
if (androidPackageName != nullptr) {
|
||||
nsCString package(androidPackageName);
|
||||
package.AppendLiteral("/org.mozilla.gecko.CrashReporter");
|
||||
crashReporterPath = ToNewCString(package);
|
||||
} else {
|
||||
nsCString package(ANDROID_PACKAGE_NAME "/org.mozilla.gecko.CrashReporter");
|
||||
crashReporterPath = ToNewCString(package);
|
||||
}
|
||||
#endif // !defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
// get temp path to use for minidump path
|
||||
#if defined(XP_WIN32)
|
||||
|
@ -2041,34 +2016,6 @@ nsresult SetupExtraData(nsIFile* aAppDataDirectory, const nsACString& aBuildID)
|
|||
strncpy(lastCrashTimeFilename, filename.get(), filename.Length());
|
||||
#endif
|
||||
|
||||
if (headlessClient) {
|
||||
nsCOMPtr<nsIFile> markerFile;
|
||||
rv = dataDirectory->Clone(getter_AddRefs(markerFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = markerFile->AppendNative(NS_LITERAL_CSTRING("LastCrashFilename"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
memset(crashMarkerFilename, 0, sizeof(crashMarkerFilename));
|
||||
|
||||
#if defined(XP_WIN32)
|
||||
nsAutoString markerFilename;
|
||||
rv = markerFile->GetPath(markerFilename);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (markerFilename.Length() < XP_PATH_MAX)
|
||||
wcsncpy(crashMarkerFilename, markerFilename.get(),
|
||||
markerFilename.Length());
|
||||
#else
|
||||
nsAutoCString markerFilename;
|
||||
rv = markerFile->GetNativePath(markerFilename);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (markerFilename.Length() < XP_PATH_MAX)
|
||||
strncpy(crashMarkerFilename, markerFilename.get(),
|
||||
markerFilename.Length());
|
||||
#endif
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2108,9 +2055,6 @@ nsresult UnsetExceptionHandler()
|
|||
delete notesField;
|
||||
notesField = nullptr;
|
||||
|
||||
delete lastRunCrashID;
|
||||
lastRunCrashID = nullptr;
|
||||
|
||||
if (pendingDirectory) {
|
||||
free(pendingDirectory);
|
||||
pendingDirectory = nullptr;
|
||||
|
@ -3622,83 +3566,6 @@ UnregisterInjectorCallback(DWORD processID)
|
|||
|
||||
#endif // MOZ_CRASHREPORTER_INJECTOR
|
||||
|
||||
static bool
|
||||
CheckForLastRunCrash()
|
||||
{
|
||||
if (lastRunCrashID)
|
||||
return true;
|
||||
|
||||
// The exception handler callback leaves the filename of the
|
||||
// last minidump in a known file.
|
||||
nsCOMPtr<nsIFile> lastCrashFile;
|
||||
CreateFileFromPath(crashMarkerFilename,
|
||||
getter_AddRefs(lastCrashFile));
|
||||
|
||||
bool exists;
|
||||
if (NS_FAILED(lastCrashFile->Exists(&exists)) || !exists) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString lastMinidump_contents;
|
||||
if (NS_FAILED(GetFileContents(lastCrashFile, lastMinidump_contents))) {
|
||||
return false;
|
||||
}
|
||||
lastCrashFile->Remove(false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Ugly but effective.
|
||||
nsDependentString lastMinidump(
|
||||
reinterpret_cast<const char16_t*>(lastMinidump_contents.get()));
|
||||
#else
|
||||
nsAutoCString lastMinidump = lastMinidump_contents;
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> lastMinidumpFile;
|
||||
CreateFileFromPath(lastMinidump.get(),
|
||||
getter_AddRefs(lastMinidumpFile));
|
||||
|
||||
if (!lastMinidumpFile || NS_FAILED(lastMinidumpFile->Exists(&exists)) || !exists) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> lastExtraFile;
|
||||
if (!GetExtraFileForMinidump(lastMinidumpFile,
|
||||
getter_AddRefs(lastExtraFile))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> memoryReportFile;
|
||||
nsresult rv = GetDefaultMemoryReportFile(getter_AddRefs(memoryReportFile));
|
||||
if (NS_FAILED(rv) || NS_FAILED(memoryReportFile->Exists(&exists)) || !exists) {
|
||||
memoryReportFile = nullptr;
|
||||
}
|
||||
|
||||
FindPendingDir();
|
||||
|
||||
// Move {dump,extra,memory} to pending folder
|
||||
if (!MoveToPending(lastMinidumpFile, lastExtraFile, memoryReportFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lastRunCrashID = new nsString();
|
||||
return GetIDFromMinidump(lastMinidumpFile, *lastRunCrashID);
|
||||
}
|
||||
|
||||
bool
|
||||
GetLastRunCrashID(nsAString& id)
|
||||
{
|
||||
if (!lastRunCrashID_checked) {
|
||||
CheckForLastRunCrash();
|
||||
lastRunCrashID_checked = true;
|
||||
}
|
||||
|
||||
if (!lastRunCrashID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
id = *lastRunCrashID;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
void
|
||||
InitChildProcessTmpDir(nsIFile* aDirOverride)
|
||||
|
|
|
@ -85,8 +85,6 @@ void SetMinidumpAnalysisAllThreads();
|
|||
nsresult SetRestartArgs(int argc, char** argv);
|
||||
nsresult SetupExtraData(nsIFile* aAppDataDirectory,
|
||||
const nsACString& aBuildID);
|
||||
bool GetLastRunCrashID(nsAString& id);
|
||||
|
||||
// Registers an additional memory region to be included in the minidump
|
||||
nsresult RegisterAppMemory(void* ptr, size_t length);
|
||||
nsresult UnregisterAppMemory(void* ptr);
|
||||
|
|
|
@ -1109,17 +1109,6 @@ nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID)
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::GetLastRunCrashID(aLastRunCrashID);
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetIsReleaseOrBeta(bool* aResult)
|
||||
{
|
||||
|
|
|
@ -168,12 +168,6 @@ interface nsIXULRuntime : nsISupports
|
|||
*/
|
||||
readonly attribute PRTime replacedLockTime;
|
||||
|
||||
/**
|
||||
* Local ID of the minidump generated when the process crashed
|
||||
* on the previous run. Can be passed directly to CrashSubmit.submit.
|
||||
*/
|
||||
readonly attribute DOMString lastRunCrashID;
|
||||
|
||||
/**
|
||||
* True if this is RELEASE_OR_BETA.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче