mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +09:00
Remove base conditional code for crash reporter and injector.
This commit is contained in:
parent
87fa26d31e
commit
434f3590e3
131 changed files with 39 additions and 4139 deletions
|
|
@ -29,12 +29,6 @@
|
|||
using mozilla::dom::CrashReporterParent;
|
||||
using mozilla::ipc::GeckoChildProcessHost;
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsPrintfCString.h"
|
||||
using CrashReporter::AnnotationTable;
|
||||
using CrashReporter::GetIDFromMinidump;
|
||||
#endif
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
|
@ -224,10 +218,6 @@ GMPParent::AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure)
|
|||
NS_WARNING("Timed out waiting for GMP async shutdown!");
|
||||
GMPParent* parent = reinterpret_cast<GMPParent*>(aClosure);
|
||||
MOZ_ASSERT(parent->mService);
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
parent->mService->SetAsyncShutdownPluginState(parent, 'G',
|
||||
NS_LITERAL_CSTRING("Timed out waiting for async shutdown"));
|
||||
#endif
|
||||
parent->mService->AsyncShutdownComplete(parent);
|
||||
}
|
||||
|
||||
|
|
@ -270,22 +260,8 @@ GMPParent::RecvPGMPContentChildDestroyed()
|
|||
{
|
||||
--mGMPContentChildCount;
|
||||
if (!IsUsed()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'E',
|
||||
NS_LITERAL_CSTRING("Last content child destroyed"));
|
||||
}
|
||||
#endif
|
||||
CloseIfUnused();
|
||||
}
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
else {
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'F',
|
||||
nsPrintfCString("Content child destroyed, remaining: %u", mGMPContentChildCount));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -307,38 +283,14 @@ GMPParent::CloseIfUnused()
|
|||
if (mAsyncShutdownRequired) {
|
||||
if (!mAsyncShutdownInProgress) {
|
||||
LOGD("%s: sending async shutdown notification", __FUNCTION__);
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'H',
|
||||
NS_LITERAL_CSTRING("Sent BeginAsyncShutdown"));
|
||||
}
|
||||
#endif
|
||||
mAsyncShutdownInProgress = true;
|
||||
if (!SendBeginAsyncShutdown()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'I',
|
||||
NS_LITERAL_CSTRING("Could not send BeginAsyncShutdown - Aborting async shutdown"));
|
||||
}
|
||||
#endif
|
||||
AbortAsyncShutdown();
|
||||
} else if (NS_FAILED(EnsureAsyncShutdownTimeoutSet())) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'J',
|
||||
NS_LITERAL_CSTRING("Could not start timer after sending BeginAsyncShutdown - Aborting async shutdown"));
|
||||
}
|
||||
#endif
|
||||
AbortAsyncShutdown();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'K',
|
||||
NS_LITERAL_CSTRING("No (more) async-shutdown required"));
|
||||
}
|
||||
#endif
|
||||
// No async-shutdown, kill async-shutdown timer started in CloseActive().
|
||||
AbortAsyncShutdown();
|
||||
// Any async shutdown must be complete. Shutdown GMPStorage.
|
||||
|
|
@ -385,29 +337,11 @@ GMPParent::CloseActive(bool aDieWhenUnloaded)
|
|||
mState = GMPStateUnloading;
|
||||
}
|
||||
if (mState != GMPStateNotLoaded && IsUsed()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'A',
|
||||
nsPrintfCString("Sent CloseActive, content children to close: %u", mGMPContentChildCount));
|
||||
}
|
||||
#endif
|
||||
if (!SendCloseActive()) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'B',
|
||||
NS_LITERAL_CSTRING("Could not send CloseActive - Aborting async shutdown"));
|
||||
}
|
||||
#endif
|
||||
AbortAsyncShutdown();
|
||||
} else if (IsUsed()) {
|
||||
// We're expecting RecvPGMPContentChildDestroyed's -> Start async-shutdown timer now if needed.
|
||||
if (mAsyncShutdownRequired && NS_FAILED(EnsureAsyncShutdownTimeoutSet())) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'C',
|
||||
NS_LITERAL_CSTRING("Could not start timer after sending CloseActive - Aborting async shutdown"));
|
||||
}
|
||||
#endif
|
||||
AbortAsyncShutdown();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -418,12 +352,6 @@ GMPParent::CloseActive(bool aDieWhenUnloaded)
|
|||
// that time, it might not have proceeded with shutdown; And calling it
|
||||
// again after shutdown is fine because after the first one we'll be in
|
||||
// GMPStateNotLoaded.
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'D',
|
||||
NS_LITERAL_CSTRING("Content children already destroyed"));
|
||||
}
|
||||
#endif
|
||||
CloseIfUnused();
|
||||
}
|
||||
}
|
||||
|
|
@ -630,78 +558,10 @@ GMPParent::EnsureProcessLoaded()
|
|||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void
|
||||
GMPParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes)
|
||||
{
|
||||
notes.Put(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1"));
|
||||
notes.Put(NS_LITERAL_CSTRING("PluginFilename"),
|
||||
NS_ConvertUTF16toUTF8(mName));
|
||||
notes.Put(NS_LITERAL_CSTRING("PluginName"), mDisplayName);
|
||||
notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mVersion);
|
||||
}
|
||||
|
||||
void
|
||||
GMPParent::GetCrashID(nsString& aResult)
|
||||
{
|
||||
CrashReporterParent* cr =
|
||||
static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent()));
|
||||
if (NS_WARN_IF(!cr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AnnotationTable notes(4);
|
||||
WriteExtraDataForMinidump(notes);
|
||||
nsCOMPtr<nsIFile> dumpFile;
|
||||
TakeMinidump(getter_AddRefs(dumpFile), nullptr);
|
||||
if (!dumpFile) {
|
||||
NS_WARNING("GMP crash without crash report");
|
||||
aResult = mName;
|
||||
aResult += '-';
|
||||
AppendUTF8toUTF16(mVersion, aResult);
|
||||
return;
|
||||
}
|
||||
GetIDFromMinidump(dumpFile, aResult);
|
||||
cr->GenerateCrashReportForMinidump(dumpFile, ¬es);
|
||||
}
|
||||
|
||||
static void
|
||||
GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, const nsAString& aPluginDumpID)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIWritablePropertyBag2> propbag =
|
||||
do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
||||
if (obs && propbag) {
|
||||
propbag->SetPropertyAsUint32(NS_LITERAL_STRING("pluginID"), aPluginID);
|
||||
propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"), aPluginName);
|
||||
propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"), aPluginDumpID);
|
||||
obs->NotifyObservers(propbag, "gmp-plugin-crash", nullptr);
|
||||
}
|
||||
|
||||
RefPtr<gmp::GeckoMediaPluginService> service =
|
||||
gmp::GeckoMediaPluginService::GetGeckoMediaPluginService();
|
||||
if (service) {
|
||||
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);
|
||||
nsString dumpID;
|
||||
GetCrashID(dumpID);
|
||||
|
||||
// NotifyObservers is mainthread-only
|
||||
NS_DispatchToMainThread(WrapRunnableNM(&GMPNotifyObservers,
|
||||
mPluginId, mDisplayName, dumpID),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
#endif
|
||||
// warn us off trying to close again
|
||||
mState = GMPStateClosing;
|
||||
mAbnormalShutdownInProgress = true;
|
||||
|
|
@ -711,12 +571,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||
if (AbnormalShutdown == aWhy) {
|
||||
RefPtr<GMPParent> self(this);
|
||||
if (mAsyncShutdownRequired) {
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'M',
|
||||
NS_LITERAL_CSTRING("Actor destroyed"));
|
||||
}
|
||||
#endif
|
||||
mService->AsyncShutdownComplete(this);
|
||||
mAsyncShutdownRequired = false;
|
||||
}
|
||||
|
|
@ -732,9 +586,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||
mozilla::dom::PCrashReporterParent*
|
||||
GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread)
|
||||
{
|
||||
#ifndef MOZ_CRASHREPORTER
|
||||
MOZ_ASSERT(false, "Should only be sent if crash reporting is enabled.");
|
||||
#endif
|
||||
CrashReporterParent* cr = new CrashReporterParent();
|
||||
cr->SetChildData(aThread, GeckoProcessType_GMPlugin);
|
||||
return cr;
|
||||
|
|
@ -1043,12 +895,6 @@ GMPParent::RecvAsyncShutdownComplete()
|
|||
LOGD("%s", __FUNCTION__);
|
||||
|
||||
MOZ_ASSERT(mAsyncShutdownRequired);
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (mService) {
|
||||
mService->SetAsyncShutdownPluginState(this, 'L',
|
||||
NS_LITERAL_CSTRING("Received AsyncShutdownComplete"));
|
||||
}
|
||||
#endif
|
||||
AbortAsyncShutdown();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue