Backed out 16 changesets (bug 1402519) for conflicts during merge r=backout on a CLOSED TREE

Backed out changeset 07fcf163241a (bug 1402519)
Backed out changeset c6d2ad45d8e2 (bug 1402519)
Backed out changeset 8a3caca61294 (bug 1402519)
Backed out changeset 01425eae2c48 (bug 1402519)
Backed out changeset cf298d3815de (bug 1402519)
Backed out changeset e1964f4389cd (bug 1402519)
Backed out changeset f405337f3569 (bug 1402519)
Backed out changeset a76356fd3359 (bug 1402519)
Backed out changeset d3bb350d1c34 (bug 1402519)
Backed out changeset 9d3bfd9f932c (bug 1402519)
Backed out changeset e3dd6e5b073f (bug 1402519)
Backed out changeset e801b0c00134 (bug 1402519)
Backed out changeset 8a4139fa5dca (bug 1402519)
Backed out changeset 8d01c14ac1ca (bug 1402519)
Backed out changeset 24e0dcd01898 (bug 1402519)
Backed out changeset f8fdf450613f (bug 1402519)
This commit is contained in:
shindli 2017-11-23 00:11:44 +02:00
Родитель d426efd011
Коммит fb855aa7ba
110 изменённых файлов: 934 добавлений и 852 удалений

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

@ -53,7 +53,10 @@
#include "Logging.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsImageFrame.h"
#include "nsINamed.h"
#include "nsIObserverService.h"
@ -1366,9 +1369,11 @@ nsAccessibilityService::Init()
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
gApplicationAccessible->Init();
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
NS_LITERAL_CSTRING("Active"));
#endif
#ifdef XP_WIN
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;

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

@ -7,8 +7,10 @@
#include "Compatibility.h"
#include "mozilla/WindowsVersion.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif // defined(MOZ_CRASHREPORTER)
#include "nsUnicharUtils.h"
#include "nsWindowsDllInterceptor.h"
#include "nsWinUtils.h"
@ -217,9 +219,11 @@ Compatibility::Init()
// Note we collect some AT statistics/telemetry here for convenience.
InitConsumers();
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityInProcClient"),
nsPrintfCString("0x%X", sConsumers));
#endif
// Gather telemetry
uint32_t temp = sConsumers;
@ -407,11 +411,13 @@ UseIAccessibleProxyStub()
return true;
}
#if defined(MOZ_CRASHREPORTER)
// If we reach this point then something is seriously wrong with the
// IAccessible configuration in the computer's registry. Let's annotate this
// so that we can easily determine this condition during crash analysis.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IAccessibleConfig"),
NS_LITERAL_CSTRING("NoSystemTypeLibOrPS"));
#endif // defined(MOZ_CRASHREPORTER)
return false;
}

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

@ -17,7 +17,6 @@
#include "nsAccessibilityService.h"
#include "nsWindowsHelpers.h"
#include "nsCOMPtr.h"
#include "nsExceptionHandler.h"
#include "nsIFile.h"
#include "nsXPCOM.h"
#include "RootAccessibleWrap.h"
@ -27,6 +26,10 @@
#include "mozilla/Telemetry.h"
#endif // defined(MOZ_TELEMETRY_REPORTING)
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include <oaidl.h>
#if !defined(STATE_SYSTEM_NORMAL)
@ -302,7 +305,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
a11y::SetInstantiator(filePath);
}
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
if (!mTelemetryThread) {
// Call GatherTelemetry on a background thread because it does I/O on
// the executable file to retrieve version information.
@ -315,12 +318,12 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
new AccumulateRunnable(this)));
NS_NewThread(getter_AddRefs(mTelemetryThread), runnable);
}
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
return true;
}
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
/**
* Appends version information in the format "|a.b.c.d".
* If there is no version information, we append nothing.
@ -403,9 +406,11 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
Telemetry::ScalarSet(Telemetry::ScalarID::A11Y_INSTANTIATORS,
aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_CRASHREPORTER)
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityClient"),
NS_ConvertUTF16toUTF8(aValue));
#endif // defined(MOZ_CRASHREPORTER)
}
if (mTelemetryThread) {
@ -413,7 +418,7 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
mTelemetryThread = nullptr;
}
}
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
RootAccessibleWrap*
LazyInstantiator::ResolveRootAccWrap()

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

@ -87,7 +87,7 @@ private:
bool ShouldInstantiate(const DWORD aClientTid);
bool GetClientExecutableName(const DWORD aClientTid, nsIFile** aOutClientExe);
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
class AccumulateRunnable final : public Runnable
{
public:
@ -120,7 +120,7 @@ private:
void AppendVersionInfo(nsIFile* aClientExe, nsAString& aStrToAppend);
void GatherTelemetry(nsIFile* aClientExe, AccumulateRunnable* aRunnable);
void AccumulateTelemetry(const nsString& aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
/**
* @return S_OK if we have a valid mRealRoot to invoke methods on
@ -152,9 +152,9 @@ private:
RootAccessibleWrap* mWeakRootAccWrap;
IAccessible* mWeakAccessible;
IDispatch* mWeakDispatch;
#if defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
nsCOMPtr<nsIThread> mTelemetryThread;
#endif // defined(MOZ_TELEMETRY_REPORTING)
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
};
} // namespace a11y

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

@ -86,9 +86,8 @@ add_task(async function navigate() {
});
add_task(async function crash() {
if (!gMultiProcessBrowser || !AppConstants.MOZ_CRASHREPORTER) {
if (!gMultiProcessBrowser || !("nsICrashReporter" in Ci))
return;
}
let tab = BrowserTestUtils.addTab(gBrowser, DUMMY);
let browser = tab.linkedBrowser;

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

@ -2424,10 +2424,12 @@ nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
NS_IMETHODIMP
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
{
#ifdef MOZ_CRASHREPORTER
if (aUseRemoteTabs) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"),
NS_LITERAL_CSTRING("1"));
}
#endif
mUseRemoteTabs = aUseRemoteTabs;
return NS_OK;

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

@ -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,7 +214,6 @@
#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"
@ -229,6 +228,9 @@
#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"
@ -647,7 +649,9 @@ ContentChild::Init(MessageLoop* aIOLoop,
}
#endif
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mID = aChildID;
mIsForBrowser = aIsForBrowser;
@ -1697,6 +1701,7 @@ 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"));
@ -1709,6 +1714,7 @@ 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();
@ -2343,8 +2349,9 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
}
mIsAlive = false;
# ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
# endif
XRE_ShutdownChildProcess();
#endif // NS_FREE_PERMANENT_DATA
}
@ -2369,9 +2376,10 @@ 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");
}
@ -2952,9 +2960,10 @@ 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
@ -3010,13 +3019,18 @@ 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,7 +67,6 @@
#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"
@ -151,7 +150,6 @@
#include "nsIDOMChromeWindow.h"
#include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h"
#include "nsThread.h"
#include "nsWindowWatcher.h"
#include "nsIXULRuntime.h"
#include "mozilla/dom/nsMixedContentBlocker.h"
@ -250,6 +248,11 @@
#include "mozilla/widget/AudioSession.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsThread.h"
#include "mozilla/ipc/CrashReporterHost.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@ -270,7 +273,9 @@ 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;
@ -1725,6 +1730,7 @@ 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.
@ -1741,6 +1747,7 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
}
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
}
#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@ -3053,6 +3060,7 @@ 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.
@ -3085,17 +3093,19 @@ 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.
@ -3136,11 +3146,12 @@ 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();
}
@ -4936,7 +4947,9 @@ 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,8 +1283,9 @@ 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,12 +23,14 @@
#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"
@ -608,6 +610,7 @@ HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
HangMonitorParent::~HangMonitorParent()
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) {
@ -616,6 +619,7 @@ HangMonitorParent::~HangMonitorParent()
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
}
#endif
}
void
@ -768,6 +772,7 @@ bool
HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
nsString& aCrashId)
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
if (!mBrowserCrashDumpIds.Get(aPhd.pluginId(), &aCrashId)) {
nsCOMPtr<nsIFile> browserDump;
@ -783,6 +788,7 @@ HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
}
}
}
#endif // MOZ_CRASHREPORTER
return false;
}
@ -885,10 +891,11 @@ HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles)
return;
}
mBrowserCrashDumpIds.Remove(aPluginId);
#ifdef MOZ_CRASHREPORTER
if (aRemoveFiles && !crashId.IsEmpty()) {
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
#endif
}
void

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

@ -59,7 +59,9 @@
#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"
@ -1192,7 +1194,9 @@ 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,11 +8,14 @@
#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
@ -24,7 +27,12 @@ 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,7 +246,9 @@ GMPChild::Init(const nsAString& aPluginPath,
return false;
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mPluginPath = aPluginPath;
@ -615,8 +617,9 @@ GMPChild::ActorDestroy(ActorDestroyReason aWhy)
ProcessChild::QuickExit();
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

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

@ -7,13 +7,11 @@
#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"
@ -30,8 +28,12 @@
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"
@ -450,6 +452,7 @@ GMPParent::EnsureProcessLoaded()
return NS_SUCCEEDED(rv);
}
#ifdef MOZ_CRASHREPORTER
void
GMPParent::WriteExtraDataForMinidump()
{
@ -494,12 +497,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);
@ -516,7 +519,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;
@ -537,11 +540,12 @@ 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,8 +153,10 @@ 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;
@ -215,7 +217,9 @@ private:
// to terminate gracefully.
bool mHoldingSelfRef;
#ifdef MOZ_CRASHREPORTER
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif
const RefPtr<AbstractThread> mMainThread;
};

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

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

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

@ -26,7 +26,9 @@
#include "mozilla/UniquePtr.h"
#include "nsCocoaFeatures.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include <string.h>
#include <stdio.h>
@ -422,13 +424,14 @@ 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
@ -438,14 +441,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,9 +22,10 @@
#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,8 +27,6 @@
# 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"
@ -50,6 +48,10 @@
#include "PluginUtilsOSX.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#endif
#ifdef MOZ_GECKO_PROFILER
#include "ChildProfilerController.h"
#endif
@ -748,9 +750,10 @@ 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();
}
@ -789,8 +792,9 @@ 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,8 +10,6 @@
#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"
@ -67,7 +65,12 @@ 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";
@ -522,6 +525,7 @@ 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;
@ -529,6 +533,7 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
OnInitFailure();
return;
}
#endif
#if defined(XP_WIN) && defined(_X86_)
// Protected mode only applies to Windows and only to x86.
@ -547,6 +552,7 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
bool
PluginModuleChromeParent::InitCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
ipc::Shmem shmem;
if (!ipc::CrashReporterClient::AllocShmem(this, &shmem)) {
return false;
@ -564,6 +570,7 @@ PluginModuleChromeParent::InitCrashReporter()
shmem,
threadId);
}
#endif
return true;
}
@ -581,7 +588,9 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
, mTaskFactory(this)
, mSandboxLevel(0)
, mIsFlashPlugin(false)
#ifdef MOZ_CRASHREPORTER
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
#endif
{
}
@ -693,6 +702,7 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
mozilla::HangMonitor::UnregisterAnnotator(*this);
}
#ifdef MOZ_CRASHREPORTER
void
PluginModuleChromeParent::WriteExtraDataForMinidump()
{
@ -734,6 +744,7 @@ PluginModuleChromeParent::WriteExtraDataForMinidump()
#endif
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
@ -989,6 +1000,7 @@ PluginModuleChromeParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aA
}
}
#ifdef MOZ_CRASHREPORTER
static bool
CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
nsIFile* parentMinidump, const nsACString& name)
@ -1000,6 +1012,7 @@ CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
}
return CreateAdditionalChildMinidump(handle, 0, parentMinidump, name);
}
#endif
bool
PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
@ -1054,6 +1067,7 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
std::function<void(nsString)>&& aCallback,
bool aAsync)
{
#ifdef MOZ_CRASHREPORTER
mozilla::MutexAutoLock lock(mCrashReporterMutex);
if (!mCrashReporter || !mTakeFullMinidumpCallback.IsEmpty()) {
@ -1097,8 +1111,12 @@ 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()
{
@ -1217,6 +1235,8 @@ PluginModuleChromeParent::OnTakeFullMinidumpComplete(bool aReportsReady,
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
base::ProcessId aContentPid,
@ -1231,6 +1251,7 @@ 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.
@ -1255,12 +1276,17 @@ 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) {
@ -1284,6 +1310,7 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
}
}
#endif // XP_WIN
#endif // MOZ_CRASHREPORTER
mozilla::ipc::ScopedProcessHandle geckoChildProcess;
bool childOpened = base::OpenProcessHandle(OtherPid(),
@ -1314,7 +1341,7 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
if (!GetProcessCpuUsage(processHandles, mPluginCpuUsageOnHang)) {
mPluginCpuUsageOnHang.Clear();
}
#endif
#endif // MOZ_CRASHREPORTER
// this must run before the error notification from the channel,
// or not at all
@ -1459,6 +1486,7 @@ PluginModuleChromeParent::OnHangUIContinue()
}
#endif // XP_WIN
#ifdef MOZ_CRASHREPORTER
#ifdef MOZ_CRASHREPORTER_INJECTOR
static void
RemoveMinidump(nsIFile* minidump)
@ -1550,6 +1578,7 @@ PluginModuleChromeParent::ProcessFirstMinidump()
}
mCrashReporter->FinalizeCrashReport();
}
#endif
void
PluginModuleParent::ActorDestroy(ActorDestroyReason why)
@ -1588,7 +1617,9 @@ void
PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why)
{
if (why == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
ProcessFirstMinidump();
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("plugin"), 1);
}
@ -1625,11 +1656,11 @@ PluginModuleParent::NotifyPluginCrashed()
nsString dumpID;
nsString browserDumpID;
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter && mCrashReporter->HasMinidump()) {
dumpID = mCrashReporter->MinidumpID();
}
#endif
mPlugin->PluginCrashed(dumpID, browserDumpID);
}

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

@ -21,7 +21,6 @@
#include "mozilla/Unused.h"
#include "npapi.h"
#include "npfunctions.h"
#include "nsExceptionHandler.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIObserver.h"
@ -32,6 +31,10 @@
#endif
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
class nsPluginTag;
namespace mozilla {
@ -331,6 +334,7 @@ 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
@ -339,6 +343,7 @@ protected:
*/
mozilla::Mutex mCrashReporterMutex;
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif // MOZ_CRASHREPORTER
};
class PluginModuleContentParent : public PluginModuleParent
@ -453,6 +458,7 @@ 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,
@ -463,7 +469,7 @@ class PluginModuleChromeParent
base::ProcessId aContentPid,
const nsAString& aBrowserDumpId);
#endif
// The following method is the callback invoked after calling
// TerminateChidlProcess().
void TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
@ -512,10 +518,12 @@ 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(); }
@ -633,9 +641,10 @@ private:
mozilla::SandboxPermissions mSandboxPermissions;
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsIFile> mBrowserDumpFile;
TakeFullMinidumpCallback mTakeFullMinidumpCallback;
#endif
TerminateChildProcessCallback mTerminateChildProcessCallback;
};

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

@ -6,10 +6,13 @@
#include <string>
#include <sstream>
#include "nsExceptionHandler.h"
#include "GfxTexturesReporter.h"
#include "gfxPrefs.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
using namespace mozilla::gl;
@ -73,5 +76,7 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
}
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateTexturesSize(sAmount);
#endif
}

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

@ -144,11 +144,12 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
mozilla::ipc::IPCResult
GPUChild::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GPU,
aShmem,
aThreadId);
#endif
return IPC_OK();
}
@ -251,10 +252,12 @@ void
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter) {
mCrashReporter->GenerateCrashReport(OtherPid());
mCrashReporter = nullptr;
}
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU)), 1);

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

@ -100,8 +100,10 @@ GPUParent::Init(base::ProcessId aParentPid,
// versions.
GetIPCChannel()->SendBuildID();
#ifdef MOZ_CRASHREPORTER
// Init crash reporter support.
CrashReporterClient::InitSingleton(this);
#endif
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
@ -469,7 +471,9 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

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

@ -39,9 +39,12 @@
#include "mozilla/dom/VideoDecoderManagerChild.h"
#include "mozilla/dom/VideoDecoderManagerParent.h"
#include "MediaPrefs.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#if defined(MOZ_WIDGET_ANDROID)
#include "mozilla/widget/AndroidUiThread.h"
#include "mozilla/layers/UiCompositorControllerChild.h"
@ -365,6 +368,7 @@ GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost)
mVsyncBridge = VsyncBridgeChild::Create(mVsyncIOThread, mProcessToken, Move(vsyncChild));
mGPUChild->SendInitVsyncBridge(Move(vsyncParent));
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Running"));
@ -372,6 +376,7 @@ GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessLaunchCount"),
nsPrintfCString("%d", mNumProcessAttempts));
#endif
}
static bool
@ -712,9 +717,11 @@ GPUProcessManager::DestroyProcess()
mVsyncBridge = nullptr;
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Destroyed"));
#endif
}
already_AddRefed<CompositorSession>

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

@ -9,7 +9,9 @@
#include "gfxConfig.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
@ -165,9 +167,11 @@ DriverCrashGuard::~DriverCrashGuard()
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
#ifdef MOZ_CRASHREPORTER
// Remove the crash report annotation.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING(""));
#endif
}
bool
@ -206,6 +210,7 @@ DriverCrashGuard::ActivateGuard()
{
mGuardActivated = true;
#ifdef MOZ_CRASHREPORTER
// Anotate crash reports only if we're a real guard. Otherwise, we could
// attribute a random parent process crash to a graphics problem in a child
// process.
@ -213,6 +218,7 @@ DriverCrashGuard::ActivateGuard()
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING("1"));
}
#endif
// If we're in the content process, the rest of the guarding is handled
// in the parent.

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

@ -5,6 +5,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxCrashReporterUtils.h"
#if defined(MOZ_CRASHREPORTER)
#define MOZ_GFXFEATUREREPORTER 1
#endif
#ifdef MOZ_GFXFEATUREREPORTER
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/Services.h" // for GetObserverService
@ -130,3 +137,13 @@ ScopedGfxFeatureReporter::AppNote(const nsACString& aMessage)
}
} // end namespace mozilla
#else
namespace mozilla {
void ScopedGfxFeatureReporter::WriteAppNote(char) {}
void ScopedGfxFeatureReporter::AppNote(const nsACString&) {}
} // namespace mozilla
#endif

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

@ -81,6 +81,7 @@ TEST(GfxPrefs, Set) {
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
}
#ifdef MOZ_CRASHREPORTER
// Randomly test the function we use in nsExceptionHandler.cpp here:
extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
TEST(GfxPrefs, StringUtility)
@ -103,3 +104,4 @@ TEST(GfxPrefs, StringUtility)
// It won't fit into 32:
ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2));
}
#endif

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

@ -21,13 +21,16 @@
#include "mozilla/layers/DeviceAttachmentsD3D11.h"
#include "mozilla/layers/MLGDeviceD3D11.h"
#include "mozilla/layers/PaintThread.h"
#include "nsExceptionHandler.h"
#include "nsIGfxInfo.h"
#include "nsPrintfCString.h"
#include "nsString.h"
#include <d3d11.h>
#include <ddraw.h>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif
namespace mozilla {
namespace gfx {
@ -769,10 +772,12 @@ DeviceManagerDx::MaybeResetAndReacquireDevices()
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
}
#ifdef MOZ_CRASHREPORTER
nsPrintfCString reasonString("%d", int(resetReason));
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("DeviceResetReason"),
reasonString);
#endif
bool createCompositorDevice = !!mCompositorDevice;
bool createContentDevice = !!mContentDevice;

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

@ -70,7 +70,6 @@
#include "gfxGradientCache.h"
#include "gfxUtils.h" // for NextPowerOfTwo
#include "nsExceptionHandler.h"
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
@ -78,6 +77,9 @@
#include "nsIScreenManager.h"
#include "FrameMetrics.h"
#include "MainThreadUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsWeakReference.h"
@ -296,9 +298,12 @@ void CrashStatsLogForwarder::UpdateCrashReport()
message << logAnnotation << Get<0>(it) << "]" << Get<1>(it) << " (t=" << Get<2>(it) << ") ";
}
#ifdef MOZ_CRASHREPORTER
nsCString reportString(message.str().c_str());
nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
#else
nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
#endif
if (annotated != NS_OK) {
printf("Crash Annotation %s: %s",
mCrashCriticalKey.get(), message.str().c_str());

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

@ -8,6 +8,7 @@
#include "CrashReporterMetadataShmem.h"
#include "nsISupportsImpl.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -64,3 +65,4 @@ CrashReporterClient::GetSingleton()
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER

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

@ -12,6 +12,7 @@
#include "mozilla/Unused.h"
#include "mozilla/ipc/Shmem.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -77,6 +78,7 @@ private:
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER
#endif // mozilla_ipc_CrashReporterClient_h

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

@ -10,9 +10,11 @@
#include "mozilla/Sprintf.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Telemetry.h"
#include "nsExceptionHandler.h"
#include "nsIAsyncShutdown.h"
#include "nsICrashService.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
# include "nsIAsyncShutdown.h"
# include "nsICrashService.h"
#endif
namespace mozilla {
namespace ipc {
@ -28,6 +30,7 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
{
}
#ifdef MOZ_CRASHREPORTER
bool
CrashReporterHost::GenerateCrashReport(base::ProcessId aPid)
{
@ -285,6 +288,7 @@ CrashReporterHost::AddNote(const nsCString& aKey, const nsCString& aValue)
{
mExtraNotes.Put(aKey, aValue);
}
#endif
} // namespace ipc
} // namespace mozilla

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

@ -12,7 +12,9 @@
#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 {
@ -28,8 +30,13 @@ 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:
@ -92,6 +99,7 @@ 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.
@ -141,6 +149,7 @@ public:
MOZ_ASSERT(HasMinidump());
return mDumpID;
}
#endif
private:
static void AsyncAddCrash(int32_t aProcessType, int32_t aCrashType,
@ -152,7 +161,9 @@ private:
Shmem mShmem;
ThreadId mThreadId;
time_t mStartTime;
#ifdef MOZ_CRASHREPORTER
AnnotationTable mExtraNotes;
#endif
nsString mDumpID;
bool mFinalized;
nsCOMPtr<nsIFile> mTargetDump;

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

@ -208,6 +208,7 @@ private:
EntryType mEntryType;
};
#ifdef MOZ_CRASHREPORTER
void
CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes)
{
@ -228,6 +229,7 @@ CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::Ann
}
}
}
#endif
} // namespace ipc
} // namespace mozilla

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

@ -28,7 +28,9 @@ 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,9 +224,11 @@ 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());
@ -753,7 +755,9 @@ 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);
@ -763,26 +767,26 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
childArgv.push_back(pidstring);
if (!CrashReporter::IsDummy()) {
# if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
int childCrashFd, childCrashRemapFd;
if (!CrashReporter::CreateNotificationPipeForChild(
&childCrashFd, &childCrashRemapFd)) {
return false;
}
if (0 <= childCrashFd) {
# if defined(MOZ_CRASHREPORTER)
# if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
int childCrashFd, childCrashRemapFd;
if (!CrashReporter::CreateNotificationPipeForChild(
&childCrashFd, &childCrashRemapFd))
return false;
if (0 <= childCrashFd) {
mLaunchOptions->fds_to_remap
.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd));
childArgv.push_back("true");
} 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)
// "true" == crash reporting enabled
childArgv.push_back("true");
}
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
@ -996,7 +1000,9 @@ 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));
@ -1008,8 +1014,10 @@ 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,7 +25,9 @@
#include <stdint.h>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsID.h"
#include "nsIWidget.h"
#include "nsMemory.h"
@ -125,12 +127,16 @@ 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,8 +674,10 @@ 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
@ -699,8 +701,10 @@ 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,7 +14,9 @@
#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"
@ -159,8 +161,10 @@ 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(XP_WIN)
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
#include "aclapi.h"
#include "sddl.h"
@ -45,7 +45,7 @@ using base::ProcessId;
namespace mozilla {
#if defined(XP_WIN)
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR.
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \
RemovePointer<LPTSTR>::Type, \
@ -209,9 +209,11 @@ 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;
}
@ -221,6 +223,7 @@ bool DuplicateHandle(HANDLE aSourceHandle,
}
#endif
#ifdef MOZ_CRASHREPORTER
void
AnnotateSystemError()
{
@ -236,8 +239,9 @@ AnnotateSystemError()
nsPrintfCString("%" PRId64, error));
}
}
#endif
#if defined(XP_MACOSX)
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
void
AnnotateCrashReportWithErrno(const char* tag, int error)
{
@ -284,6 +288,7 @@ 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.
@ -294,6 +299,7 @@ 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.");
@ -611,7 +617,11 @@ 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,7 +573,11 @@ 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
@ -692,7 +696,7 @@ private:
ProcessId mMyPid, mOtherPid;
};
#if defined(XP_MACOSX)
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
void AnnotateCrashReportWithErrno(const char* tag, int error);
#else
static inline void AnnotateCrashReportWithErrno(const char* tag, int error)

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

@ -2566,6 +2566,13 @@ 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,7 +16,9 @@
#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 {
@ -210,8 +212,10 @@ 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,12 +22,15 @@
#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__); \
@ -37,6 +40,15 @@
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)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif // defined(ACCESSIBILITY)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#include "nsWindowsHelpers.h"
#include "nsXULAppAPI.h"
@ -50,7 +50,7 @@ MainThreadRuntime::MainThreadRuntime()
, mActCtxRgn(a11y::Compatibility::GetActCtxResourceId())
#endif // defined(ACCESSIBILITY)
{
#if defined(ACCESSIBILITY)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
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)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
// We must be the outermost COM initialization on this thread. The COM runtime
// cannot be configured once we start manipulating objects

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

@ -5,20 +5,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Move.h"
#if defined(ACCESSIBILITY)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#include "HandlerData.h"
#include "mozilla/a11y/Platform.h"
#include "mozilla/mscom/ActivationContext.h"
#endif // defined(ACCESSIBILITY)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#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>
@ -44,11 +46,15 @@ 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;
}
@ -56,8 +62,10 @@ 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;
}
@ -66,16 +74,18 @@ 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)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
const uint32_t expectedStreamLen = GetOBJREFSize(WrapNotNull(mStream));
nsAutoCString strActCtx;
nsAutoString manifestPath;
#endif // defined(ACCESSIBILITY)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
HRESULT unmarshalResult = S_OK;
@ -83,11 +93,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)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
auto marshalFn = [this, &strActCtx, &manifestPath, &unmarshalResult, &aIID, aEnv]() -> void
#else
auto marshalFn = [this, &unmarshalResult, &aIID, aEnv]() -> void
#endif // defined(ACCESSIBILITY)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
{
if (aEnv) {
bool pushOk = aEnv->Push();
@ -106,7 +116,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
MOZ_DIAGNOSTIC_ASSERT(popOk);
});
#if defined(ACCESSIBILITY)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
auto curActCtx = ActivationContext::GetCurrent();
if (curActCtx.isOk()) {
strActCtx.AppendPrintf("0x%p", curActCtx.unwrap());
@ -115,7 +125,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
}
ActivationContext::GetCurrentManifestPath(manifestPath);
#endif // defined(ACCESSIBILITY)
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
unmarshalResult =
::CoUnmarshalInterface(mStream, aIID, getter_AddRefs(mUnmarshaledProxy));
@ -133,6 +143,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
mStream = nullptr;
#if defined(MOZ_CRASHREPORTER)
if (FAILED(unmarshalResult) || !mUnmarshaledProxy) {
nsPrintfCString hrAsStr("0x%08X", unmarshalResult);
CrashReporter::AnnotateCrashReport(
@ -165,6 +176,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
actualStreamLen);
#endif // defined(ACCESSIBILITY)
}
#endif // defined(MOZ_CRASHREPORTER)
}
ProxyStream::ProxyStream(ProxyStream&& aOther)
@ -296,11 +308,17 @@ 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();
@ -325,9 +343,9 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
return;
}
#if defined(ACCESSIBILITY)
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
ActivationContext::GetCurrentManifestPath(manifestPath);
#endif // defined(ACCESSIBILITY)
#endif // defined(MOZ_CRASHREPORTER)
marshalResult = ::CoMarshalInterface(stream, aIID, aObject, MSHCTX_LOCAL,
nullptr, mshlFlags);
@ -357,6 +375,7 @@ 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(
@ -386,12 +405,15 @@ 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;
}
@ -406,16 +428,20 @@ 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,6 +7,10 @@
#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,10 +32,14 @@ UNIFIED_SOURCES += [
'Objref.cpp',
'PassthruProxy.cpp',
'ProxyStream.cpp',
'RegistrationAnnotator.cpp',
'Utils.cpp',
]
if CONFIG['MOZ_CRASHREPORTER']:
UNIFIED_SOURCES += [
'RegistrationAnnotator.cpp',
]
if CONFIG['ACCESSIBILITY']:
DIRS += [
'oop',

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

@ -18,7 +18,6 @@
#include "nsAutoPtr.h"
#include "nsNetUtil.h"
#include "nsExceptionHandler.h"
#include "nsIMemoryInfoDumper.h"
#include "nsIMemoryReporter.h"
#include "nsIObserverService.h"
@ -61,6 +60,10 @@
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@ -749,7 +752,9 @@ XPCJSRuntime::GCSliceCallback(JSContext* cx,
if (!self)
return;
#ifdef MOZ_CRASHREPORTER
CrashReporter::SetGarbageCollecting(progress == JS::GC_CYCLE_BEGIN);
#endif
if (self->mPrevGCSliceCallback)
(*self->mPrevGCSliceCallback)(cx, progress, desc);

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

@ -13,7 +13,6 @@
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsExceptionHandler.h"
#include "nsIServiceManager.h"
#include "nsIFile.h"
#include "nsString.h"
@ -62,6 +61,11 @@
#include <unistd.h> /* for isatty() */
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#endif
#ifdef ENABLE_TESTS
#include "xpctest_private.h"
#endif
@ -1189,8 +1193,9 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
argv += 2;
}
#ifdef MOZ_CRASHREPORTER
const char* val = getenv("MOZ_CRASHREPORTER");
if (val && *val && !CrashReporter::IsDummy()) {
if (val && *val) {
rv = CrashReporter::SetExceptionHandler(greDir, true);
if (NS_FAILED(rv)) {
printf("CrashReporter::SetExceptionHandler failed!\n");
@ -1198,6 +1203,7 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
}
MOZ_ASSERT(CrashReporter::GetEnabled());
}
#endif
if (argc > 1 && !strcmp(argv[1], "--greomni")) {
nsCOMPtr<nsIFile> greOmni;
@ -1389,10 +1395,11 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
rv = NS_ShutdownXPCOM( nullptr );
MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
#ifdef MOZ_CRASHREPORTER
// Shut down the crashreporter service to prevent leaking some strings it holds.
if (CrashReporter::GetEnabled()) {
if (CrashReporter::GetEnabled())
CrashReporter::UnsetExceptionHandler();
}
#endif
#ifdef MOZ_GECKO_PROFILER
// This must precede NS_LogTerm(), otherwise xpcshell return non-zero

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

@ -25,7 +25,6 @@
#include "nsDOMTokenList.h"
#include "nsDeviceContext.h"
#include "nsIContentInlines.h"
#include "nsICrashReporter.h"
#include "nsIDOMNode.h"
#include "nsIDocumentInlines.h"
#include "nsILoadContext.h"
@ -76,6 +75,10 @@
# include "mozmemory.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
@ -2819,9 +2822,11 @@ void
Gecko_AddBufferToCrashReport(const void* addr, size_t len)
{
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->RegisterAppMemory((uint64_t) addr, len);
#endif
}
void
@ -2830,9 +2835,11 @@ Gecko_AnnotateCrashReport(const char* key_str, const char* value_str)
MOZ_ASSERT(NS_IsMainThread());
nsDependentCString key(key_str);
nsDependentCString value(value_str);
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->AnnotateCrashReport(key, value);
#endif
}
void

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

@ -9,7 +9,6 @@
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
@ -17,24 +16,28 @@
#include "mozilla/dom/SRIMetadata.h"
#include "MainThreadUtils.h"
#include "nsColor.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryService.h"
#include "nsExceptionHandler.h"
#include "nsIChromeRegistry.h"
#include "nsIConsoleService.h"
#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsISimpleEnumerator.h"
#include "nsISubstitutingProtocolHandler.h"
#include "nsIXULRuntime.h"
#include "nsNetUtil.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsIXULRuntime.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "nsZipArchive.h"
// Includes for the crash report annotation in ErrorLoadingSheet.
#ifdef MOZ_CRASHREPORTER
#include "mozilla/Omnijar.h"
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsExceptionHandler.h"
#include "nsIChromeRegistry.h"
#include "nsISimpleEnumerator.h"
#include "nsISubstitutingProtocolHandler.h"
#include "zlib.h"
#include "nsZipArchive.h"
#endif
using namespace mozilla;
using namespace mozilla::css;
@ -474,6 +477,7 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile,
LoadSheet(uri, aSheet, aParsingMode, aFailureAction);
}
#ifdef MOZ_CRASHREPORTER
static inline nsresult
ComputeCRC32(nsIFile* aFile, uint32_t* aResult)
{
@ -750,6 +754,7 @@ AnnotateCrashReport(nsIURI* aURI)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SheetLoadFailure"),
NS_ConvertUTF16toUTF8(annotation));
}
#endif
static void
ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
@ -765,7 +770,10 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
}
}
#ifdef MOZ_CRASHREPORTER
AnnotateCrashReport(aURI);
#endif
MOZ_CRASH_UNSAFE_OOL(errorMessage.get());
}
@ -792,8 +800,9 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
}
}
#ifdef MOZ_CRASHREPORTER
nsZipArchive::sFileCorruptedReason = nullptr;
#endif
nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet);
if (NS_FAILED(rv)) {
ErrorLoadingSheet(aURI,

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

@ -8,13 +8,15 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/Vector.h"
#include "mozmemory.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#include "Utils.h"
#include "gtest/gtest.h"
#ifdef MOZ_CRASHREPORTER
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#endif
#ifdef NIGHTLY_BUILD
#if defined(DEBUG) && !defined(XP_WIN) && !defined(ANDROID)
@ -26,11 +28,13 @@ extern unsigned int _gdb_sleep_duration;
#ifndef XP_DARWIN
static void DisableCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
}
// Wrap ASSERT_DEATH_IF_SUPPORTED to disable the crash reporter

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

@ -1991,7 +1991,9 @@ var BrowserApp = {
// Crash reporter submit pref must be fetched from nsICrashReporter
// service.
case "datareporting.crashreporter.submitEnabled":
if (AppConstants.MOZ_CRASHREPORTER) {
let crashReporterBuilt = "nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter;
if (crashReporterBuilt) {
aSubject.setAsBool(Services.appinfo.submitReports);
}
break;
@ -2044,7 +2046,9 @@ var BrowserApp = {
// Crash reporter preference is in a service; set and return.
case "datareporting.crashreporter.submitEnabled":
if (AppConstants.MOZ_CRASHREPORTER) {
let crashReporterBuilt = "nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter;
if (crashReporterBuilt) {
Services.appinfo.submitReports = value;
aSubject.setAsEmpty();
}

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

@ -1239,7 +1239,8 @@ SessionStore.prototype = {
},
_updateCrashReportURL: function ss_updateCrashReportURL(aWindow) {
if (!AppConstants.MOZ_CRASHREPORTER) {
let crashReporterBuilt = "nsICrashReporter" in Ci && Services.appinfo instanceof Ci.nsICrashReporter;
if (!crashReporterBuilt) {
return;
}

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

@ -81,6 +81,10 @@
#include "plstr.h"
#include "prlink.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#ifdef XP_WIN
#include "windows.h"
#endif

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

@ -9,13 +9,15 @@
#include "mozilla/DebugOnly.h"
#include "ipc/IPCMessageUtils.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#include "nsStringGlue.h"
#include "prio.h"
#include "mozilla/net/DNS.h"
#include "TimingStruct.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif
namespace IPC {
@ -100,11 +102,12 @@ struct ParamTraits<mozilla::net::NetAddr>
aMsg->WriteBytes(aParam.local.path, sizeof(aParam.local.path));
#endif
} else {
#ifdef MOZ_CRASHREPORTER
if (XRE_IsParentProcess()) {
nsPrintfCString msg("%d", aParam.raw.family);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Unknown NetAddr socket family"), msg);
}
#endif
MOZ_CRASH("Unknown socket family");
}
}

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

@ -18,7 +18,9 @@
#include "mozilla/Unused.h"
#include "mozilla/dom/Exceptions.h"
#include "nsContentUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "mozilla/StackWalk.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -104,8 +106,11 @@ static void
SandboxCrash(int nr, siginfo_t *info, void *void_context)
{
pid_t pid = getpid(), tid = syscall(__NR_gettid);
bool dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context);
bool dumped = false;
#ifdef MOZ_CRASHREPORTER
dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context);
#endif
if (!dumped) {
SANDBOX_LOG_ERROR("crash reporter is disabled (or failed);"
" trying stack trace:");

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

@ -12,7 +12,6 @@
#include "nsAutoPtr.h"
#include "nsCollationCID.h"
#include "nsEmbedCID.h"
#include "nsExceptionHandler.h"
#include "nsThreadUtils.h"
#include "mozStoragePrivateHelpers.h"
#include "nsIXPConnect.h"
@ -27,6 +26,10 @@
#include "sqlite3.h"
#include "mozilla/AutoSQLiteLifetime.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef XP_WIN
// "windows.h" was included and it can #define lots of things we care about...
#undef CompareString
@ -798,11 +801,13 @@ Service::Observe(nsISupports *, const char *aTopic, const char16_t *)
getConnections(connections);
for (uint32_t i = 0, n = connections.Length(); i < n; i++) {
if (!connections[i]->isClosed()) {
#ifdef MOZ_CRASHREPORTER
// getFilename is only the leaf name for the database file,
// so it shouldn't contain privacy-sensitive information.
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("StorageConnectionNotClosed"),
connections[i]->getFilename());
#endif
#ifdef DEBUG
printf_stderr("Storage connection not closed: %s",
connections[i]->getFilename().get());

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

@ -6,7 +6,9 @@
#include "GTestRunner.h"
#include "gtest/gtest.h"
#include "mozilla/Attributes.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#include "testing/TestHarness.h"
#include "prenv.h"
#ifdef XP_WIN
@ -89,6 +91,7 @@ int RunGTestFunc(int* argc, char** argv)
#ifdef XP_WIN
mozilla::ipc::windows::InitUIThread();
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter;
char *crashreporterStr = PR_GetEnv("MOZ_CRASHREPORTER");
if (crashreporterStr && !strcmp(crashreporterStr, "1")) {
@ -109,6 +112,7 @@ int RunGTestFunc(int* argc, char** argv)
crashreporter->SetMinidumpPath(cwd);
}
}
#endif
return RUN_ALL_TESTS();
}

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

@ -1088,7 +1088,7 @@ this.BrowserTestUtils = {
}
let dumpID;
if (AppConstants.MOZ_CRASHREPORTER) {
if ('nsICrashReporter' in Ci) {
dumpID = subject.getPropertyAsAString('dumpID');
if (!dumpID) {
return reject("dumpID was not present despite crash reporting " +

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

@ -6,28 +6,26 @@
SPHINX_TREES['crash-manager'] = 'docs'
EXTRA_COMPONENTS += [
'CrashService.js',
'CrashService.manifest',
]
EXTRA_JS_MODULES += [
'CrashManager.jsm',
]
TESTING_JS_MODULES += [
'CrashManagerTest.jsm',
]
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
XPIDL_MODULE = 'toolkit_crashservice'
XPIDL_SOURCES += [
'nsICrashService.idl',
]
if CONFIG['MOZ_CRASHREPORTER']:
EXTRA_COMPONENTS += [
'CrashService.js',
'CrashService.manifest',
]
EXTRA_JS_MODULES += [
'CrashManager.jsm',
]
TESTING_JS_MODULES += [
'CrashManagerTest.jsm',
]
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')

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

@ -26,7 +26,6 @@ DIRS += [
'commandlines',
'contentprefs',
'contextualidentity',
'crashes',
'crashmonitor',
'diskspacewatcher',
'downloads',
@ -81,6 +80,9 @@ if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
if CONFIG['NS_PRINTING']:
DIRS += ['printing']
if CONFIG['MOZ_CRASHREPORTER']:
DIRS += ['crashes']
if CONFIG['BUILD_CTYPES']:
DIRS += ['ctypes']

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

@ -6,7 +6,9 @@
#include "nsWidgetsCID.h"
#include "nsIComponentRegistrar.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#ifndef TEST_NAME
#error "Must #define TEST_NAME before including places_test_harness_tail.h"

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

@ -29,7 +29,9 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include "GeckoProfiler.h"
#include "nsThreadUtils.h"
@ -163,8 +165,9 @@ RunWatchdog(void* arg)
}
// Shutdown is apparently dead. Crash the process.
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetMinidumpAnalysisAllThreads();
#endif
MOZ_CRASH("Shutdown too long, probably frozen, causing a crash.");
}
}
@ -552,11 +555,13 @@ nsTerminator::UpdateTelemetry()
void
nsTerminator::UpdateCrashReport(const char* aTopic)
{
#if defined(MOZ_CRASHREPORTER)
// In case of crash, we wish to know where in shutdown we are
nsAutoCString report(aTopic);
Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
report);
#endif // defined(MOZ_CRASHREPORTER)
}

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

@ -3,7 +3,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
toolkit.jar:
#ifdef MOZ_CRASHREPORTER
content/global/crashes.xhtml (content/crashes.xhtml)
content/global/crashes.js (content/crashes.js)
#endif

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

@ -6,120 +6,110 @@
SPHINX_TREES['crashreporter'] = 'docs'
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += [
'google-breakpad/src/common',
'google-breakpad/src/processor',
'breakpad-windows-libxul',
]
if CONFIG['MSVC_HAS_DIA_SDK']:
DIRS += ['google-breakpad/src/tools/windows/dump_syms']
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['breakpad-windows-standalone']
elif CONFIG['OS_ARCH'] == 'Darwin':
DIRS += [
'breakpad-client',
'breakpad-client/mac/crash_generation',
'breakpad-client/mac/handler',
'google-breakpad/src/common',
'google-breakpad/src/common/mac',
'google-breakpad/src/processor',
'google-breakpad/src/tools/mac/dump_syms',
]
elif CONFIG['OS_ARCH'] == 'Linux':
DIRS += [
'breakpad-client',
'breakpad-client/linux/',
'google-breakpad/src/common',
'google-breakpad/src/common/linux',
'google-breakpad/src/processor',
'google-breakpad/src/tools/linux/dump_syms',
]
DIRS += [
'client',
'minidump-analyzer',
]
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['injector']
UNIFIED_SOURCES += [
'InjectCrashReporter.cpp',
'LoadLibraryRemote.cpp',
]
if CONFIG['ENABLE_TESTS']:
DIRS += ['test/gtest']
TEST_DIRS += ['test']
EXPORTS += [
'nsExceptionHandler.h',
]
JAR_MANIFESTS += ['jar.mn']
UNIFIED_SOURCES = [
'nsExceptionHandlerUtils.cpp',
UNIFIED_SOURCES += [
'nsExceptionHandler.cpp',
'ThreadAnnotation.cpp',
]
if CONFIG['OS_ARCH'] == 'Darwin':
UNIFIED_SOURCES += [
'mac_utils.mm',
]
EXTRA_JS_MODULES += [
'CrashReports.jsm',
'CrashSubmit.jsm',
'KeyValueParser.jsm',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_CRASHREPORTER']:
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += [
'google-breakpad/src/common',
'google-breakpad/src/processor',
'breakpad-windows-libxul',
]
if CONFIG['MSVC_HAS_DIA_SDK']:
DIRS += ['google-breakpad/src/tools/windows/dump_syms']
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['breakpad-windows-standalone']
elif CONFIG['OS_ARCH'] == 'Darwin':
DIRS += [
'breakpad-client',
'breakpad-client/mac/crash_generation',
'breakpad-client/mac/handler',
'google-breakpad/src/common',
'google-breakpad/src/common/mac',
'google-breakpad/src/processor',
'google-breakpad/src/tools/mac/dump_syms',
]
elif CONFIG['OS_ARCH'] == 'Linux':
DIRS += [
'breakpad-client',
'breakpad-client/linux/',
'google-breakpad/src/common',
'google-breakpad/src/common/linux',
'google-breakpad/src/processor',
'google-breakpad/src/tools/linux/dump_syms',
]
DIRS += [
'client',
'minidump-analyzer',
]
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['injector']
UNIFIED_SOURCES += [
'InjectCrashReporter.cpp',
'LoadLibraryRemote.cpp',
]
if CONFIG['ENABLE_TESTS']:
DIRS += ['test/gtest']
TEST_DIRS += ['test']
UNIFIED_SOURCES += [
'nsExceptionHandler.cpp',
'ThreadAnnotation.cpp',
]
if CONFIG['OS_ARCH'] == 'Darwin':
UNIFIED_SOURCES += [
'mac_utils.mm',
]
EXTRA_JS_MODULES += [
'CrashReports.jsm',
'CrashSubmit.jsm',
'KeyValueParser.jsm',
]
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
# NDK5 workarounds
DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True
DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
DEFINES['UNICODE'] = True
DEFINES['_UNICODE'] = True
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
# NDK5 workarounds
DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True
DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True
LOCAL_INCLUDES += [
'google-breakpad/src',
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
PYTHON_UNITTEST_MANIFESTS += [
'tools/python.ini',
]
DEFINES['UNICODE'] = True
DEFINES['_UNICODE'] = True
include('/toolkit/crashreporter/crashreporter.mozbuild')
JAR_MANIFESTS += ['jar.mn']
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-shadow']
else:
UNIFIED_SOURCES += [
'nsDummyExceptionHandler.cpp',
]
LOCAL_INCLUDES += [
'google-breakpad/src',
]
PYTHON_UNITTEST_MANIFESTS += [
'tools/python.ini',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-shadow']

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

@ -1,425 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsExceptionHandler.h"
#include "nsExceptionHandlerUtils.h"
namespace CrashReporter {
void
AnnotateOOMAllocationSize(size_t size)
{
}
void
AnnotateTexturesSize(size_t size)
{
}
void
AnnotatePendingIPC(size_t aNumOfPendingIPC,
uint32_t aTopPendingIPCCount,
const char* aTopPendingIPCName,
uint32_t aTopPendingIPCType)
{
}
nsresult
SetExceptionHandler(nsIFile* aXREDirectory,
bool force/*=false*/)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
GetEnabled()
{
return false;
}
bool
GetMinidumpPath(nsAString& aPath)
{
return false;
}
nsresult
SetMinidumpPath(const nsAString& aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetupExtraData(nsIFile* aAppDataDirectory,
const nsACString& aBuildID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
UnsetExceptionHandler()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
AnnotateCrashReport(const nsACString& key,
const nsACString& data)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
RemoveCrashReportAnnotation(const nsACString& key)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetGarbageCollecting(bool collecting)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetEventloopNestingLevel(uint32_t level)
{
}
void
SetMinidumpAnalysisAllThreads()
{
}
nsresult
AppendAppNotesToCrashReport(const nsACString& data)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
GetAnnotation(const nsACString& key, nsACString& data)
{
return false;
}
nsresult
RegisterAppMemory(void* ptr, size_t length)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
UnregisterAppMemory(void* ptr)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetIncludeContextHeap(bool aValue)
{
}
bool
GetServerURL(nsACString& aServerURL)
{
return false;
}
nsresult
SetServerURL(const nsACString& aServerURL)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetRestartArgs(int argc, char** argv)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#ifdef XP_WIN32
nsresult
WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif
#ifdef XP_LINUX
bool
WriteMinidumpForSigInfo(int signo,
siginfo_t* info,
void* uc)
{
return false;
}
#endif
#ifdef XP_MACOSX
nsresult
AppendObjCExceptionInfoToAppNotes(void *inException)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif
nsresult
GetSubmitReports(bool* aSubmitReports)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetSubmitReports(bool aSubmitReports)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetProfileDirectory(nsIFile* aDir)
{
}
void
SetUserAppDataDirectory(nsIFile* aDir)
{
}
void
UpdateCrashEventsDir()
{
}
bool
GetCrashEventsDir(nsAString& aPath)
{
return false;
}
void
SetMemoryReportFile(nsIFile* aFile)
{
}
nsresult
GetDefaultMemoryReportFile(nsIFile** aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetTelemetrySessionId(const nsACString& id)
{
}
void
DeleteMinidumpFilesForID(const nsAString& id)
{
}
bool
GetMinidumpForID(const nsAString& id, nsIFile** minidump)
{
return false;
}
bool
GetIDFromMinidump(nsIFile* minidump, nsAString& id)
{
return false;
}
bool
GetExtraFileForID(const nsAString& id,
nsIFile** extraFile)
{
return false;
}
bool
GetExtraFileForMinidump(nsIFile* minidump,
nsIFile** extraFile)
{
return false;
}
bool
AppendExtraData(const nsAString& id,
const AnnotationTable& data)
{
return false;
}
bool
AppendExtraData(nsIFile* extraFile,
const AnnotationTable& data)
{
return false;
}
void
OOPInit()
{
}
void
GetChildProcessTmpDir(nsIFile** aOutTmpDir)
{
}
#if defined(XP_WIN) || defined(XP_MACOSX)
const char*
GetChildNotificationPipe()
{
return nullptr;
}
#endif
#ifdef MOZ_CRASHREPORTER_INJECTOR
void
InjectCrashReporterIntoProcess(DWORD processID, InjectorCrashCallback* cb)
{
}
void
UnregisterInjectorCallback(DWORD processID)
{
}
#endif // MOZ_CRASHREPORTER_INJECTOR
bool
GetLastRunCrashID(nsAString& id)
{
return false;
}
#if defined(XP_WIN) || defined(XP_MACOSX)
void
InitChildProcessTmpDir(nsIFile* aDirOverride)
{
}
#endif // defined(XP_WIN) || defined(XP_MACOSX)
#if defined(XP_WIN)
bool
SetRemoteExceptionHandler(const nsACString& crashPipe)
{
return false;
}
#elif defined(XP_LINUX)
bool
CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd)
{
return false;
}
bool
SetRemoteExceptionHandler()
{
return false;
}
#elif defined(XP_MACOSX)
bool
SetRemoteExceptionHandler(const nsACString& crashPipe)
{
return false;
}
#endif // XP_WIN
bool
TakeMinidumpForChild(uint32_t childPid, nsIFile** dump, uint32_t* aSequence)
{
return false;
}
void
RenameAdditionalHangMinidump(nsIFile* minidump, nsIFile* childMinidump,
const nsACString& name)
{
}
ThreadId
CurrentThreadId()
{
return -1;
}
bool
TakeMinidump(nsIFile** aResult, bool aMoveToPending)
{
return false;
}
void
CreateMinidumpsAndPair(ProcessHandle aTargetPid,
ThreadId aTargetBlamedThread,
const nsACString& aIncomingPairName,
nsIFile* aIncomingDumpToPair,
nsIFile** aMainDumpOut,
std::function<void(bool)>&& aCallback,
bool aAsync)
{
}
bool
CreateAdditionalChildMinidump(ProcessHandle childPid,
ThreadId childBlamedThread,
nsIFile* parentMinidump,
const nsACString& name)
{
return false;
}
bool
UnsetRemoteExceptionHandler()
{
return false;
}
#if defined(MOZ_WIDGET_ANDROID)
void
SetNotificationPipeForChild(int childCrashFd)
{
}
void
AddLibraryMapping(const char* library_name,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset)
{
}
#endif
// From ThreadAnnotation.cpp
void
InitThreadAnnotation()
{
}
void
SetCurrentThreadName(const char* aName)
{
}
void
GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback)
{
}
void
ShutdownThreadAnnotation()
{
}
} // namespace CrashReporter

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsExceptionHandler.h"
#include "nsExceptionHandlerUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
@ -88,6 +87,7 @@ using mozilla::InjectCrashRunnable;
#include <map>
#include <vector>
#include "mozilla/double-conversion.h"
#include "mozilla/IOInterposer.h"
#include "mozilla/mozalloc_oom.h"
#include "mozilla/WindowsDllBlocklist.h"
@ -413,6 +413,54 @@ typedef std::map<uint32_t,google_breakpad::MappingList> MappingMap;
#endif
}
// Format a non-negative double to a string, without using C-library functions,
// which need to be avoided (.e.g. bug 1240160, comment 10). Leave the utility
// non-file static so that we can gtest it. Return false if we failed to
// get the formatting done correctly.
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength)
{
// aBufferLength is the size of the buffer. Be paranoid.
aBuffer[aBufferLength-1] = '\0';
if (aValue < 0) {
return false;
}
int length, point, i;
bool sign;
bool ok = true;
double_conversion::DoubleToStringConverter::DoubleToAscii(
aValue,
double_conversion::DoubleToStringConverter::SHORTEST,
8,
aBuffer,
aBufferLength,
&sign,
&length,
&point);
// length does not account for the 0 terminator.
if (length > point && (length+1) < (aBufferLength-1)) {
// We have to insert a decimal point. Not worried about adding a leading zero
// in the < 1 (point == 0) case.
aBuffer[length+1] = '\0';
for (i=length; i>point; i-=1) {
aBuffer[i] = aBuffer[i-1];
}
aBuffer[i] = '.'; // Not worried about locales
} else if (length < point) {
// Trailing zeros scenario
for (i=length; i<point; i+=1) {
if (i >= aBufferLength-2) {
ok = false;
}
aBuffer[i] = '0';
}
aBuffer[i] = '\0';
}
return ok;
}
namespace CrashReporter {
#ifdef XP_LINUX

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

@ -3,12 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This header has two implementations, the real one in nsExceptionHandler.cpp
// and a dummy in nsDummyExceptionHandler.cpp. The latter is used in builds
// configured with --disable-crashreporter. If you add or remove a function
// from this header you must update both implementations otherwise you'll break
// builds that disable the crash reporter.
#ifndef nsExceptionHandler_h__
#define nsExceptionHandler_h__
@ -40,19 +34,6 @@ template<class KeyClass, class DataType> class nsDataHashtable;
class nsCStringHashKey;
namespace CrashReporter {
/**
* Returns true if the crash reporter is using the dummy implementation.
*/
static inline bool
IsDummy() {
#ifdef MOZ_CRASHREPORTER
return false;
#else
return true;
#endif
}
nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force=false);
nsresult UnsetExceptionHandler();

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

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsExceptionHandlerUtils.h"
#include "mozilla/double-conversion.h"
// Format a non-negative double to a string, without using C-library functions,
// which need to be avoided (.e.g. bug 1240160, comment 10). Return false if
// we failed to get the formatting done correctly.
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength)
{
// aBufferLength is the size of the buffer. Be paranoid.
aBuffer[aBufferLength-1] = '\0';
if (aValue < 0) {
return false;
}
int length, point, i;
bool sign;
bool ok = true;
double_conversion::DoubleToStringConverter::DoubleToAscii(
aValue,
double_conversion::DoubleToStringConverter::SHORTEST,
8,
aBuffer,
aBufferLength,
&sign,
&length,
&point);
// length does not account for the 0 terminator.
if (length > point && (length+1) < (aBufferLength-1)) {
// We have to insert a decimal point. Not worried about adding a leading zero
// in the < 1 (point == 0) case.
aBuffer[length+1] = '\0';
for (i=length; i>point; i-=1) {
aBuffer[i] = aBuffer[i-1];
}
aBuffer[i] = '.'; // Not worried about locales
} else if (length < point) {
// Trailing zeros scenario
for (i=length; i<point; i+=1) {
if (i >= aBufferLength-2) {
ok = false;
}
aBuffer[i] = '0';
}
aBuffer[i] = '\0';
}
return ok;
}

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

@ -1,12 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsExceptionHandlerUtils_h__
#define nsExceptionHandlerUtils_h__
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
#endif // nsExceptionHandlerUtils_h__

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

@ -7,7 +7,6 @@
DIRS += [
'components',
'content',
'crashreporter',
'forgetaboutsite',
'locales',
'modules',
@ -47,6 +46,9 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['system/androidproxy']
if CONFIG['MOZ_CRASHREPORTER']:
DIRS += ['crashreporter']
TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.crashreporter.test.browser += [
'crashreporter/test/browser/crashreport.sjs',
]

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

@ -2201,7 +2201,8 @@ this.XPIProvider = {
Services.obs.notifyObservers(null, "chrome-flush-caches");
}
if (AppConstants.MOZ_CRASHREPORTER) {
if ("nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter) {
// Annotate the crash report with relevant add-on information.
try {
Services.appinfo.annotateCrashReport("Theme", this.currentSkin);
@ -2762,16 +2763,14 @@ this.XPIProvider = {
* Adds a list of currently active add-ons to the next crash report.
*/
addAddonsToCrashReporter() {
if (!(Services.appinfo instanceof Ci.nsICrashReporter) ||
!AppConstants.MOZ_CRASHREPORTER) {
if (!("nsICrashReporter" in Ci) ||
!(Services.appinfo instanceof Ci.nsICrashReporter))
return;
}
// In safe mode no add-ons are loaded so we should not include them in the
// crash report
if (Services.appinfo.inSafeMode) {
if (Services.appinfo.inSafeMode)
return;
}
let data = Array.from(XPIStates.enabledAddons(),
a => encoded`${a.id}:${a.version}`).join(",");

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

@ -40,7 +40,6 @@ const MAX_TIME_DIFFERENCE = 3000;
const MAKE_FILE_OLD_DIFFERENCE = 10 * 3600 * 1000;
Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
@ -371,9 +370,8 @@ function isNightlyChannel() {
* The version of the add-on
*/
function do_check_in_crash_annotation(aId, aVersion) {
if (!AppConstants.MOZ_CRASHREPORTER) {
if (!("nsICrashReporter" in AM_Ci))
return;
}
if (!("Add-ons" in gAppInfo.annotations)) {
do_check_false(true);
@ -394,9 +392,8 @@ function do_check_in_crash_annotation(aId, aVersion) {
* The version of the add-on
*/
function do_check_not_in_crash_annotation(aId, aVersion) {
if (!AppConstants.MOZ_CRASHREPORTER) {
if (!("nsICrashReporter" in AM_Ci))
return;
}
if (!("Add-ons" in gAppInfo.annotations)) {
do_check_true(true);

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

@ -29,12 +29,14 @@ GeckoStart(JNIEnv* env, char** argv, int argc, const StaticXREAppData& aAppData)
{
mozilla::jni::SetGeckoThreadEnv(env);
#ifdef MOZ_CRASHREPORTER
const struct mapping_info *info = getLibraryMapping();
while (info->name) {
CrashReporter::AddLibraryMapping(info->name, info->base,
info->len, info->offset);
info++;
}
#endif
if (!argv) {
LOG("Failed to get arguments for GeckoStart\n");

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

@ -200,6 +200,7 @@
#include "jprof.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
@ -208,6 +209,7 @@
#if defined(XP_LINUX) && !defined(ANDROID)
#include "mozilla/widget/LSBUtils.h"
#endif
#endif
#include "base/command_line.h"
#include "GTestRunner.h"
@ -702,8 +704,10 @@ class nsXULAppInfo : public nsIXULAppInfo,
#ifdef XP_WIN
public nsIWinAppHelper,
#endif
#ifdef MOZ_CRASHREPORTER
public nsICrashReporter,
public nsIFinishDumpingCallback,
#endif
public nsIXULRuntime
{
@ -714,8 +718,10 @@ public:
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIOBSERVER
#ifdef MOZ_CRASHREPORTER
NS_DECL_NSICRASHREPORTER
NS_DECL_NSIFINISHDUMPINGCALLBACK
#endif
#ifdef XP_WIN
NS_DECL_NSIWINAPPHELPER
#endif
@ -728,8 +734,10 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
#ifdef XP_WIN
NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
#endif
#ifdef MOZ_CRASHREPORTER
NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback)
#endif
NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData ||
XRE_IsContentProcess())
@ -1198,6 +1206,7 @@ nsXULAppInfo::GetUserCanElevate(bool *aUserCanElevate)
}
#endif
#ifdef MOZ_CRASHREPORTER
NS_IMETHODIMP
nsXULAppInfo::GetEnabled(bool *aEnabled)
{
@ -1427,6 +1436,7 @@ nsXULAppInfo::Callback(nsISupports* aData)
CrashReporter::SetMemoryReportFile(file);
return NS_OK;
}
#endif
static const nsXULAppInfo kAppInfo;
static nsresult AppInfoConstructor(nsISupports* aOuter,
@ -1534,7 +1544,7 @@ static const mozilla::Module::ContractIDEntry kXREContracts[] = {
{ XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID },
#ifdef MOZ_CRASHREPORTER
{ NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID },
#endif // MOZ_CRASHREPORTER
#endif
{ NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
{ NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
{ nullptr }
@ -2894,6 +2904,7 @@ static void RestoreStateForAppInitiatedRestart()
}
}
#ifdef MOZ_CRASHREPORTER
// When we first initialize the crash reporter we don't have a profile,
// so we set the minidump path to $TEMP. Once we have a profile,
// we set it to $PROFILE/minidumps, creating the directory
@ -2918,6 +2929,7 @@ static void MakeOrSetMinidumpPath(nsIFile* profD)
CrashReporter::SetMinidumpPath(pathStr);
}
}
#endif
const XREAppData* gAppData = nullptr;
@ -3308,6 +3320,7 @@ XREMain::XRE_mainInit(bool* aExitFlag)
if (NS_FAILED(rv))
return 1;
#ifdef MOZ_CRASHREPORTER
if (EnvHasValue("MOZ_CRASHREPORTER")) {
mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
}
@ -3393,6 +3406,7 @@ XREMain::XRE_mainInit(bool* aExitFlag)
}
}
}
#endif
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
if (mAppData->sandboxBrokerServices) {
@ -3542,17 +3556,21 @@ XREMain::XRE_mainInit(bool* aExitFlag)
}
}
#ifdef MOZ_CRASHREPORTER
if (cpuUpdateRevision > 0) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
nsPrintfCString("0x%x",
cpuUpdateRevision));
}
#endif
}
#endif
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
gSafeMode ? NS_LITERAL_CSTRING("1") :
NS_LITERAL_CSTRING("0"));
#endif
// Handle --no-remote and --new-instance command line arguments. Setup
// the environment to better accommodate other components and various
@ -3616,6 +3634,7 @@ XREMain::XRE_mainInit(bool* aExitFlag)
return 0;
}
#ifdef MOZ_CRASHREPORTER
#ifdef XP_WIN
/**
* Uses WMI to read some manufacturer information that may be useful for
@ -3709,6 +3728,8 @@ AnnotateLSBRelease(void*)
#endif // defined(XP_LINUX) && !defined(ANDROID)
#endif
#ifdef XP_WIN
static void ReadAheadDll(const wchar_t* dllName) {
wchar_t dllPath[MAX_PATH];
@ -4167,10 +4188,12 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
mozilla::Telemetry::SetProfileDir(mProfD);
#ifdef MOZ_CRASHREPORTER
if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
MakeOrSetMinidumpPath(mProfD);
CrashReporter::SetProfileDirectory(mProfD);
#endif
nsAutoCString version;
BuildVersion(version);
@ -4261,6 +4284,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
return 0;
}
#if defined(MOZ_CRASHREPORTER)
#if defined(MOZ_CONTENT_SANDBOX)
void AddSandboxAnnotations()
{
@ -4291,6 +4315,7 @@ void AddSandboxAnnotations()
sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
}
#endif /* MOZ_CONTENT_SANDBOX */
#endif /* MOZ_CRASHREPORTER */
/*
* XRE_mainRun - Command line startup, profile migration, and
@ -4325,6 +4350,7 @@ XREMain::XRE_mainRun()
rv = mScopedXPCOM->SetWindowCreator(mNativeApp);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
#ifdef MOZ_CRASHREPORTER
// tell the crash reporter to also send the release channel
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
if (NS_SUCCEEDED(rv)) {
@ -4358,6 +4384,8 @@ XREMain::XRE_mainRun()
#if defined(XP_LINUX) && !defined(ANDROID)
PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW,
PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
#endif
#endif
if (mStartOffline) {
@ -4487,9 +4515,11 @@ XREMain::XRE_mainRun()
OverrideDefaultLocaleIfNeeded();
#ifdef MOZ_CRASHREPORTER
nsCString userAgentLocale;
LocaleService::GetInstance()->GetAppLocaleAsLangTag(userAgentLocale);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
#endif
appStartup->GetShuttingDown(&mShuttingDown);
@ -4580,8 +4610,10 @@ XREMain::XRE_mainRun()
(void)appStartup->DoneStartingUp();
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
NS_LITERAL_CSTRING("0"));
#endif
appStartup->GetShuttingDown(&mShuttingDown);
}
@ -4634,16 +4666,20 @@ XREMain::XRE_mainRun()
sandboxInfo.Test(SandboxInfo::kEnabledForContent));
Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
#if defined(MOZ_CRASHREPORTER)
nsAutoCString flagsString;
flagsString.AppendInt(sandboxInfo.AsInteger());
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_SANDBOX && XP_LINUX */
#if defined(MOZ_CRASHREPORTER)
#if defined(MOZ_CONTENT_SANDBOX)
AddSandboxAnnotations();
#endif /* MOZ_CONTENT_SANDBOX */
#endif /* MOZ_CRASHREPORTER */
{
rv = appStartup->Run();
@ -4868,9 +4904,10 @@ XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig)
rv = LaunchChild(mNativeApp, true);
}
#ifdef MOZ_CRASHREPORTER
if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
CrashReporter::UnsetExceptionHandler();
#endif
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
}
@ -4882,8 +4919,10 @@ XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig)
}
#endif
#ifdef MOZ_CRASHREPORTER
if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
CrashReporter::UnsetExceptionHandler();
#endif
XRE_DeinitCommandLine();

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

@ -243,7 +243,9 @@ void
XRE_SetAndroidChildFds (JNIEnv* env, int crashFd, int ipcFd)
{
mozilla::jni::SetGeckoThreadEnv(env);
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetNotificationPipeForChild(crashFd);
#endif // defined(MOZ_CRASHREPORTER)
IPC::Channel::SetClientChannelFd(ipcFd);
}
#endif // defined(MOZ_WIDGET_ANDROID)
@ -268,6 +270,7 @@ XRE_SetProcessType(const char* aProcessTypeString)
}
}
#if defined(MOZ_CRASHREPORTER)
// FIXME/bug 539522: this out-of-place function is stuck here because
// IPDL wants access to this crashreporter interface, and
// crashreporter is built in such a way to make that awkward
@ -289,6 +292,7 @@ XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
# error "OOP crash reporter unsupported on this platform"
#endif
}
#endif // if defined(MOZ_CRASHREPORTER)
#if defined(XP_WIN)
void
@ -300,6 +304,7 @@ SetTaskbarGroupId(const nsString& aId)
}
#endif
#if defined(MOZ_CRASHREPORTER)
#if defined(MOZ_CONTENT_SANDBOX)
void
AddContentSandboxLevelAnnotation()
@ -313,6 +318,7 @@ AddContentSandboxLevelAnnotation()
}
}
#endif /* MOZ_CONTENT_SANDBOX */
#endif /* MOZ_CRASHREPORTER */
namespace {
@ -477,37 +483,35 @@ XRE_InitChildProcess(int aArgc,
SetupErrorHandling(aArgv[0]);
if (!CrashReporter::IsDummy()) {
if (aArgc < 1) {
return NS_ERROR_FAILURE;
}
#if defined(MOZ_CRASHREPORTER)
if (aArgc < 1)
return NS_ERROR_FAILURE;
const char* const crashReporterArg = aArgv[--aArgc];
const char* const crashReporterArg = aArgv[--aArgc];
#if defined(XP_WIN) || defined(XP_MACOSX)
// on windows and mac, |crashReporterArg| is the named pipe on which the
// server is listening for requests, or "-" if crash reporting is
// disabled.
if (0 != strcmp("-", crashReporterArg) &&
!XRE_SetRemoteExceptionHandler(crashReporterArg)) {
// Bug 684322 will add better visibility into this condition
NS_WARNING("Could not setup crash reporting\n");
}
#elif defined(OS_LINUX)
// on POSIX, |crashReporterArg| is "true" if crash reporting is
// enabled, false otherwise
if (0 != strcmp("false", crashReporterArg) &&
!XRE_SetRemoteExceptionHandler(nullptr)) {
// Bug 684322 will add better visibility into this condition
NS_WARNING("Could not setup crash reporting\n");
}
#else
# error "OOP crash reporting unsupported on this platform"
#endif
# if defined(XP_WIN) || defined(XP_MACOSX)
// on windows and mac, |crashReporterArg| is the named pipe on which the
// server is listening for requests, or "-" if crash reporting is
// disabled.
if (0 != strcmp("-", crashReporterArg) &&
!XRE_SetRemoteExceptionHandler(crashReporterArg)) {
// Bug 684322 will add better visibility into this condition
NS_WARNING("Could not setup crash reporting\n");
}
# elif defined(OS_LINUX)
// on POSIX, |crashReporterArg| is "true" if crash reporting is
// enabled, false otherwise
if (0 != strcmp("false", crashReporterArg) &&
!XRE_SetRemoteExceptionHandler(nullptr)) {
// Bug 684322 will add better visibility into this condition
NS_WARNING("Could not setup crash reporting\n");
}
# else
# error "OOP crash reporting unsupported on this platform"
# endif
// For Init/Shutdown thread name annotations in the crash reporter.
CrashReporter::InitThreadAnnotationRAII annotation;
#endif // if defined(MOZ_CRASHREPORTER)
gArgv = aArgv;
gArgc = aArgc;
@ -668,9 +672,11 @@ XRE_InitChildProcess(int aArgc,
return NS_ERROR_FAILURE;
}
#ifdef MOZ_CRASHREPORTER
#if defined(XP_WIN) || defined(XP_MACOSX)
CrashReporter::InitChildProcessTmpDir(crashReportTmpDir);
#endif
#endif
#if defined(XP_WIN)
// Set child processes up such that they will get killed after the
@ -687,8 +693,10 @@ XRE_InitChildProcess(int aArgc,
OverrideDefaultLocaleIfNeeded();
#if defined(MOZ_CRASHREPORTER)
#if defined(MOZ_CONTENT_SANDBOX)
AddContentSandboxLevelAnnotation();
#endif
#endif
// Run the UI event loop on the main thread.

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

@ -117,6 +117,7 @@ X11Error(Display *display, XErrorEvent *event) {
}
}
#ifdef MOZ_CRASHREPORTER
switch (XRE_GetProcessType()) {
case GeckoProcessType_Default:
case GeckoProcessType_Plugin:
@ -126,6 +127,7 @@ X11Error(Display *display, XErrorEvent *event) {
default:
; // crash report notes not supported.
}
#endif
#ifdef DEBUG
// The resource id is unlikely to be useful in a crash report without

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

@ -15,7 +15,9 @@
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/TabParent.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif // #ifdef MOZ_CRASHREPORTER
#include "nsIWidget.h"
namespace mozilla {
@ -1111,7 +1113,9 @@ ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent)
GetBoolName(mWidgetHasComposition), mPendingCompositionCount,
mCommitStringByRequest));
#ifdef MOZ_CRASHREPORTER
mDispatchedEventMessages.AppendElement(aEvent.mMessage);
#endif // #ifdef MOZ_CRASHREPORTER
// We must be able to simulate the selection because
// we might not receive selection updates in time
@ -1189,7 +1193,9 @@ ContentCacheInParent::OnSelectionEvent(
GetBoolName(aSelectionEvent.mUseNativeLineBreak), mPendingEventsNeedingAck,
GetBoolName(mWidgetHasComposition), mPendingCompositionCount));
#ifdef MOZ_CRASHREPORTER
mDispatchedEventMessages.AppendElement(aSelectionEvent.mMessage);
#endif // #ifdef MOZ_CRASHREPORTER
mPendingEventsNeedingAck++;
}
@ -1206,22 +1212,27 @@ ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
"aMessage=%s), mPendingEventsNeedingAck=%u, mPendingCompositionCount=%" PRIu8,
this, aWidget, ToChar(aMessage), mPendingEventsNeedingAck, mPendingCompositionCount));
#ifdef MOZ_CRASHREPORTER
mReceivedEventMessages.AppendElement(aMessage);
#endif // #ifdef MOZ_CRASHREPORTER
if (WidgetCompositionEvent::IsFollowedByCompositionEnd(aMessage) ||
aMessage == eCompositionCommitRequestHandled) {
#ifdef MOZ_CRASHREPORTER
if (mPendingCompositionCount == 1) {
RemoveUnnecessaryEventMessageLog();
}
#endif // #ifdef MOZ_CRASHREPORTER
if (NS_WARN_IF(!mPendingCompositionCount)) {
#ifdef MOZ_CRASHREPORTER
nsPrintfCString info("\nThere is no pending composition but received %s "
"message from the remote child\n\n",
ToChar(aMessage));
AppendEventMessageLog(info);
CrashReporter::AppendAppNotesToCrashReport(info);
#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("No pending composition but received unexpected commit event");
}
@ -1241,11 +1252,13 @@ ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
}
if (NS_WARN_IF(!mPendingEventsNeedingAck)) {
#ifdef MOZ_CRASHREPORTER
nsPrintfCString info("\nThere is no pending events but received %s "
"message from the remote child\n\n",
ToChar(aMessage));
AppendEventMessageLog(info);
CrashReporter::AppendAppNotesToCrashReport(info);
#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("No pending event message but received unexpected event");
}
if (--mPendingEventsNeedingAck) {
@ -1277,10 +1290,11 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
// composition events for cleaning up TextComposition and handle the
// request as it's handled asynchronously.
if (mPendingCompositionCount > 1) {
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::
eToOldCompositionReceived);
#endif // #ifdef MOZ_CRASHREPORTER
return false;
}
@ -1290,10 +1304,11 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
// TextComposition. So, this shouldn't do nothing and TextComposition
// should handle the request as it's handled asynchronously.
if (mIsPendingLastCommitEvent) {
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::
eToCommittedCompositionReceived);
#endif // #ifdef MOZ_CRASHREPORTER
return false;
}
@ -1302,10 +1317,11 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
if (!IMEStateManager::DoesTabParentHaveIMEFocus(&mTabParent)) {
// Use the latest composition string which may not be handled in the
// remote process for avoiding data loss.
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::
eReceivedAfterTabParentBlur);
#endif // #ifdef MOZ_CRASHREPORTER
aCommittedString = mCompositionString;
return true;
}
@ -1316,11 +1332,11 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
MOZ_LOG(sContentCacheLog, LogLevel::Warning,
(" 0x%p RequestToCommitComposition(), "
"does nothing due to no composition", this));
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::
eReceivedButNoTextComposition);
#endif // #ifdef MOZ_CRASHREPORTER
return false;
}
@ -1347,10 +1363,11 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
// normally. On the other hand, TextComposition instance in the remote
// process won't dispatch following composition events and will be
// destroyed by IMEStateManager::DispatchCompositionEvent().
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::
eHandledAsynchronously);
#endif // #ifdef MOZ_CRASHREPORTER
return false;
}
@ -1362,9 +1379,10 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
// IMEStateManager::DispatchCompositionEvent() at receiving the
// eCompositionCommit event (Note that TextComposition instance in this
// process was already destroyed).
#ifdef MOZ_CRASHREPORTER
mRequestIMEToCommitCompositionResults.
AppendElement(RequestIMEToCommitCompositionResult::eHandledSynchronously);
#endif // #ifdef MOZ_CRASHREPORTER
return true;
}
@ -1461,6 +1479,8 @@ ContentCacheInParent::FlushPendingNotifications(nsIWidget* aWidget)
}
}
#ifdef MOZ_CRASHREPORTER
void
ContentCacheInParent::RemoveUnnecessaryEventMessageLog()
{
@ -1548,6 +1568,8 @@ ContentCacheInParent::AppendEventMessageLog(nsACString& aLog) const
aLog.AppendLiteral("\n");
}
#endif // #ifdef MOZ_CRASHREPORTER
/*****************************************************************************
* mozilla::ContentCache::TextRectArray
*****************************************************************************/

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

@ -410,6 +410,7 @@ private:
IMENotification mPendingLayoutChange;
IMENotification mPendingCompositionUpdate;
#ifdef MOZ_CRASHREPORTER
// Log of event messages to be output to crash report.
nsTArray<EventMessage> mDispatchedEventMessages;
nsTArray<EventMessage> mReceivedEventMessages;
@ -449,6 +450,7 @@ private:
}
nsTArray<RequestIMEToCommitCompositionResult>
mRequestIMEToCommitCompositionResults;
#endif // #ifdef MOZ_CRASHREPORTER
// mTabParent is owner of the instance.
dom::TabParent& MOZ_NON_OWNING_REF mTabParent;
@ -505,6 +507,7 @@ private:
void FlushPendingNotifications(nsIWidget* aWidget);
#ifdef MOZ_CRASHREPORTER
/**
* Remove unnecessary messages from mDispatchedEventMessages and
* mReceivedEventMessages.
@ -515,6 +518,7 @@ private:
* Append event message log to aLog.
*/
void AppendEventMessageLog(nsACString& aLog) const;
#endif // #ifdef MOZ_CRASHREPORTER
};
} // namespace mozilla

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

@ -38,6 +38,10 @@
#include "gfxConfig.h"
#include "DriverCrashGuard.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
using namespace mozilla::widget;
using namespace mozilla;
using mozilla::MutexAutoLock;

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

@ -11,12 +11,14 @@
#include <errno.h>
#include <sys/utsname.h>
#include "nsCRTGlue.h"
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#include "prenv.h"
#include "GfxInfoX11.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#endif
namespace mozilla {
namespace widget {
@ -174,8 +176,9 @@ GfxInfo::GetData()
mAdapterDescription.Append(nsDependentCString(buf));
mAdapterDescription.Append('\n');
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription);
#endif
return;
}
@ -191,8 +194,9 @@ GfxInfo::GetData()
if (mHasTextureFromPixmap)
note.AppendLiteral(" -- texture_from_pixmap");
note.Append('\n');
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(note);
#endif
// determine the major OpenGL version. That's the first integer in the version string.
mGLMajorVersion = strtol(mVersion.get(), 0, 10);

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

@ -8,15 +8,17 @@
#include "GLContextProvider.h"
#include "nsUnicharUtils.h"
#include "prenv.h"
#include "nsExceptionHandler.h"
#include "nsHashKeys.h"
#include "nsICrashReporter.h"
#include "nsVersionComparator.h"
#include "AndroidBridge.h"
#include "nsIWindowWatcher.h"
#include "nsServiceManagerUtils.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#endif
namespace mozilla {
namespace widget {
@ -348,6 +350,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
void
GfxInfo::AddCrashReportAnnotations()
{
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
mGLStrings->Vendor());
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
@ -361,6 +364,7 @@ GfxInfo::AddCrashReportAnnotations()
note.AppendPrintf("AdapterDescription: '%s'\n", mAdapterDescription.get());
CrashReporter::AppendAppNotesToCrashReport(note);
#endif
}
const nsTArray<GfxDriverInfo>&

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

@ -9,7 +9,10 @@
#include "GeneratedJNIWrappers.h"
#include "AndroidBuild.h"
#include "nsAppShell.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace jni {
@ -203,6 +206,7 @@ bool ReportException(JNIEnv* aEnv, jthrowable aExc, jstring aStack)
{
bool result = true;
#ifdef MOZ_CRASHREPORTER
result &= NS_SUCCEEDED(CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("JavaStackTrace"),
String::Ref::From(aStack)->ToCString()));
@ -215,6 +219,7 @@ bool ReportException(JNIEnv* aEnv, jthrowable aExc, jstring aStack)
CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\n") +
appNotes->ToCString());
}
#endif // MOZ_CRASHREPORTER
if (sOOMErrorClass && aEnv->IsInstanceOf(aExc, sOOMErrorClass)) {
NS_ABORT_OOM(0); // Unknown OOM size

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

@ -9,13 +9,11 @@
#include "base/message_loop.h"
#include "base/task.h"
#include "mozilla/Hal.h"
#include "nsExceptionHandler.h"
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsWindow.h"
#include "nsThreadUtils.h"
#include "nsICommandLineRunner.h"
#include "nsICrashReporter.h"
#include "nsIObserverService.h"
#include "nsIAppStartup.h"
#include "nsIGeolocationProvider.h"
@ -60,6 +58,11 @@
#include "mozilla/Logging.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#include "nsExceptionHandler.h"
#endif
#include "AndroidAlerts.h"
#include "AndroidUiThread.h"
#include "ANRReporter.h"

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

@ -10,9 +10,7 @@
#include "GfxInfo.h"
#include "nsUnicharUtils.h"
#include "nsExceptionHandler.h"
#include "nsCocoaFeatures.h"
#include "nsICrashReporter.h"
#include "mozilla/Preferences.h"
#include <algorithm>
@ -20,7 +18,11 @@
#import <IOKit/IOKitLib.h>
#import <Cocoa/Cocoa.h>
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#endif
using namespace mozilla;
using namespace mozilla::widget;
@ -273,6 +275,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
void
GfxInfo::AddCrashReportAnnotations()
{
#if defined(MOZ_CRASHREPORTER)
nsString deviceID, vendorID, driverVersion;
nsAutoCString narrowDeviceID, narrowVendorID, narrowDriverVersion;
@ -298,6 +301,7 @@ GfxInfo::AddCrashReportAnnotations()
note.AppendLiteral(", AdapterDeviceID: ");
note.Append(narrowDeviceID);
CrashReporter::AppendAppNotesToCrashReport(note);
#endif
}
// We don't support checking driver versions on Mac.

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

@ -19,7 +19,6 @@
#include "mozilla/TouchEvents.h"
#include "nsArrayUtils.h"
#include "nsExceptionHandler.h"
#include "nsObjCExceptions.h"
#include "nsCOMPtr.h"
#include "nsThreadUtils.h"
@ -84,6 +83,9 @@
#include "nsAccessibilityService.h"
#include "mozilla/a11y/Platform.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "mozilla/Preferences.h"
@ -5517,30 +5519,31 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
#if !defined(RELEASE_OR_BETA) || defined(DEBUG)
if (!Preferences::GetBool("intl.allow-insecure-text-input", false) &&
mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) {
#ifdef MOZ_CRASHREPORTER
NSWindow* window = [self window];
NSString* info = [NSString stringWithFormat:@"\nview [%@], window [%@], window is key %i, is fullscreen %i, app is active %i",
self, window, [window isKeyWindow], ([window styleMask] & (1 << 14)) != 0,
[NSApp isActive]];
nsAutoCString additionalInfo([info UTF8String]);
#endif
if (mGeckoChild->GetInputContext().IsPasswordEditor() &&
!TextInputHandler::IsSecureEventInputEnabled()) {
#define CRASH_MESSAGE "A password editor has focus, but not in secure input mode"
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") +
NS_LITERAL_CSTRING(CRASH_MESSAGE));
CrashReporter::AppendAppNotesToCrashReport(additionalInfo);
#endif
MOZ_CRASH(CRASH_MESSAGE);
#undef CRASH_MESSAGE
} else if (!mGeckoChild->GetInputContext().IsPasswordEditor() &&
TextInputHandler::IsSecureEventInputEnabled()) {
#define CRASH_MESSAGE "A non-password editor has focus, but in secure input mode"
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") +
NS_LITERAL_CSTRING(CRASH_MESSAGE));
CrashReporter::AppendAppNotesToCrashReport(additionalInfo);
#endif
MOZ_CRASH(CRASH_MESSAGE);
#undef CRASH_MESSAGE
}

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

@ -6,7 +6,9 @@
#include "base/message_loop.h"
#include "nsBaseAppShell.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
@ -318,14 +320,18 @@ void
nsBaseAppShell::IncrementEventloopNestingLevel()
{
++mEventloopNestingLevel;
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
#endif
}
void
nsBaseAppShell::DecrementEventloopNestingLevel()
{
--mEventloopNestingLevel;
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
#endif
}
// Called from the main thread

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

@ -18,13 +18,15 @@
#include "mozilla/Preferences.h"
#include "mozilla/gfx/DeviceManagerDx.h"
#include "mozilla/gfx/Logging.h"
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#include "nsPrintfCString.h"
#include "jsapi.h"
#include <intrin.h>
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#endif
using namespace mozilla;
using namespace mozilla::gfx;
@ -852,6 +854,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
return NS_OK;
}
#if defined(MOZ_CRASHREPORTER)
/* Cisco's VPN software can cause corruption of the floating point state.
* Make a note of this in our crash reports so that some weird crashes
* make more sense */
@ -866,10 +869,12 @@ CheckForCiscoVPN() {
CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Cisco VPN\n"));
}
}
#endif
void
GfxInfo::AddCrashReportAnnotations()
{
#if defined(MOZ_CRASHREPORTER)
CheckForCiscoVPN();
if (mHasDriverVersionMismatch) {
@ -949,6 +954,8 @@ GfxInfo::AddCrashReportAnnotations()
note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
}
CrashReporter::AppendAppNotesToCrashReport(note);
#endif
}
static OperatingSystem

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

@ -12,7 +12,9 @@
#include "mozilla/TextEvents.h"
#include "nsAlgorithm.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsGkAtoms.h"
#include "nsIIdleServiceInternal.h"
#include "nsIWindowsRegKey.h"
@ -2694,6 +2696,8 @@ NativeKey::NeedsToHandleWithoutFollowingCharMessages() const
return mIsPrintableKey;
}
#ifdef MOZ_CRASHREPORTER
static nsCString
GetResultOfInSendMessageEx()
{
@ -2726,6 +2730,8 @@ GetResultOfInSendMessageEx()
return result;
}
#endif // #ifdef MOZ_CRASHREPORTER
bool
NativeKey::MayBeSameCharMessage(const MSG& aCharMsg1,
const MSG& aCharMsg2) const
@ -2969,6 +2975,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
}
if (doCrash) {
#ifdef MOZ_CRASHREPORTER
nsPrintfCString info("\nPeekMessage() failed to remove char message! "
"\nActive keyboard layout=0x%08X (%s), "
"\nHandling message: %s, InSendMessageEx()=%s, "
@ -2994,7 +3001,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
CrashReporter::AppendAppNotesToCrashReport(
NS_LITERAL_CSTRING("\nThere is no message in any window"));
}
#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("We lost the following char message");
}
@ -3113,6 +3120,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
"nextKeyMsg=%s, kFoundCharMsg=%s",
this, ToString(removedMsg).get(), ToString(nextKeyMsg).get(),
ToString(kFoundCharMsg).get()));
#ifdef MOZ_CRASHREPORTER
nsPrintfCString info("\nPeekMessage() removed unexpcted char message! "
"\nActive keyboard layout=0x%08X (%s), "
"\nHandling message: %s, InSendMessageEx()=%s, "
@ -3150,13 +3158,14 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
CrashReporter::AppendAppNotesToCrashReport(
NS_LITERAL_CSTRING("\nThere is no key message in any windows."));
}
#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("PeekMessage() removed unexpected message");
}
MOZ_LOG(sNativeKeyLogger, LogLevel::Error,
("%p NativeKey::GetFollowingCharMessage(), FAILED, removed messages "
"are all WM_NULL, nextKeyMsg=%s",
this, ToString(nextKeyMsg).get()));
#ifdef MOZ_CRASHREPORTER
nsPrintfCString info("\nWe lost following char message! "
"\nActive keyboard layout=0x%08X (%s), "
"\nHandling message: %s, InSendMessageEx()=%s, \n"
@ -3167,6 +3176,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
GetResultOfInSendMessageEx().get(),
ToString(kFoundCharMsg).get());
CrashReporter::AppendAppNotesToCrashReport(info);
#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("We lost the following char message");
return false;
}

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

@ -42,7 +42,6 @@ UNIFIED_SOURCES += [
'InProcessWinCompositorWidget.cpp',
'JumpListItem.cpp',
'KeyboardLayout.cpp',
'LSPAnnotator.cpp',
'nsAppShell.cpp',
'nsClipboard.cpp',
'nsColorPicker.cpp',
@ -88,6 +87,11 @@ SOURCES += [
'WinMouseScrollHandler.cpp',
]
if CONFIG['MOZ_CRASHREPORTER']:
UNIFIED_SOURCES += [
'LSPAnnotator.cpp',
]
if CONFIG['NS_PRINTING']:
UNIFIED_SOURCES += [
'nsDeviceContextSpecWin.cpp',

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

@ -164,7 +164,9 @@ nsAppShell::~nsAppShell()
nsresult
nsAppShell::Init()
{
#ifdef MOZ_CRASHREPORTER
LSPAnnotate();
#endif
mLastNativeEventScheduled = TimeStamp::NowLoRes();

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

@ -37,6 +37,10 @@
#include "nsWrapperCache.h"
#include "nsStringBuffer.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"

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

@ -81,7 +81,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollector.h"
#include "nsDOMJSUtils.h"
#include "nsExceptionHandler.h"
#include "nsJSUtils.h"
#include "nsWrapperCache.h"
#include "nsStringBuffer.h"
@ -91,6 +90,10 @@
#include "ProfilerMarkerPayload.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"
@ -542,9 +545,10 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSContext* aCx)
JS_SetExternalStringSizeofCallback(aCx, SizeofExternalStringCallback);
JS::SetBuildIdOp(aCx, GetBuildId);
JS::SetWarningReporter(aCx, MozCrashWarningReporter);
js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
CrashReporter::AnnotateOOMAllocationSize);
#ifdef MOZ_CRASHREPORTER
js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
CrashReporter::AnnotateOOMAllocationSize);
#endif
static js::DOMCallbacks DOMcallbacks = {
InstanceClassHasProtoAtDepth
@ -1443,6 +1447,7 @@ CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
OOMState aNewState)
{
*aStatePtr = aNewState;
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
? NS_LITERAL_CSTRING("JSOutOfMemory")
: NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
@ -1451,6 +1456,7 @@ CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
: aNewState == OOMState::Reported
? NS_LITERAL_CSTRING("Reported")
: NS_LITERAL_CSTRING("Recovered"));
#endif
}
void
@ -1463,12 +1469,14 @@ CycleCollectedJSRuntime::OnGC(JSContext* aContext,
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. Normally we do this
// incrementally for an incremental GC, and immediately for a

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

@ -6,21 +6,24 @@
#include "nsCrashOnException.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.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;
}

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

@ -167,7 +167,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollectionNoteRootCallback.h"
#include "nsDeque.h"
#include "nsExceptionHandler.h"
#include "nsCycleCollector.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
@ -192,6 +191,10 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThreadLocal.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
struct NurseryPurpleBufferEntry
@ -665,12 +668,14 @@ PtrInfo::AnnotatedReleaseAssert(bool aCondition, const char* aMessage)
return;
}
#ifdef MOZ_CRASHREPORTER
const char* piName = "Unknown";
if (mParticipant) {
piName = mParticipant->ClassName();
}
nsPrintfCString msg("%s, for class %s", aMessage, piName);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
#endif
MOZ_CRASH();
}

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

@ -13,7 +13,9 @@
#include "MainThreadUtils.h"
#include "nsDebugImpl.h"
#include "nsDebug.h"
#include "nsExceptionHandler.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "prprf.h"
@ -390,6 +392,7 @@ 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.
@ -403,6 +406,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
nsDependentCString(nonPIDBuf.buffer));
}
#endif // MOZ_CRASHREPORTER
#if defined(DEBUG) && defined(_WIN32)
RealBreak();
@ -610,6 +614,8 @@ NS_ErrorAccordingToNSPR()
void
NS_ABORT_OOM(size_t aSize)
{
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateOOMAllocationSize(aSize);
#endif
MOZ_CRASH("OOM");
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше