зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from ipc; r=billm
MozReview-Commit-ID: 4mDW7cJqHDn --HG-- extra : rebase_source : 17c51ed796733d4a512e1d6f47273318dcc26b11
This commit is contained in:
Родитель
9a1d2f50d2
Коммит
ef3b2f88cc
|
@ -8,7 +8,6 @@
|
|||
#include "CrashReporterMetadataShmem.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
|
@ -65,4 +64,3 @@ CrashReporterClient::GetSingleton()
|
|||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
#endif // MOZ_CRASHREPORTER
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/ipc/Shmem.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
|
@ -78,7 +77,6 @@ private:
|
|||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
#endif // MOZ_CRASHREPORTER
|
||||
|
||||
#endif // mozilla_ipc_CrashReporterClient_h
|
||||
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsIAsyncShutdown.h"
|
||||
#include "nsICrashService.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
@ -30,7 +28,6 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
bool
|
||||
CrashReporterHost::GenerateCrashReport(base::ProcessId aPid)
|
||||
{
|
||||
|
@ -288,7 +285,6 @@ CrashReporterHost::AddNote(const nsCString& aKey, const nsCString& aValue)
|
|||
{
|
||||
mExtraNotes.Put(aKey, aValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/ipc/Shmem.h"
|
||||
#include "base/process.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -30,13 +28,8 @@ class GeckoChildProcessHost;
|
|||
class CrashReporterHost
|
||||
{
|
||||
typedef mozilla::ipc::Shmem Shmem;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
typedef CrashReporter::AnnotationTable AnnotationTable;
|
||||
typedef CrashReporter::ThreadId ThreadId;
|
||||
#else
|
||||
// unused in this case
|
||||
typedef int32_t ThreadId;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
|
@ -99,7 +92,6 @@ public:
|
|||
const Shmem& aShmem,
|
||||
ThreadId aThreadId);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// Helper function for generating a crash report for a process that probably
|
||||
// crashed (i.e., had an AbnormalShutdown in ActorDestroy). Returns true if
|
||||
// the process has a minidump attached and we were able to generate a report.
|
||||
|
@ -149,7 +141,6 @@ public:
|
|||
MOZ_ASSERT(HasMinidump());
|
||||
return mDumpID;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void AsyncAddCrash(int32_t aProcessType, int32_t aCrashType,
|
||||
|
@ -161,9 +152,7 @@ private:
|
|||
Shmem mShmem;
|
||||
ThreadId mThreadId;
|
||||
time_t mStartTime;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
AnnotationTable mExtraNotes;
|
||||
#endif
|
||||
nsString mDumpID;
|
||||
bool mFinalized;
|
||||
nsCOMPtr<nsIFile> mTargetDump;
|
||||
|
|
|
@ -208,7 +208,6 @@ private:
|
|||
EntryType mEntryType;
|
||||
};
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void
|
||||
CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes)
|
||||
{
|
||||
|
@ -229,7 +228,6 @@ CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::Ann
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -28,9 +28,7 @@ public:
|
|||
void AnnotateCrashReport(const nsCString& aKey, const nsCString& aData);
|
||||
void AppendAppNotes(const nsCString& aData);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
static void ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void SyncNotesToShmem();
|
||||
|
|
|
@ -224,11 +224,9 @@ GeckoChildProcessHost::GetUniqueID()
|
|||
void
|
||||
GeckoChildProcessHost::PrepareLaunch()
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (CrashReporter::GetEnabled()) {
|
||||
CrashReporter::OOPInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
SandboxLaunchPrepare(mProcessType, mLaunchOptions.get());
|
||||
|
@ -755,9 +753,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
// always populated (but possibly with an empty value) for a GPU child process.
|
||||
if (mProcessType == GeckoProcessType_GPU) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
# ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::GetChildProcessTmpDir(getter_AddRefs(file));
|
||||
# endif // MOZ_CRASHREPORTER
|
||||
nsAutoCString path;
|
||||
if (file) {
|
||||
file->GetNativePath(path);
|
||||
|
@ -767,26 +763,27 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
|
||||
childArgv.push_back(pidstring);
|
||||
|
||||
# if defined(MOZ_CRASHREPORTER)
|
||||
if (!CrashReporter::IsDummy()) {
|
||||
#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
|
||||
int childCrashFd, childCrashRemapFd;
|
||||
if (!CrashReporter::CreateNotificationPipeForChild(
|
||||
&childCrashFd, &childCrashRemapFd))
|
||||
if (!CrashReporter::CreateNotificationPipeForChild(&childCrashFd,
|
||||
&childCrashRemapFd)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 <= childCrashFd) {
|
||||
mLaunchOptions->fds_to_remap
|
||||
.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd));
|
||||
// "true" == crash reporting enabled
|
||||
childArgv.push_back("true");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// "false" == crash reporting disabled
|
||||
childArgv.push_back("false");
|
||||
}
|
||||
#elif defined(MOZ_WIDGET_COCOA) // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
|
||||
childArgv.push_back(CrashReporter::GetChildNotificationPipe());
|
||||
#endif // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
|
||||
# endif // defined(MOZ_CRASHREPORTER)
|
||||
}
|
||||
|
||||
# ifdef MOZ_WIDGET_COCOA
|
||||
// Add a mach port to the command line so the child can communicate its
|
||||
|
@ -1000,9 +997,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
// always populated (but possibly with an empty value) for a GPU child process.
|
||||
if (mProcessType == GeckoProcessType_GPU) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
# ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::GetChildProcessTmpDir(getter_AddRefs(file));
|
||||
# endif // MOZ_CRASHREPORTER
|
||||
nsString path;
|
||||
if (file) {
|
||||
MOZ_ALWAYS_SUCCEEDS(file->GetPath(path));
|
||||
|
@ -1014,10 +1009,8 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
|||
// Process id
|
||||
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
|
||||
|
||||
# if defined(MOZ_CRASHREPORTER)
|
||||
cmdLine.AppendLooseValue(
|
||||
UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
|
||||
# endif // defined(MOZ_CRASHREPORTER)
|
||||
|
||||
// Process type
|
||||
cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
#include "nsID.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsMemory.h"
|
||||
|
@ -127,16 +125,12 @@ struct EnumSerializer {
|
|||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
||||
uintParamType value;
|
||||
if (!ReadParam(aMsg, aIter, &value)) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
|
||||
NS_LITERAL_CSTRING("Bad iter"));
|
||||
#endif
|
||||
return false;
|
||||
} else if (!EnumValidator::IsLegalValue(paramType(value))) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
|
||||
NS_LITERAL_CSTRING("Illegal value"));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
*aResult = paramType(value);
|
||||
|
|
|
@ -674,10 +674,8 @@ void
|
|||
MessageChannel::WillDestroyCurrentMessageLoop()
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
|
||||
nsDependentCString(mName));
|
||||
#endif
|
||||
MOZ_CRASH("MessageLoop destroyed before MessageChannel that's bound to it");
|
||||
#endif
|
||||
|
||||
|
@ -701,10 +699,8 @@ MessageChannel::Clear()
|
|||
|
||||
#if !defined(ANDROID)
|
||||
if (!Unsound_IsClosed()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
|
||||
nsDependentCString(mName));
|
||||
#endif
|
||||
MOZ_CRASH("MessageChannel destroyed without being closed");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "nsDebug.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
@ -161,10 +159,8 @@ void
|
|||
ProcessLink::SendMessage(Message *msg)
|
||||
{
|
||||
if (msg->size() > IPC::Channel::kMaximumMessageSize) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name()));
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size()));
|
||||
#endif
|
||||
MOZ_CRASH("IPC message size is too large");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "mozilla/sandboxTarget.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
|
||||
#if defined(XP_WIN)
|
||||
#include "aclapi.h"
|
||||
#include "sddl.h"
|
||||
|
||||
|
@ -45,7 +45,7 @@ using base::ProcessId;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
|
||||
#if defined(XP_WIN)
|
||||
// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR.
|
||||
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \
|
||||
RemovePointer<LPTSTR>::Type, \
|
||||
|
@ -209,11 +209,9 @@ bool DuplicateHandle(HANDLE aSourceHandle,
|
|||
FALSE,
|
||||
aTargetProcessId));
|
||||
if (!targetProcess) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
NS_LITERAL_CSTRING("IPCTransportFailureReason"),
|
||||
NS_LITERAL_CSTRING("Failed to open target process."));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -223,7 +221,6 @@ bool DuplicateHandle(HANDLE aSourceHandle,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void
|
||||
AnnotateSystemError()
|
||||
{
|
||||
|
@ -239,9 +236,8 @@ AnnotateSystemError()
|
|||
nsPrintfCString("%" PRId64, error));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
void
|
||||
AnnotateCrashReportWithErrno(const char* tag, int error)
|
||||
{
|
||||
|
@ -288,7 +284,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
|
|||
formattedMessage.AppendLiteral("]: \"");
|
||||
formattedMessage.AppendASCII(aMsg);
|
||||
if (aIsParent) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// We're going to crash the parent process because at this time
|
||||
// there's no other really nice way of getting a minidump out of
|
||||
// this process if we're off the main thread.
|
||||
|
@ -299,7 +294,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
|
|||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
|
||||
nsDependentCString(aMsg));
|
||||
AnnotateSystemError();
|
||||
#endif
|
||||
MOZ_CRASH("IPC FatalError in the parent process!");
|
||||
} else {
|
||||
formattedMessage.AppendLiteral("\". abort()ing as a result.");
|
||||
|
@ -617,11 +611,7 @@ bool
|
|||
IToplevelProtocol::TakeMinidump(nsIFile** aDump, uint32_t* aSequence)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(GetSide() == ParentSide);
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -573,11 +573,7 @@ DuplicateHandle(HANDLE aSourceHandle,
|
|||
* Annotate the crash reporter with the error code from the most recent system
|
||||
* call. Returns the system error.
|
||||
*/
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void AnnotateSystemError();
|
||||
#else
|
||||
#define AnnotateSystemError() do { } while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An endpoint represents one end of a partially initialized IPDL channel. To
|
||||
|
@ -696,7 +692,7 @@ private:
|
|||
ProcessId mMyPid, mOtherPid;
|
||||
};
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
void AnnotateCrashReportWithErrno(const char* tag, int error);
|
||||
#else
|
||||
static inline void AnnotateCrashReportWithErrno(const char* tag, int error)
|
||||
|
|
|
@ -2566,13 +2566,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ]
|
||||
+ setToIncludes(self.externalIncludes))
|
||||
|
||||
if self.protocol.decl.type.isToplevel():
|
||||
cf.addthings([
|
||||
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
|
||||
CppDirective(' include', '"nsXULAppAPI.h"'),
|
||||
CppDirective('endif')
|
||||
])
|
||||
|
||||
cppheaders = [CppDirective('include', '"%s"' % filename)
|
||||
for filename in ipdl.builtin.CppIncludes]
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
#if defined(MOZ_CONTENT_SANDBOX)
|
||||
#include "mozilla/SandboxSettings.h"
|
||||
#endif // defined(MOZ_CONTENT_SANDBOX)
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
|
||||
namespace mozilla {
|
||||
namespace mscom {
|
||||
|
@ -212,10 +210,8 @@ struct ParamTraits<mozilla::mscom::COMPtrHolder<Interface, _IID>>
|
|||
|
||||
mozilla::mscom::ProxyStream proxyStream(_IID, buf.get(), length, &env);
|
||||
if (!proxyStream.IsValid()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamValid"),
|
||||
NS_LITERAL_CSTRING("false"));
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,15 +22,12 @@
|
|||
#include "mozilla/DebugOnly.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#define ENSURE_HR_SUCCEEDED(hr) \
|
||||
if (FAILED((HRESULT)hr)) { \
|
||||
nsPrintfCString location("ENSURE_HR_SUCCEEDED \"%s\": %u", __FILE__, __LINE__); \
|
||||
|
@ -40,15 +37,6 @@
|
|||
return hr; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define ENSURE_HR_SUCCEEDED(hr) \
|
||||
if (FAILED((HRESULT)hr)) { \
|
||||
return hr; \
|
||||
}
|
||||
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
|
||||
namespace mozilla {
|
||||
namespace mscom {
|
||||
namespace detail {
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
#include "nsWindowsHelpers.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
|
@ -50,7 +50,7 @@ MainThreadRuntime::MainThreadRuntime()
|
|||
, mActCtxRgn(a11y::Compatibility::GetActCtxResourceId())
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
{
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
GeckoProcessType procType = XRE_GetProcessType();
|
||||
if (procType == GeckoProcessType_Default ||
|
||||
procType == GeckoProcessType_Content) {
|
||||
|
@ -65,7 +65,7 @@ MainThreadRuntime::MainThreadRuntime()
|
|||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AssemblyManifestCtx"),
|
||||
strActCtx);
|
||||
}
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
|
||||
// We must be the outermost COM initialization on this thread. The COM runtime
|
||||
// cannot be configured once we start manipulating objects
|
||||
|
|
|
@ -5,22 +5,20 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
#include "HandlerData.h"
|
||||
#include "mozilla/a11y/Platform.h"
|
||||
#include "mozilla/mscom/ActivationContext.h"
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
#include "mozilla/mscom/EnsureMTA.h"
|
||||
#include "mozilla/mscom/ProxyStream.h"
|
||||
#include "mozilla/mscom/Utils.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
#include "mozilla/mscom/Objref.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "RegistrationAnnotator.h"
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
|
@ -46,15 +44,11 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
, mBufSize(aInitBufSize)
|
||||
, mPreserveStream(false)
|
||||
{
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
NS_NAMED_LITERAL_CSTRING(kCrashReportKey, "ProxyStreamUnmarshalStatus");
|
||||
#endif
|
||||
|
||||
if (!aInitBufSize) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(kCrashReportKey,
|
||||
NS_LITERAL_CSTRING("!aInitBufSize"));
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
// We marshaled a nullptr. Nothing else to do here.
|
||||
return;
|
||||
}
|
||||
|
@ -62,10 +56,8 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
HRESULT createStreamResult = CreateStream(aInitBuf, aInitBufSize,
|
||||
getter_AddRefs(mStream));
|
||||
if (FAILED(createStreamResult)) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
nsPrintfCString hrAsStr("0x%08X", createStreamResult);
|
||||
CrashReporter::AnnotateCrashReport(kCrashReportKey, hrAsStr);
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,18 +66,16 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
// in that case, even though marshaling a nullptr is allowable.
|
||||
MOZ_ASSERT(mStream);
|
||||
if (!mStream) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(kCrashReportKey,
|
||||
NS_LITERAL_CSTRING("!mStream"));
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
const uint32_t expectedStreamLen = GetOBJREFSize(WrapNotNull(mStream));
|
||||
nsAutoCString strActCtx;
|
||||
nsAutoString manifestPath;
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
|
||||
HRESULT unmarshalResult = S_OK;
|
||||
|
||||
|
@ -93,11 +83,11 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
// correctness with IPDL. We'll request an IUnknown and then QI the
|
||||
// actual interface later.
|
||||
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
auto marshalFn = [this, &strActCtx, &manifestPath, &unmarshalResult, &aIID, aEnv]() -> void
|
||||
#else
|
||||
auto marshalFn = [this, &unmarshalResult, &aIID, aEnv]() -> void
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
{
|
||||
if (aEnv) {
|
||||
bool pushOk = aEnv->Push();
|
||||
|
@ -116,7 +106,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
MOZ_DIAGNOSTIC_ASSERT(popOk);
|
||||
});
|
||||
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
auto curActCtx = ActivationContext::GetCurrent();
|
||||
if (curActCtx.isOk()) {
|
||||
strActCtx.AppendPrintf("0x%p", curActCtx.unwrap());
|
||||
|
@ -125,7 +115,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
}
|
||||
|
||||
ActivationContext::GetCurrentManifestPath(manifestPath);
|
||||
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
|
||||
unmarshalResult =
|
||||
::CoUnmarshalInterface(mStream, aIID, getter_AddRefs(mUnmarshaledProxy));
|
||||
|
@ -143,7 +133,6 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
|
||||
mStream = nullptr;
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (FAILED(unmarshalResult) || !mUnmarshaledProxy) {
|
||||
nsPrintfCString hrAsStr("0x%08X", unmarshalResult);
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
|
@ -176,7 +165,6 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
|||
actualStreamLen);
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
}
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
}
|
||||
|
||||
ProxyStream::ProxyStream(ProxyStream&& aOther)
|
||||
|
@ -308,17 +296,11 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
|||
HRESULT statResult = S_OK;
|
||||
HRESULT getHGlobalResult = S_OK;
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
nsAutoString manifestPath;
|
||||
|
||||
auto marshalFn = [this, &aIID, aObject, mshlFlags, &stream, &streamSize,
|
||||
&hglobal, &createStreamResult, &marshalResult, &statResult,
|
||||
&getHGlobalResult, aEnv, &manifestPath]() -> void
|
||||
#else
|
||||
auto marshalFn = [this, &aIID, aObject, mshlFlags, &stream, &streamSize,
|
||||
&hglobal, &createStreamResult, &marshalResult, &statResult,
|
||||
&getHGlobalResult, aEnv]() -> void
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
{
|
||||
if (aEnv) {
|
||||
bool pushOk = aEnv->Push();
|
||||
|
@ -343,9 +325,9 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
|
||||
#if defined(ACCESSIBILITY)
|
||||
ActivationContext::GetCurrentManifestPath(manifestPath);
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
#endif // defined(ACCESSIBILITY)
|
||||
|
||||
marshalResult = ::CoMarshalInterface(stream, aIID, aObject, MSHCTX_LOCAL,
|
||||
nullptr, mshlFlags);
|
||||
|
@ -375,7 +357,6 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
|||
EnsureMTA mta(marshalFn);
|
||||
}
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (FAILED(createStreamResult)) {
|
||||
nsPrintfCString hrAsStr("0x%08X", createStreamResult);
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
|
@ -405,15 +386,12 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
|||
NS_LITERAL_CSTRING("GetHGlobalFromStreamFailure"),
|
||||
hrAsStr);
|
||||
}
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
|
||||
mStream = mozilla::Move(stream);
|
||||
|
||||
if (streamSize) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
|
||||
NS_LITERAL_CSTRING("IStream::Stat"));
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
mBufSize = streamSize;
|
||||
}
|
||||
|
||||
|
@ -428,20 +406,16 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
|
|||
// the size of the memory block allocated by the HGLOBAL, though it might
|
||||
// be larger than the actual stream size.
|
||||
if (!streamSize) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
|
||||
NS_LITERAL_CSTRING("GlobalSize"));
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
mBufSize = static_cast<int>(::GlobalSize(hglobal));
|
||||
}
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
nsAutoCString strBufSize;
|
||||
strBufSize.AppendInt(mBufSize);
|
||||
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSize"),
|
||||
strBufSize);
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
}
|
||||
|
||||
} // namespace mscom
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
#ifndef mozilla_mscom_RegistrationAnnotator_h
|
||||
#define mozilla_mscom_RegistrationAnnotator_h
|
||||
|
||||
#if !defined(MOZ_CRASHREPORTER)
|
||||
#error "This header requires crash reporting to be enabled"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace mscom {
|
||||
|
||||
|
|
|
@ -32,12 +32,8 @@ UNIFIED_SOURCES += [
|
|||
'Objref.cpp',
|
||||
'PassthruProxy.cpp',
|
||||
'ProxyStream.cpp',
|
||||
'Utils.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_CRASHREPORTER']:
|
||||
UNIFIED_SOURCES += [
|
||||
'RegistrationAnnotator.cpp',
|
||||
'Utils.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['ACCESSIBILITY']:
|
||||
|
|
Загрузка…
Ссылка в новой задаче