Remove base conditional code for crash reporter and injector.

This commit is contained in:
wolfbeast 2018-03-30 08:50:58 +02:00 • committed by Roy Tam
commit 434f3590e3
131 changed files with 39 additions and 4139 deletions

View file

@ -82,10 +82,6 @@
#include "nsJSUtils.h"
#include "nsWrapperCache.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"
@ -539,10 +535,6 @@ CycleCollectedJSContext::Initialize(JSContext* aParentContext,
JS_SetSweepZoneCallback(mJSContext, XPCStringConvert::ClearZoneCache);
JS::SetBuildIdOp(mJSContext, GetBuildId);
JS::SetWarningReporter(mJSContext, MozCrashWarningReporter);
#ifdef MOZ_CRASHREPORTER
js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
CrashReporter::AnnotateOOMAllocationSize);
#endif
static js::DOMCallbacks DOMcallbacks = {
InstanceClassHasProtoAtDepth
@ -1607,16 +1599,6 @@ CycleCollectedJSContext::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
MOZ_ASSERT(mJSContext);
*aStatePtr = aNewState;
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
? NS_LITERAL_CSTRING("JSOutOfMemory")
: NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
aNewState == OOMState::Reporting
? NS_LITERAL_CSTRING("Reporting")
: aNewState == OOMState::Reported
? NS_LITERAL_CSTRING("Reported")
: NS_LITERAL_CSTRING("Recovered"));
#endif
}
void
@ -1630,14 +1612,6 @@ CycleCollectedJSContext::OnGC(JSGCStatus aStatus)
mZonesWaitingForGC.Clear();
break;
case JSGC_END: {
#ifdef MOZ_CRASHREPORTER
if (mOutOfMemoryState == OOMState::Reported) {
AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Recovered);
}
if (mLargeAllocationFailureState == OOMState::Reported) {
AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Recovered);
}
#endif
// Do any deferred finalization of native objects.
FinalizeDeferredThings(JS::WasIncrementalGC(mJSContext) ? FinalizeIncrementally :

View file

@ -8,22 +8,11 @@
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
namespace mozilla {
static int
ReportException(EXCEPTION_POINTERS* aExceptionInfo)
{
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (cr) {
cr->WriteMinidumpForException(aExceptionInfo);
}
#endif
return EXCEPTION_EXECUTE_HANDLER;
}

View file

@ -188,10 +188,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThreadLocal.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
//#define COLLECT_TIME_DEBUG
@ -3150,14 +3146,6 @@ nsCycleCollector::ScanWhiteNodes(bool aFullySynchGraphBuild)
}
if (pi->mInternalRefs > pi->mRefCount) {
#ifdef MOZ_CRASHREPORTER
const char* piName = "Unknown";
if (pi->mParticipant) {
piName = pi->mParticipant->ClassName();
}
nsPrintfCString msg("More references to an object than its refcount, for class %s", piName);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
#endif
MOZ_CRASH();
}

View file

@ -11,9 +11,6 @@
#include "nsDebugImpl.h"
#include "nsDebug.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "prprf.h"
@ -380,22 +377,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
return;
case NS_DEBUG_ABORT: {
#if defined(MOZ_CRASHREPORTER)
// Updating crash annotations in the child causes us to do IPC. This can
// really cause trouble if we're asserting from within IPC code. So we
// have to do without the annotations in that case.
if (XRE_IsParentProcess()) {
// Don't include the PID in the crash report annotation to
// allow faceting on crash-stats.mozilla.org.
nsCString note("xpcom_runtime_abort(");
note += nonPIDBuf.buffer;
note += ")";
CrashReporter::AppendAppNotesToCrashReport(note);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
nsDependentCString(nonPIDBuf.buffer));
}
#endif // MOZ_CRASHREPORTER
#if defined(DEBUG) && defined(_WIN32)
RealBreak();
#endif
@ -600,8 +581,5 @@ NS_ErrorAccordingToNSPR()
void
NS_ABORT_OOM(size_t aSize)
{
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateOOMAllocationSize(aSize);
#endif
MOZ_CRASH("OOM");
}

View file

@ -17,12 +17,6 @@
#import <ExceptionHandling/NSExceptionHandler.h>
#endif
#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
#include "nsICrashReporter.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#endif
#include <unistd.h>
#include <signal.h>
#include "nsError.h"
@ -47,15 +41,6 @@ nsObjCExceptionLog(NSException* aException)
NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]",
[aException name], [aException reason]);
#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
// Attach exception info to the crash report.
nsCOMPtr<nsICrashReporter> crashReporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashReporter) {
crashReporter->AppendObjCExceptionInfoToAppNotes(static_cast<void*>(aException));
}
#endif
#ifdef DEBUG
@try {
// Try to get stack information out of the exception. 10.5 returns the stack