Bug 1402519 - Remove MOZ_CRASHREPORTER directives from dom; r=peterv

MozReview-Commit-ID: 4G2C9y6csvc

--HG--
extra : rebase_source : 989a11eaed6641a17ab27ae10b7fea6277cec534
This commit is contained in:
Gabriele Svelto 2017-10-10 12:43:09 +02:00
Родитель af621335e5
Коммит 13bba6b3c4
16 изменённых файлов: 40 добавлений и 149 удалений

Просмотреть файл

@ -7936,7 +7936,7 @@ CheckCrossStyleBackendAdoption(nsIDocument* aOldDoc,
if (styleDataTypes.isEmpty()) {
return;
}
#ifdef MOZ_CRASHREPORTER
// We are adopting node with pre-existing style data across style
// backend. We want some more information to help diagnose when that
// can happen.
@ -8001,7 +8001,7 @@ CheckCrossStyleBackendAdoption(nsIDocument* aOldDoc,
}
note.Append('\n');
CrashReporter::AppendAppNotesToCrashReport(note);
#endif // MOZ_CRASHREPORTER
MOZ_CRASH("Must not adopt a node with pre-existing style data "
"into a document with different style backend");
}

Просмотреть файл

@ -214,6 +214,7 @@
#include "DomainPolicy.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "mozilla/widget/PuppetBidiKeyboard.h"
#include "mozilla/RemoteSpellCheckEngineChild.h"
@ -228,9 +229,6 @@
#ifdef MOZ_WIDGET_GTK
#include "nsAppRunner.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#endif
#ifdef MOZ_CODE_COVERAGE
#include "mozilla/CodeCoverageHandler.h"
@ -649,9 +647,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
}
#endif
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mID = aChildID;
mIsForBrowser = aIsForBrowser;
@ -1701,7 +1697,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
sandboxEnabled = StartMacOSContentSandbox();
#endif
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxEnabled"),
sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
@ -1714,7 +1709,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
#endif /* XP_LINUX && !OS_ANDROID */
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("RemoteType"),
NS_ConvertUTF16toUTF8(GetRemoteType()));
#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_CONTENT_SANDBOX */
return IPC_OK();
@ -2349,9 +2343,8 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
}
mIsAlive = false;
# ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
# endif
XRE_ShutdownChildProcess();
#endif // NS_FREE_PERMANENT_DATA
}
@ -2376,10 +2369,9 @@ ContentChild::ProcessingError(Result aCode, const char* aReason)
MOZ_CRASH("not reached");
}
#if defined(MOZ_CRASHREPORTER)
nsDependentCString reason(aReason);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ipc_channel_error"), reason);
#endif
MOZ_CRASH("Content child abort due to IPC error");
}
@ -2960,10 +2952,9 @@ ContentChild::RecvShutdown()
// to wait for that event loop to finish. Otherwise we could prematurely
// terminate an "unload" or "pagehide" event handler (which might be doing a
// sync XHR, for example).
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("RecvShutdown"));
#endif
MOZ_ASSERT(NS_IsMainThread());
RefPtr<nsThread> mainThread = nsThreadManager::get().GetCurrentThread();
// Note that we only have to check the recursion count for the current
@ -3019,18 +3010,13 @@ ContentChild::RecvShutdown()
// parent closes.
StartForceKillTimer();
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("SendFinishShutdown (sending)"));
bool sent = SendFinishShutdown();
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
sent ? NS_LITERAL_CSTRING("SendFinishShutdown (sent)")
: NS_LITERAL_CSTRING("SendFinishShutdown (failed)"));
#else
// Ignore errors here. If this fails, the parent will kill us after a
// timeout.
Unused << SendFinishShutdown();
#endif
return IPC_OK();
}

Просмотреть файл

@ -67,6 +67,7 @@
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/FileDescriptorUtils.h"
#include "mozilla/ipc/PChildToParentStreamParent.h"
#include "mozilla/ipc/TestShellParent.h"
@ -150,6 +151,7 @@
#include "nsIDOMChromeWindow.h"
#include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h"
#include "nsThread.h"
#include "nsWindowWatcher.h"
#include "nsIXULRuntime.h"
#include "mozilla/dom/nsMixedContentBlocker.h"
@ -248,11 +250,6 @@
#include "mozilla/widget/AudioSession.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsThread.h"
#include "mozilla/ipc/CrashReporterHost.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@ -273,9 +270,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
using base::KillProcess;
#ifdef MOZ_CRASHREPORTER
using namespace CrashReporter;
#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
using namespace mozilla::embedding;
@ -1730,7 +1725,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
#ifdef MOZ_CRASHREPORTER
// There's a window in which child processes can crash
// after IPC is established, but before a crash reporter
// is created.
@ -1747,7 +1741,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
}
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
}
#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@ -3060,7 +3053,6 @@ ContentParent::KillHard(const char* aReason)
mCalledKillHard = true;
mForceKillTimer = nullptr;
#if defined(MOZ_CRASHREPORTER)
// We're about to kill the child process associated with this content.
// Something has gone wrong to get us here, so we generate a minidump
// of the parent and child for submission to the crash server.
@ -3093,19 +3085,17 @@ ContentParent::KillHard(const char* aReason)
true);
return;
}
#endif
OnGenerateMinidumpComplete(false);
}
void
ContentParent::OnGenerateMinidumpComplete(bool aDumpResult)
{
#if defined(MOZ_CRASHREPORTER)
if (mCrashReporter && aDumpResult) {
// CrashReporterHost::GenerateMinidumpAndPair() is successful.
mCreatedPairedMinidumps = mCrashReporter->FinalizeCrashReport();
}
#endif
Unused << aDumpResult; // Don't care about result if no minidump was requested.
@ -3146,12 +3136,11 @@ ContentParent::FriendlyName(nsAString& aName, bool aAnonymize)
mozilla::ipc::IPCResult
ContentParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<CrashReporterHost>(
GeckoProcessType_Content,
aShmem,
aThreadId);
#endif
return IPC_OK();
}
@ -4947,9 +4936,7 @@ ContentParent::RecvNotifyLowMemory()
Telemetry::ScalarAdd(Telemetry::ScalarID::DOM_CONTENTPROCESS_TROUBLED_DUE_TO_MEMORY, 1);
#ifdef MOZ_CRASHREPORTER
nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport);
#endif
return IPC_OK();
}

Просмотреть файл

@ -1283,9 +1283,8 @@ private:
nsTHashtable<nsCStringHashKey> mActivePermissionKeys;
nsTArray<nsCString> mBlobURLs;
#ifdef MOZ_CRASHREPORTER
UniquePtr<mozilla::ipc::CrashReporterHost> mCrashReporter;
#endif
static uint64_t sNextTabParentId;
static nsDataHashtable<nsUint64HashKey, TabParent*> sNextTabParents;

Просмотреть файл

@ -23,14 +23,12 @@
#include "mozilla/Unused.h"
#include "mozilla/WeakPtr.h"
#include "nsExceptionHandler.h"
#include "nsIFrameLoader.h"
#include "nsIHangReport.h"
#include "nsITabParent.h"
#include "nsPluginHost.h"
#include "nsThreadUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "base/task.h"
#include "base/thread.h"
@ -610,7 +608,6 @@ HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
HangMonitorParent::~HangMonitorParent()
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) {
@ -619,7 +616,6 @@ HangMonitorParent::~HangMonitorParent()
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
}
#endif
}
void
@ -772,7 +768,6 @@ bool
HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
nsString& aCrashId)
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
if (!mBrowserCrashDumpIds.Get(aPhd.pluginId(), &aCrashId)) {
nsCOMPtr<nsIFile> browserDump;
@ -788,7 +783,6 @@ HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
}
}
}
#endif // MOZ_CRASHREPORTER
return false;
}
@ -891,11 +885,10 @@ HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles)
return;
}
mBrowserCrashDumpIds.Remove(aPluginId);
#ifdef MOZ_CRASHREPORTER
if (aRemoveFiles && !crashId.IsEmpty()) {
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
#endif
}
void

Просмотреть файл

@ -59,9 +59,7 @@
#include "nsEmbedCID.h"
#include "nsGlobalWindow.h"
#include <algorithm>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsFilePickerProxy.h"
#include "mozilla/dom/Element.h"
#include "nsGlobalWindow.h"
@ -1194,9 +1192,7 @@ TabChild::RecvLoadURL(const nsCString& aURI,
NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?");
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI);
#endif
return IPC_OK();
}

Просмотреть файл

@ -8,14 +8,11 @@
#define TABMESSAGE_UTILS_H
#include "ipc/IPCMessageUtils.h"
#include "nsExceptionHandler.h"
#include "nsIDOMEvent.h"
#include "nsPIDOMWindow.h"
#include "nsCOMPtr.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace dom {
struct RemoteDOMEvent
@ -27,12 +24,7 @@ struct RemoteDOMEvent
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
mozilla::dom::RemoteDOMEvent* aResult);
#ifdef MOZ_CRASHREPORTER
typedef CrashReporter::ThreadId NativeThreadId;
#else
// unused in this case
typedef int32_t NativeThreadId;
#endif
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -246,9 +246,7 @@ GMPChild::Init(const nsAString& aPluginPath,
return false;
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mPluginPath = aPluginPath;
@ -617,9 +615,8 @@ GMPChild::ActorDestroy(ActorDestroyReason aWhy)
ProcessChild::QuickExit();
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

Просмотреть файл

@ -7,11 +7,13 @@
#include "mozilla/Logging.h"
#include "nsComponentManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsPrintfCString.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsIWritablePropertyBag2.h"
#include "mozIGeckoMediaPluginService.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/SSE.h"
#include "mozilla/SyncRunnable.h"
@ -28,12 +30,8 @@
using mozilla::ipc::GeckoChildProcessHost;
#ifdef MOZ_CRASHREPORTER
#include "nsPrintfCString.h"
#include "mozilla/ipc/CrashReporterHost.h"
using CrashReporter::AnnotationTable;
using CrashReporter::GetIDFromMinidump;
#endif
#include "mozilla/Telemetry.h"
@ -452,7 +450,6 @@ GMPParent::EnsureProcessLoaded()
return NS_SUCCEEDED(rv);
}
#ifdef MOZ_CRASHREPORTER
void
GMPParent::WriteExtraDataForMinidump()
{
@ -497,12 +494,12 @@ GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, cons
service->RunPluginCrashCallbacks(aPluginID, aPluginName);
}
}
#endif
void
GMPParent::ActorDestroy(ActorDestroyReason aWhy)
{
LOGD("%s: (%d)", __FUNCTION__, (int)aWhy);
#ifdef MOZ_CRASHREPORTER
if (AbnormalShutdown == aWhy) {
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("gmplugin"), 1);
@ -519,7 +516,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
&GMPNotifyObservers, mPluginId, mDisplayName, dumpID);
mMainThread->Dispatch(r.forget());
}
#endif
// warn us off trying to close again
mState = GMPStateClosing;
mAbnormalShutdownInProgress = true;
@ -540,12 +537,11 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
mozilla::ipc::IPCResult
GMPParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GMPlugin,
aShmem,
aThreadId);
#endif
return IPC_OK();
}

Просмотреть файл

@ -153,10 +153,8 @@ private:
RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
RefPtr<GenericPromise> ParseChromiumManifest(const nsAString& aJSON); // Main thread.
RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
#ifdef MOZ_CRASHREPORTER
void WriteExtraDataForMinidump();
bool GetCrashID(nsString& aResult);
#endif
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem, const NativeThreadId& aThreadId) override;
@ -217,9 +215,7 @@ private:
// to terminate gracefully.
bool mHoldingSelfRef;
#ifdef MOZ_CRASHREPORTER
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif
const RefPtr<AbstractThread> mMainThread;
};

Просмотреть файл

@ -11,6 +11,7 @@
#include <cstdlib>
#include <stdio.h>
#include "prio.h"
#include "nsExceptionHandler.h"
#include "nsNPAPIPlugin.h"
#include "nsNPAPIPluginStreamListener.h"
#include "nsNPAPIPluginInstance.h"
@ -103,10 +104,6 @@
#include "winbase.h"
#endif
#if MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "npapi.h"
using namespace mozilla;

Просмотреть файл

@ -26,9 +26,7 @@
#include "mozilla/UniquePtr.h"
#include "nsCocoaFeatures.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include <string.h>
#include <stdio.h>
@ -424,14 +422,13 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
NS_WARNING(msg.get());
return NS_ERROR_FAILURE;
}
#if defined(MOZ_CRASHREPORTER)
// The block above assumes that "fbplugin" is the filename of the plugin
// to be blocked, or that the filename starts with "fbplugin_". But we
// don't yet know for sure if this is always true. So for the time being
// record extra information in our crash logs.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
fileName);
#endif
}
// It's possible that our plugin has 2 entry points that'll give us mime type
@ -441,14 +438,14 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
// Sadly we have to load the library for this to work.
rv = LoadPlugin(outLibrary);
#if defined(MOZ_CRASHREPORTER)
if (nsCocoaFeatures::OnYosemiteOrLater()) {
// If we didn't crash in LoadPlugin(), change the previous annotation so we
// don't sow confusion.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
NS_LITERAL_CSTRING("Didn't crash, please ignore"));
}
#endif
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -22,10 +22,9 @@
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/Logging.h"
#include "nsExceptionHandler.h"
#include "nsHashKeys.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#ifdef XP_MACOSX
#include "PluginInterposeOSX.h"
#else

Просмотреть файл

@ -27,6 +27,8 @@
# include "nsX11ErrorHandler.h"
# include "mozilla/X11Util.h"
#endif
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/plugins/PluginInstanceChild.h"
#include "mozilla/plugins/StreamNotifyChild.h"
@ -48,10 +50,6 @@
#include "PluginUtilsOSX.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#endif
#ifdef MOZ_GECKO_PROFILER
#include "ChildProfilerController.h"
#endif
@ -750,10 +748,9 @@ PluginModuleChild::RecvInitPluginModuleChild(Endpoint<PPluginModuleChild>&& aEnd
mozilla::ipc::IPCResult
PluginModuleChild::AnswerInitCrashReporter(Shmem&& aShmem, mozilla::dom::NativeThreadId* aOutId)
{
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingletonWithShmem(aShmem);
*aOutId = CrashReporter::CurrentThreadId();
#endif
return IPC_OK();
}
@ -792,9 +789,8 @@ PluginModuleChild::ActorDestroy(ActorDestroyReason why)
// doesn't matter why we're being destroyed; it's up to us to
// initiate (clean) shutdown
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

Просмотреть файл

@ -10,6 +10,8 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
@ -65,12 +67,7 @@ using namespace mozilla;
using namespace mozilla::plugins;
using namespace mozilla::plugins::parent;
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/CrashReporterHost.h"
using namespace CrashReporter;
#endif
static const char kContentTimeoutPref[] = "dom.ipc.plugins.contentTimeoutSecs";
static const char kChildTimeoutPref[] = "dom.ipc.plugins.timeoutSecs";
@ -525,7 +522,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
RegisterSettingsCallbacks();
#ifdef MOZ_CRASHREPORTER
// If this fails, we're having IPC troubles, and we're doomed anyways.
if (!InitCrashReporter()) {
mShutdown = true;
@ -533,7 +529,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
OnInitFailure();
return;
}
#endif
#if defined(XP_WIN) && defined(_X86_)
// Protected mode only applies to Windows and only to x86.
@ -552,7 +547,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
bool
PluginModuleChromeParent::InitCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
ipc::Shmem shmem;
if (!ipc::CrashReporterClient::AllocShmem(this, &shmem)) {
return false;
@ -570,7 +564,6 @@ PluginModuleChromeParent::InitCrashReporter()
shmem,
threadId);
}
#endif
return true;
}
@ -588,9 +581,7 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
, mTaskFactory(this)
, mSandboxLevel(0)
, mIsFlashPlugin(false)
#ifdef MOZ_CRASHREPORTER
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
#endif
{
}
@ -702,7 +693,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
mozilla::HangMonitor::UnregisterAnnotator(*this);
}
#ifdef MOZ_CRASHREPORTER
void
PluginModuleChromeParent::WriteExtraDataForMinidump()
{
@ -744,7 +734,6 @@ PluginModuleChromeParent::WriteExtraDataForMinidump()
#endif
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
@ -1000,7 +989,6 @@ PluginModuleChromeParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aA
}
}
#ifdef MOZ_CRASHREPORTER
static bool
CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
nsIFile* parentMinidump, const nsACString& name)
@ -1012,7 +1000,6 @@ CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
}
return CreateAdditionalChildMinidump(handle, 0, parentMinidump, name);
}
#endif
bool
PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
@ -1067,7 +1054,6 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
std::function<void(nsString)>&& aCallback,
bool aAsync)
{
#ifdef MOZ_CRASHREPORTER
mozilla::MutexAutoLock lock(mCrashReporterMutex);
if (!mCrashReporter || !mTakeFullMinidumpCallback.IsEmpty()) {
@ -1111,12 +1097,8 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
} else {
TakeBrowserAndPluginMinidumps(false, aContentPid, browserDumpId, aAsync);
}
#else // MOZ_CRASHREPORTER
aCallback(NS_LITERAL_STRING(""));
#endif
}
#ifdef MOZ_CRASHREPORTER
void
PluginModuleChromeParent::RetainPluginRef()
{
@ -1235,8 +1217,6 @@ PluginModuleChromeParent::OnTakeFullMinidumpComplete(bool aReportsReady,
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
base::ProcessId aContentPid,
@ -1251,7 +1231,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
}
mTerminateChildProcessCallback.Init(Move(aCallback), aAsync);
#ifdef MOZ_CRASHREPORTER
// Start by taking a full minidump if necessary, this is done early
// because it also needs to lock the mCrashReporterMutex and Mutex doesn't
// support recursive locking.
@ -1276,17 +1255,12 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
} else {
TerminateChildProcessOnDumpComplete(aMsgLoop, aMonitorDescription);
}
#else
TerminateChildProcessOnDumpComplete(aMsgLoop, aMonitorDescription);
#endif
}
void
PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
const nsCString& aMonitorDescription)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporterMutex.AssertCurrentThreadOwns();
if (!mCrashReporter) {
@ -1310,7 +1284,6 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
}
}
#endif // XP_WIN
#endif // MOZ_CRASHREPORTER
mozilla::ipc::ScopedProcessHandle geckoChildProcess;
bool childOpened = base::OpenProcessHandle(OtherPid(),
@ -1341,7 +1314,7 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
if (!GetProcessCpuUsage(processHandles, mPluginCpuUsageOnHang)) {
mPluginCpuUsageOnHang.Clear();
}
#endif // MOZ_CRASHREPORTER
#endif
// this must run before the error notification from the channel,
// or not at all
@ -1486,7 +1459,6 @@ PluginModuleChromeParent::OnHangUIContinue()
}
#endif // XP_WIN
#ifdef MOZ_CRASHREPORTER
#ifdef MOZ_CRASHREPORTER_INJECTOR
static void
RemoveMinidump(nsIFile* minidump)
@ -1578,7 +1550,6 @@ PluginModuleChromeParent::ProcessFirstMinidump()
}
mCrashReporter->FinalizeCrashReport();
}
#endif
void
PluginModuleParent::ActorDestroy(ActorDestroyReason why)
@ -1617,9 +1588,7 @@ void
PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why)
{
if (why == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
ProcessFirstMinidump();
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("plugin"), 1);
}
@ -1656,11 +1625,11 @@ PluginModuleParent::NotifyPluginCrashed()
nsString dumpID;
nsString browserDumpID;
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter && mCrashReporter->HasMinidump()) {
dumpID = mCrashReporter->MinidumpID();
}
#endif
mPlugin->PluginCrashed(dumpID, browserDumpID);
}

Просмотреть файл

@ -21,6 +21,7 @@
#include "mozilla/Unused.h"
#include "npapi.h"
#include "npfunctions.h"
#include "nsExceptionHandler.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIObserver.h"
@ -31,10 +32,6 @@
#endif
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
class nsPluginTag;
namespace mozilla {
@ -334,7 +331,6 @@ protected:
RefPtr<layers::TextureClientRecycleAllocator> mTextureAllocatorForDirectBitmap;
RefPtr<layers::TextureClientRecycleAllocator> mTextureAllocatorForDXGISurface;
#ifdef MOZ_CRASHREPORTER
/**
* This mutex protects the crash reporter when the Plugin Hang UI event
* handler is executing off main thread. It is intended to protect both
@ -343,7 +339,6 @@ protected:
*/
mozilla::Mutex mCrashReporterMutex;
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif // MOZ_CRASHREPORTER
};
class PluginModuleContentParent : public PluginModuleParent
@ -458,7 +453,6 @@ class PluginModuleChromeParent
}
private:
#ifdef MOZ_CRASHREPORTER
// The following methods are callbacks invoked after calling
// TakeFullMinidump(). The methods are invoked in the following order:
void TakeBrowserAndPluginMinidumps(bool aReportsReady,
@ -469,7 +463,7 @@ class PluginModuleChromeParent
base::ProcessId aContentPid,
const nsAString& aBrowserDumpId);
#endif
// The following method is the callback invoked after calling
// TerminateChidlProcess().
void TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
@ -518,12 +512,10 @@ private:
virtual bool ShouldContinueFromReplyTimeout() override;
#ifdef MOZ_CRASHREPORTER
void ProcessFirstMinidump();
void WriteExtraDataForMinidump();
void RetainPluginRef();
void ReleasePluginRef();
#endif
PluginProcessParent* Process() const { return mSubprocess; }
base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); }
@ -641,10 +633,9 @@ private:
mozilla::SandboxPermissions mSandboxPermissions;
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsIFile> mBrowserDumpFile;
TakeFullMinidumpCallback mTakeFullMinidumpCallback;
#endif
TerminateChildProcessCallback mTerminateChildProcessCallback;
};