Back out bug 581341 due to too many intermittent failures.
This commit is contained in:
@@ -260,9 +260,8 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||
Open(aChannel, aParentHandle, aIOLoop);
|
||||
sSingleton = this;
|
||||
|
||||
CrashReporterChild::CreateCrashReporter(this);
|
||||
#if defined(ANDROID) && defined(MOZ_CRASHREPORTER)
|
||||
PCrashReporterChild* crashreporter = ManagedPCrashReporterChild()[0];
|
||||
PCrashReporterChild* crashreporter = SendPCrashReporterConstructor();
|
||||
InfallibleTArray<Mapping> mappings;
|
||||
const struct mapping_info *info = getLibraryMapping();
|
||||
while (info && info->name) {
|
||||
@@ -364,14 +363,9 @@ ContentChild::DeallocPBrowser(PBrowserChild* iframe)
|
||||
}
|
||||
|
||||
PCrashReporterChild*
|
||||
ContentChild::AllocPCrashReporter(const NativeThreadId& tid,
|
||||
const PRUint32& processType)
|
||||
ContentChild::AllocPCrashReporter()
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
return new CrashReporterChild();
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -80,11 +80,8 @@ public:
|
||||
virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags);
|
||||
virtual bool DeallocPBrowser(PBrowserChild*);
|
||||
|
||||
virtual PCrashReporterChild*
|
||||
AllocPCrashReporter(const NativeThreadId& id,
|
||||
const PRUint32& processType);
|
||||
virtual bool
|
||||
DeallocPCrashReporter(PCrashReporterChild*);
|
||||
virtual PCrashReporterChild* AllocPCrashReporter();
|
||||
virtual bool DeallocPCrashReporter(PCrashReporterChild*);
|
||||
|
||||
virtual PMemoryReportRequestChild*
|
||||
AllocPMemoryReportRequest();
|
||||
|
||||
@@ -290,13 +290,27 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), PR_TRUE);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporterParent* crashReporter =
|
||||
static_cast<CrashReporterParent*>(ManagedPCrashReporterParent()[0]);
|
||||
nsAutoString dumpID;
|
||||
|
||||
crashReporter->GenerateCrashReport(this, NULL);
|
||||
nsCOMPtr<nsILocalFile> crashDump;
|
||||
TakeMinidump(getter_AddRefs(crashDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(crashDump, dumpID);
|
||||
|
||||
nsAutoString dumpID(crashReporter->ChildDumpID());
|
||||
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
|
||||
|
||||
if (!dumpID.IsEmpty()) {
|
||||
CrashReporter::AnnotationTable notes;
|
||||
notes.Init();
|
||||
notes.Put(NS_LITERAL_CSTRING("ProcessType"), NS_LITERAL_CSTRING("content"));
|
||||
|
||||
char startTime[32];
|
||||
sprintf(startTime, "%lld", static_cast<PRInt64>(mProcessStartTime));
|
||||
notes.Put(NS_LITERAL_CSTRING("StartupTime"),
|
||||
nsDependentCString(startTime));
|
||||
|
||||
// TODO: Additional per-process annotations.
|
||||
CrashReporter::AppendExtraData(dumpID, notes);
|
||||
}
|
||||
#endif
|
||||
|
||||
obs->NotifyObservers((nsIPropertyBag2*) props, "ipc:content-shutdown", nsnull);
|
||||
@@ -327,19 +341,12 @@ ContentParent::DestroyTestShell(TestShellParent* aTestShell)
|
||||
return PTestShellParent::Send__delete__(aTestShell);
|
||||
}
|
||||
|
||||
TestShellParent*
|
||||
ContentParent::GetTestShellSingleton()
|
||||
{
|
||||
if (!ManagedPTestShellParent().Length())
|
||||
return nsnull;
|
||||
return static_cast<TestShellParent*>(ManagedPTestShellParent()[0]);
|
||||
}
|
||||
|
||||
ContentParent::ContentParent()
|
||||
: mGeolocationWatchID(-1)
|
||||
, mRunToCompletionDepth(0)
|
||||
, mShouldCallUnblockChild(false)
|
||||
, mIsAlive(true)
|
||||
, mProcessStartTime(time(NULL))
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
|
||||
@@ -672,14 +679,9 @@ ContentParent::DeallocPBrowser(PBrowserParent* frame)
|
||||
}
|
||||
|
||||
PCrashReporterParent*
|
||||
ContentParent::AllocPCrashReporter(const NativeThreadId& tid,
|
||||
const PRUint32& processType)
|
||||
ContentParent::AllocPCrashReporter()
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
return new CrashReporterParent(tid, processType);
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
return new CrashReporterParent();
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -94,7 +94,6 @@ public:
|
||||
|
||||
TestShellParent* CreateTestShell();
|
||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||
TestShellParent* GetTestShellSingleton();
|
||||
|
||||
void ReportChildAlreadyBlocked();
|
||||
bool RequestRunToCompletion();
|
||||
@@ -103,10 +102,6 @@ public:
|
||||
|
||||
void SetChildMemoryReporters(const InfallibleTArray<MemoryReport>& report);
|
||||
|
||||
GeckoChildProcessHost* Process() {
|
||||
return mSubprocess;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnChannelConnected(int32 pid);
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
@@ -127,8 +122,7 @@ private:
|
||||
virtual PBrowserParent* AllocPBrowser(const PRUint32& aChromeFlags);
|
||||
virtual bool DeallocPBrowser(PBrowserParent* frame);
|
||||
|
||||
virtual PCrashReporterParent* AllocPCrashReporter(const NativeThreadId& tid,
|
||||
const PRUint32& processType);
|
||||
virtual PCrashReporterParent* AllocPCrashReporter();
|
||||
virtual bool DeallocPCrashReporter(PCrashReporterParent* crashreporter);
|
||||
|
||||
virtual PMemoryReportRequestParent* AllocPMemoryReportRequest();
|
||||
@@ -234,8 +228,7 @@ private:
|
||||
|
||||
bool mIsAlive;
|
||||
nsCOMPtr<nsIPrefServiceInternal> mPrefService;
|
||||
|
||||
friend class CrashReporterParent;
|
||||
time_t mProcessStartTime;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: set sw=4 ts=8 et tw=80 :
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Crash Reporter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Matthews <josh@joshmatthews.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "mozilla/plugins/PluginModuleChild.h"
|
||||
#include "ContentChild.h"
|
||||
#include "CrashReporterChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
using mozilla::plugins::PluginModuleChild;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/*static*/
|
||||
PCrashReporterChild*
|
||||
CrashReporterChild::GetCrashReporter()
|
||||
{
|
||||
switch (XRE_GetProcessType()) {
|
||||
case GeckoProcessType_Content: {
|
||||
ContentChild* child = ContentChild::GetSingleton();
|
||||
return child->ManagedPCrashReporterChild()[0];
|
||||
}
|
||||
case GeckoProcessType_Plugin: {
|
||||
PluginModuleChild* child = PluginModuleChild::current();
|
||||
return child->ManagedPCrashReporterChild()[0];
|
||||
}
|
||||
default:
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "mozilla/dom/PCrashReporterChild.h"
|
||||
#include "mozilla/Util.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -50,22 +45,10 @@ class CrashReporterChild :
|
||||
{
|
||||
public:
|
||||
CrashReporterChild() {
|
||||
MOZ_COUNT_CTOR(CrashReporterChild);
|
||||
MOZ_COUNT_CTOR(CrashReporterChild);
|
||||
}
|
||||
~CrashReporterChild() {
|
||||
MOZ_COUNT_DTOR(CrashReporterChild);
|
||||
}
|
||||
|
||||
static PCrashReporterChild* GetCrashReporter();
|
||||
|
||||
template<class Toplevel>
|
||||
static void CreateCrashReporter(Toplevel* actor) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
MOZ_ASSERT(actor->ManagedPCrashReporterChild().Length() == 0);
|
||||
actor->SendPCrashReporterConstructor(
|
||||
CrashReporter::CurrentThreadId(),
|
||||
XRE_GetProcessType());
|
||||
#endif
|
||||
virtual ~CrashReporterChild() {
|
||||
MOZ_COUNT_DTOR(CrashReporterChild);
|
||||
}
|
||||
};
|
||||
} // namespace dom
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "CrashReporterParent.h"
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
|
||||
#include "base/process_util.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
using namespace base;
|
||||
|
||||
namespace mozilla {
|
||||
@@ -72,34 +73,9 @@ CrashReporterParent::RecvAddLibraryMappings(const InfallibleTArray<Mapping>& map
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CrashReporterParent::RecvAnnotateCrashReport(const nsCString& key,
|
||||
const nsCString& data)
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
mNotes.Put(key, data);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CrashReporterParent::RecvAppendAppNotes(const nsCString& data)
|
||||
{
|
||||
mAppNotes.Append(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
CrashReporterParent::CrashReporterParent(const NativeThreadId& tid,
|
||||
const PRUint32& processType)
|
||||
: mMainThread(tid)
|
||||
, mStartTime(time(NULL))
|
||||
, mProcessType(processType)
|
||||
CrashReporterParent::CrashReporterParent()
|
||||
{
|
||||
MOZ_COUNT_CTOR(CrashReporterParent);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
mNotes.Init(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
CrashReporterParent::~CrashReporterParent()
|
||||
@@ -107,56 +83,5 @@ CrashReporterParent::~CrashReporterParent()
|
||||
MOZ_COUNT_DTOR(CrashReporterParent);
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
bool
|
||||
CrashReporterParent::GenerateHangCrashReport(const AnnotationTable* processNotes)
|
||||
{
|
||||
if (mChildDumpID.IsEmpty())
|
||||
return false;
|
||||
|
||||
GenerateChildData(processNotes);
|
||||
|
||||
CrashReporter::AnnotationTable notes;
|
||||
if (!notes.Init(4))
|
||||
return false;
|
||||
notes.Put(nsDependentCString("HangID"), NS_ConvertUTF16toUTF8(mHangID));
|
||||
if (!CrashReporter::AppendExtraData(mParentDumpID, notes))
|
||||
NS_WARNING("problem appending parent data to .extra");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
||||
{
|
||||
nsCAutoString type;
|
||||
switch (mProcessType) {
|
||||
case GeckoProcessType_Content:
|
||||
type = NS_LITERAL_CSTRING("content");
|
||||
break;
|
||||
case GeckoProcessType_Plugin:
|
||||
type = NS_LITERAL_CSTRING("plugin");
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("unknown process type");
|
||||
break;
|
||||
}
|
||||
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
|
||||
|
||||
char startTime[32];
|
||||
sprintf(startTime, "%lld", static_cast<PRInt64>(mStartTime));
|
||||
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
|
||||
|
||||
if (!mAppNotes.IsEmpty())
|
||||
mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);
|
||||
|
||||
bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
|
||||
if (ret && processNotes)
|
||||
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
|
||||
if (!ret)
|
||||
NS_WARNING("problem appending child data to .extra");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set sw=4 ts=8 et tw=80 :
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
@@ -37,134 +37,21 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "mozilla/dom/PCrashReporterParent.h"
|
||||
#include "mozilla/dom/TabMessageUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsILocalFile.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class ProcessReporter;
|
||||
|
||||
class CrashReporterParent :
|
||||
public PCrashReporterParent
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
typedef CrashReporter::AnnotationTable AnnotationTable;
|
||||
#endif
|
||||
public:
|
||||
CrashReporterParent(const NativeThreadId& tid, const PRUint32& processType);
|
||||
virtual ~CrashReporterParent();
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
/* Attempt to generate a parent/child pair of minidumps from the given
|
||||
toplevel actor in the event of a hang. Returns true if successful,
|
||||
false otherwise.
|
||||
*/
|
||||
template<class Toplevel>
|
||||
bool
|
||||
GeneratePairedMinidump(Toplevel* t);
|
||||
|
||||
/* Attempt to create a bare-bones crash report for a hang, along with extra
|
||||
process-specific annotations present in the given AnnotationTable. Returns
|
||||
true if successful, false otherwise.
|
||||
*/
|
||||
bool
|
||||
GenerateHangCrashReport(const AnnotationTable* processNotes);
|
||||
|
||||
/* Attempt to create a bare-bones crash report, along with extra process-
|
||||
specific annotations present in the given AnnotationTable. Returns true if
|
||||
successful, false otherwise.
|
||||
*/
|
||||
template<class Toplevel>
|
||||
bool
|
||||
GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes);
|
||||
#endif
|
||||
|
||||
/* Returns the shared hang ID of a parent/child paired minidump.
|
||||
GeneratePairedMinidump must be called first.
|
||||
*/
|
||||
const nsString& HangID() {
|
||||
return mHangID;
|
||||
}
|
||||
/* Returns the ID of the parent minidump.
|
||||
GeneratePairedMinidump must be called first.
|
||||
*/
|
||||
const nsString& ParentDumpID() {
|
||||
return mParentDumpID;
|
||||
}
|
||||
/* Returns the ID of the child minidump.
|
||||
GeneratePairedMinidump or GenerateCrashReport must be called first.
|
||||
*/
|
||||
const nsString& ChildDumpID() {
|
||||
return mChildDumpID;
|
||||
}
|
||||
CrashReporterParent();
|
||||
virtual ~CrashReporterParent();
|
||||
|
||||
protected:
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
virtual bool
|
||||
RecvAddLibraryMappings(const InfallibleTArray<Mapping>& m);
|
||||
virtual bool
|
||||
RecvAnnotateCrashReport(const nsCString& key, const nsCString& data);
|
||||
virtual bool
|
||||
RecvAppendAppNotes(const nsCString& data);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
bool
|
||||
GenerateChildData(const AnnotationTable* processNotes);
|
||||
|
||||
CrashReporter::AnnotationTable mNotes;
|
||||
#endif
|
||||
nsCString mAppNotes;
|
||||
nsString mHangID;
|
||||
nsString mChildDumpID;
|
||||
nsString mParentDumpID;
|
||||
NativeThreadId mMainThread;
|
||||
time_t mStartTime;
|
||||
PRUint32 mProcessType;
|
||||
};
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
template<class Toplevel>
|
||||
inline bool
|
||||
CrashReporterParent::GeneratePairedMinidump(Toplevel* t)
|
||||
{
|
||||
CrashReporter::ProcessHandle child;
|
||||
#ifdef XP_MACOSX
|
||||
child = t->Process()->GetChildTask();
|
||||
#else
|
||||
child = t->OtherProcess();
|
||||
#endif
|
||||
nsCOMPtr<nsILocalFile> childDump;
|
||||
nsCOMPtr<nsILocalFile> parentDump;
|
||||
if (CrashReporter::CreatePairedMinidumps(child,
|
||||
mMainThread,
|
||||
&mHangID,
|
||||
getter_AddRefs(childDump),
|
||||
getter_AddRefs(parentDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(childDump, mChildDumpID) &&
|
||||
CrashReporter::GetIDFromMinidump(parentDump, mParentDumpID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Toplevel>
|
||||
inline bool
|
||||
CrashReporterParent::GenerateCrashReport(Toplevel* t,
|
||||
const AnnotationTable* processNotes)
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> crashDump;
|
||||
if (t->TakeMinidump(getter_AddRefs(crashDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) {
|
||||
return GenerateChildData(processNotes);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -63,7 +63,6 @@ EXPORTS_mozilla/dom = \
|
||||
CrashReporterParent.h \
|
||||
TabParent.h \
|
||||
TabChild.h \
|
||||
TabMessageUtils.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
@@ -71,7 +70,6 @@ CPPSRCS = \
|
||||
ContentParent.cpp \
|
||||
ContentChild.cpp \
|
||||
CrashReporterParent.cpp \
|
||||
CrashReporterChild.cpp \
|
||||
TabParent.cpp \
|
||||
TabChild.cpp \
|
||||
TabMessageUtils.cpp \
|
||||
@@ -88,6 +86,7 @@ CPPSRCS += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -47,7 +47,6 @@ include protocol PMemoryReportRequest;
|
||||
|
||||
include "mozilla/chrome/RegistryMessageUtils.h";
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
|
||||
include "nsGeoPositionIPCSerialiser.h";
|
||||
include "PPrefTuple.h";
|
||||
@@ -61,7 +60,6 @@ using OverrideMapping;
|
||||
using IPC::URI;
|
||||
using IPC::Permission;
|
||||
using mozilla::null_t;
|
||||
using mozilla::dom::NativeThreadId;
|
||||
using gfxIntSize;
|
||||
|
||||
namespace mozilla {
|
||||
@@ -133,7 +131,7 @@ child:
|
||||
|
||||
parent:
|
||||
PNecko();
|
||||
PCrashReporter(NativeThreadId tid, PRUint32 processType);
|
||||
PCrashReporter();
|
||||
|
||||
PStorage(StorageConstructData data);
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol PContent;
|
||||
include protocol PPluginModule;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -52,13 +51,11 @@ struct Mapping {
|
||||
};
|
||||
|
||||
protocol PCrashReporter {
|
||||
manager PContent or PPluginModule;
|
||||
manager PContent;
|
||||
parent:
|
||||
AddLibraryMappings(Mapping[] m);
|
||||
AnnotateCrashReport(nsCString key, nsCString data);
|
||||
AppendAppNotes(nsCString data);
|
||||
__delete__();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,10 +43,6 @@
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct RemoteDOMEvent
|
||||
@@ -57,13 +53,6 @@ struct RemoteDOMEvent
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
mozilla::dom::RemoteDOMEvent* aResult);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
typedef CrashReporter::ThreadId NativeThreadId;
|
||||
#else
|
||||
// unused in this case
|
||||
typedef int32 NativeThreadId;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +78,7 @@ struct ParamTraits<mozilla::dom::RemoteDOMEvent>
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,16 +39,14 @@
|
||||
|
||||
include protocol PPluginIdentifier;
|
||||
include protocol PPluginInstance;
|
||||
include protocol PCrashReporter;
|
||||
|
||||
include "npapi.h";
|
||||
include "mozilla/plugins/PluginMessageUtils.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
|
||||
using NPError;
|
||||
using NPNVariable;
|
||||
using base::FileDescriptor;
|
||||
using mozilla::dom::NativeThreadId;
|
||||
using mozilla::plugins::NativeThreadId;
|
||||
using mac_plugin_interposing::NSCursorInfo;
|
||||
using nsID;
|
||||
|
||||
@@ -59,7 +57,6 @@ rpc protocol PPluginModule
|
||||
{
|
||||
manages PPluginInstance;
|
||||
manages PPluginIdentifier;
|
||||
manages PCrashReporter;
|
||||
|
||||
both:
|
||||
/**
|
||||
@@ -88,7 +85,7 @@ child:
|
||||
|
||||
// Return the plugin's thread ID, if it can be found.
|
||||
rpc NP_Initialize()
|
||||
returns (NPError rv);
|
||||
returns (NativeThreadId tid, NPError rv);
|
||||
|
||||
rpc PPluginInstance(nsCString aMimeType,
|
||||
uint16_t aMode,
|
||||
@@ -141,6 +138,8 @@ parent:
|
||||
// native events, then "livelock" and some other glitches can occur.
|
||||
rpc ProcessSomeEvents();
|
||||
|
||||
sync AppendNotesToCrashReport(nsCString aNotes);
|
||||
|
||||
// OS X Specific calls to manage the plugin's window
|
||||
// when interposing system calls.
|
||||
async PluginShowWindow(uint32_t aWindowId, bool aModal,
|
||||
@@ -148,8 +147,6 @@ parent:
|
||||
size_t aWidth, size_t aHeight);
|
||||
async PluginHideWindow(uint32_t aWindowId);
|
||||
|
||||
async PCrashReporter(NativeThreadId tid, PRUint32 processType);
|
||||
|
||||
// OS X Specific calls to allow the plugin to manage the cursor.
|
||||
async SetCursor(NSCursorInfo cursorInfo);
|
||||
async ShowCursor(bool show);
|
||||
|
||||
@@ -142,6 +142,13 @@ typedef base::SharedMemoryHandle WindowsSharedMemoryHandle;
|
||||
typedef mozilla::null_t WindowsSharedMemoryHandle;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
typedef CrashReporter::ThreadId NativeThreadId;
|
||||
#else
|
||||
// unused in this case
|
||||
typedef int32 NativeThreadId;
|
||||
#endif
|
||||
|
||||
// XXX maybe not the best place for these. better one?
|
||||
|
||||
#define VARSTR(v_) case v_: return #v_
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
#include "mozilla/plugins/BrowserStreamChild.h"
|
||||
#include "mozilla/plugins/PluginStreamChild.h"
|
||||
#include "PluginIdentifierChild.h"
|
||||
#include "mozilla/dom/CrashReporterChild.h"
|
||||
|
||||
#include "nsNPAPIPlugin.h"
|
||||
|
||||
@@ -81,8 +80,6 @@
|
||||
#endif
|
||||
|
||||
using namespace mozilla::plugins;
|
||||
using mozilla::dom::CrashReporterChild;
|
||||
using mozilla::dom::PCrashReporterChild;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
const PRUnichar * kFlashFullscreenClass = L"ShockwaveFlashFullScreen";
|
||||
@@ -266,7 +263,6 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
|
||||
}
|
||||
#endif
|
||||
|
||||
CrashReporterChild::CreateCrashReporter(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -579,6 +575,7 @@ PluginModuleChild::InitGraphics()
|
||||
// Do this after initializing GDK, or GDK will install its own handler.
|
||||
XRE_InstallX11ErrorHandler();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -692,20 +689,6 @@ PluginModuleChild::QuickExit()
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
PCrashReporterChild*
|
||||
PluginModuleChild::AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
|
||||
const PRUint32& processType)
|
||||
{
|
||||
return new CrashReporterChild;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleChild::DeallocPCrashReporter(PCrashReporterChild* actor)
|
||||
{
|
||||
delete actor;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChild::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
@@ -1790,11 +1773,17 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval)
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleChild::AnswerNP_Initialize(NPError* _retval)
|
||||
PluginModuleChild::AnswerNP_Initialize(NativeThreadId* tid, NPError* _retval)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_METHOD;
|
||||
AssertPluginThread();
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
*tid = CrashReporter::CurrentThreadId();
|
||||
#else
|
||||
*tid = 0;
|
||||
#endif
|
||||
|
||||
#ifdef OS_WIN
|
||||
SetEventHooks();
|
||||
#endif
|
||||
|
||||
@@ -91,10 +91,6 @@ typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFun
|
||||
typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PCrashReporterChild;
|
||||
}
|
||||
|
||||
namespace plugins {
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
@@ -107,8 +103,6 @@ class PluginInstanceChild;
|
||||
|
||||
class PluginModuleChild : public PPluginModuleChild
|
||||
{
|
||||
typedef mozilla::dom::PCrashReporterChild PCrashReporterChild;
|
||||
|
||||
protected:
|
||||
NS_OVERRIDE
|
||||
virtual mozilla::ipc::RPCChannel::RacyRPCPolicy
|
||||
@@ -119,7 +113,7 @@ protected:
|
||||
|
||||
// Implement the PPluginModuleChild interface
|
||||
virtual bool AnswerNP_GetEntryPoints(NPError* rv);
|
||||
virtual bool AnswerNP_Initialize(NPError* rv);
|
||||
virtual bool AnswerNP_Initialize(NativeThreadId* tid, NPError* rv);
|
||||
|
||||
virtual PPluginIdentifierChild*
|
||||
AllocPPluginIdentifier(const nsCString& aString,
|
||||
@@ -174,12 +168,6 @@ protected:
|
||||
const nsString& aDisplayName,
|
||||
const nsString& aIconPath);
|
||||
|
||||
virtual PCrashReporterChild*
|
||||
AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
|
||||
const PRUint32& processType);
|
||||
virtual bool
|
||||
DeallocPCrashReporter(PCrashReporterChild* actor);
|
||||
|
||||
virtual void
|
||||
ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
|
||||
@@ -56,13 +56,12 @@
|
||||
#include "mozilla/ipc/SyncChannel.h"
|
||||
#include "mozilla/plugins/PluginModuleParent.h"
|
||||
#include "mozilla/plugins/BrowserStreamParent.h"
|
||||
#include "mozilla/dom/PCrashReporterParent.h"
|
||||
#include "PluginIdentifierParent.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCRT.h"
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "mozilla/dom/CrashReporterParent.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
#include "nsNPAPIPlugin.h"
|
||||
#include "nsILocalFile.h"
|
||||
@@ -75,8 +74,6 @@ using base::KillProcess;
|
||||
|
||||
using mozilla::PluginLibrary;
|
||||
using mozilla::ipc::SyncChannel;
|
||||
using mozilla::dom::PCrashReporterParent;
|
||||
using mozilla::dom::CrashReporterParent;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::plugins;
|
||||
@@ -119,11 +116,13 @@ PluginModuleParent::LoadModule(const char* aFilePath)
|
||||
|
||||
PluginModuleParent::PluginModuleParent(const char* aFilePath)
|
||||
: mSubprocess(new PluginProcessParent(aFilePath))
|
||||
, mPluginThread(0)
|
||||
, mShutdown(false)
|
||||
, mClearSiteDataSupported(false)
|
||||
, mGetSitesWithDataSupported(false)
|
||||
, mNPNIface(NULL)
|
||||
, mPlugin(NULL)
|
||||
, mProcessStartTime(time(NULL))
|
||||
, mTaskFactory(this)
|
||||
{
|
||||
NS_ASSERTION(mSubprocess, "Out of memory!");
|
||||
@@ -162,10 +161,20 @@ PluginModuleParent::~PluginModuleParent()
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void
|
||||
PluginModuleParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes)
|
||||
PluginModuleParent::WritePluginExtraDataForMinidump(const nsAString& id)
|
||||
{
|
||||
typedef nsDependentCString CS;
|
||||
|
||||
CrashReporter::AnnotationTable notes;
|
||||
if (!notes.Init(32))
|
||||
return;
|
||||
|
||||
notes.Put(CS("ProcessType"), CS("plugin"));
|
||||
|
||||
char startTime[32];
|
||||
sprintf(startTime, "%lld", static_cast<PRInt64>(mProcessStartTime));
|
||||
notes.Put(CS("StartupTime"), CS(startTime));
|
||||
|
||||
// Get the plugin filename, try to get just the file leafname
|
||||
const std::string& pluginFile = mSubprocess->GetPluginFilePath();
|
||||
size_t filePos = pluginFile.rfind(FILE_PATH_SEPARATOR);
|
||||
@@ -180,12 +189,39 @@ PluginModuleParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& no
|
||||
notes.Put(CS("PluginName"), CS(""));
|
||||
notes.Put(CS("PluginVersion"), CS(""));
|
||||
|
||||
const nsString& hangID = CrashReporter()->HangID();
|
||||
if (!hangID.IsEmpty())
|
||||
notes.Put(CS("HangID"), NS_ConvertUTF16toUTF8(hangID));
|
||||
if (!mCrashNotes.IsEmpty())
|
||||
notes.Put(CS("Notes"), CS(mCrashNotes.get()));
|
||||
|
||||
if (!mHangID.IsEmpty())
|
||||
notes.Put(CS("HangID"), NS_ConvertUTF16toUTF8(mHangID));
|
||||
|
||||
if (!CrashReporter::AppendExtraData(id, notes))
|
||||
NS_WARNING("problem appending plugin data to .extra");
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleParent::WriteExtraDataForHang()
|
||||
{
|
||||
// this writes HangID
|
||||
WritePluginExtraDataForMinidump(mPluginDumpID);
|
||||
|
||||
CrashReporter::AnnotationTable notes;
|
||||
if (!notes.Init(4))
|
||||
return;
|
||||
|
||||
notes.Put(nsDependentCString("HangID"), NS_ConvertUTF16toUTF8(mHangID));
|
||||
if (!CrashReporter::AppendExtraData(mBrowserDumpID, notes))
|
||||
NS_WARNING("problem appending browser data to .extra");
|
||||
}
|
||||
#endif // MOZ_CRASHREPORTER
|
||||
|
||||
bool
|
||||
PluginModuleParent::RecvAppendNotesToCrashReport(const nsCString& aNotes)
|
||||
{
|
||||
mCrashNotes.Append(aNotes);
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
|
||||
{
|
||||
@@ -212,16 +248,29 @@ bool
|
||||
PluginModuleParent::ShouldContinueFromReplyTimeout()
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporterParent* crashReporter = CrashReporter();
|
||||
if (crashReporter->GeneratePairedMinidump(this)) {
|
||||
mBrowserDumpID = crashReporter->ParentDumpID();
|
||||
mPluginDumpID = crashReporter->ChildDumpID();
|
||||
nsCOMPtr<nsILocalFile> pluginDump;
|
||||
nsCOMPtr<nsILocalFile> browserDump;
|
||||
CrashReporter::ProcessHandle child;
|
||||
#ifdef XP_MACOSX
|
||||
child = mSubprocess->GetChildTask();
|
||||
#else
|
||||
child = OtherProcess();
|
||||
#endif
|
||||
if (CrashReporter::CreatePairedMinidumps(child,
|
||||
mPluginThread,
|
||||
&mHangID,
|
||||
getter_AddRefs(pluginDump),
|
||||
getter_AddRefs(browserDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(pluginDump, mPluginDumpID) &&
|
||||
CrashReporter::GetIDFromMinidump(browserDump, mBrowserDumpID)) {
|
||||
|
||||
PLUGIN_LOG_DEBUG(
|
||||
("generated paired browser/plugin minidumps: %s/%s (ID=%s)",
|
||||
NS_ConvertUTF16toUTF8(mBrowserDumpID).get(),
|
||||
NS_ConvertUTF16toUTF8(mPluginDumpID).get(),
|
||||
NS_ConvertUTF16toUTF8(crashReporter->HangID()).get()));
|
||||
} else {
|
||||
("generated paired browser/plugin minidumps: %s/%s (ID=%s)",
|
||||
NS_ConvertUTF16toUTF8(mBrowserDumpID).get(),
|
||||
NS_ConvertUTF16toUTF8(mPluginDumpID).get(),
|
||||
NS_ConvertUTF16toUTF8(mHangID).get()));
|
||||
}
|
||||
else {
|
||||
NS_WARNING("failed to capture paired minidumps from hang");
|
||||
}
|
||||
#endif
|
||||
@@ -239,33 +288,21 @@ PluginModuleParent::ShouldContinueFromReplyTimeout()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporterParent*
|
||||
PluginModuleParent::CrashReporter()
|
||||
{
|
||||
return static_cast<CrashReporterParent*>(ManagedPCrashReporterParent()[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PluginModuleParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
switch (why) {
|
||||
case AbnormalShutdown: {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporterParent* crashReporter = CrashReporter();
|
||||
|
||||
CrashReporter::AnnotationTable notes;
|
||||
notes.Init(4);
|
||||
WriteExtraDataForMinidump(notes);
|
||||
|
||||
if (crashReporter->GenerateCrashReport(this, ¬es)) {
|
||||
mPluginDumpID = crashReporter->ChildDumpID();
|
||||
nsCOMPtr<nsILocalFile> pluginDump;
|
||||
if (TakeMinidump(getter_AddRefs(pluginDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(pluginDump, mPluginDumpID)) {
|
||||
PLUGIN_LOG_DEBUG(("got child minidump: %s",
|
||||
NS_ConvertUTF16toUTF8(mPluginDumpID).get()));
|
||||
WritePluginExtraDataForMinidump(mPluginDumpID);
|
||||
}
|
||||
else if (!mPluginDumpID.IsEmpty() && !mBrowserDumpID.IsEmpty()) {
|
||||
crashReporter->GenerateHangCrashReport(¬es);
|
||||
WriteExtraDataForHang();
|
||||
}
|
||||
else {
|
||||
NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
|
||||
@@ -726,7 +763,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!CallNP_Initialize(error)) {
|
||||
if (!CallNP_Initialize(&mPluginThread, error)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else if (*error != NPERR_NO_ERROR) {
|
||||
@@ -750,7 +787,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!CallNP_Initialize(error))
|
||||
if (!CallNP_Initialize(&mPluginThread, error))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||
@@ -1037,24 +1074,6 @@ PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId)
|
||||
#endif
|
||||
}
|
||||
|
||||
PCrashReporterParent*
|
||||
PluginModuleParent::AllocPCrashReporter(const NativeThreadId& tid,
|
||||
const PRUint32& processType)
|
||||
{
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
return new CrashReporterParent(tid, processType);
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleParent::DeallocPCrashReporter(PCrashReporterParent* actor)
|
||||
{
|
||||
delete actor;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo)
|
||||
{
|
||||
|
||||
@@ -65,11 +65,6 @@
|
||||
#include "nsITimer.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PCrashReporterParent;
|
||||
class CrashReporterParent;
|
||||
}
|
||||
|
||||
namespace plugins {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -90,8 +85,6 @@ class PluginModuleParent : public PPluginModuleParent, PluginLibrary
|
||||
{
|
||||
private:
|
||||
typedef mozilla::PluginLibrary PluginLibrary;
|
||||
typedef mozilla::dom::PCrashReporterParent PCrashReporterParent;
|
||||
typedef mozilla::dom::CrashReporterParent CrashReporterParent;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -191,6 +184,9 @@ protected:
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvProcessNativeEventsInRPCCall();
|
||||
|
||||
virtual bool
|
||||
RecvAppendNotesToCrashReport(const nsCString& aNotes);
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvPluginShowWindow(const uint32_t& aWindowId, const bool& aModal,
|
||||
const int32_t& aX, const int32_t& aY,
|
||||
@@ -199,12 +195,6 @@ protected:
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvPluginHideWindow(const uint32_t& aWindowId);
|
||||
|
||||
NS_OVERRIDE virtual PCrashReporterParent*
|
||||
AllocPCrashReporter(const NativeThreadId& tid,
|
||||
const PRUint32& processType);
|
||||
NS_OVERRIDE virtual bool
|
||||
DeallocPCrashReporter(PCrashReporterParent* actor);
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvSetCursor(const NSCursorInfo& aCursorInfo);
|
||||
|
||||
@@ -300,15 +290,13 @@ private:
|
||||
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
|
||||
|
||||
private:
|
||||
CrashReporterParent* CrashReporter();
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
|
||||
#endif
|
||||
void WritePluginExtraDataForMinidump(const nsAString& id);
|
||||
void WriteExtraDataForHang();
|
||||
void CleanupFromTimeout();
|
||||
static int TimeoutChanged(const char* aPref, void* aModule);
|
||||
void NotifyPluginCrashed();
|
||||
|
||||
nsCString mCrashNotes;
|
||||
PluginProcessParent* mSubprocess;
|
||||
// the plugin thread in mSubprocess
|
||||
NativeThreadId mPluginThread;
|
||||
@@ -318,6 +306,7 @@ private:
|
||||
const NPNetscapeFuncs* mNPNIface;
|
||||
nsDataHashtable<nsVoidPtrHashKey, PluginIdentifierParent*> mIdentifiers;
|
||||
nsNPAPIPlugin* mPlugin;
|
||||
time_t mProcessStartTime;
|
||||
ScopedRunnableMethodFactory<PluginModuleParent> mTaskFactory;
|
||||
nsString mPluginDumpID;
|
||||
nsString mBrowserDumpID;
|
||||
@@ -333,8 +322,6 @@ private:
|
||||
// object instead of the plugin process's lifetime
|
||||
ScopedClose mPluginXSocketFdDup;
|
||||
#endif
|
||||
|
||||
friend class mozilla::dom::CrashReporterParent;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
||||
@@ -175,5 +175,17 @@ PluginProcessChild::CleanUp()
|
||||
nsRegion::ShutdownStatic();
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
PluginProcessChild::AppendNotesToCrashReport(const nsCString& aNotes)
|
||||
{
|
||||
AssertPluginThread();
|
||||
|
||||
PluginProcessChild* p = PluginProcessChild::current();
|
||||
if (p) {
|
||||
p->mPlugin.SendAppendNotesToCrashReport(aNotes);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -61,6 +61,9 @@ public:
|
||||
NS_OVERRIDE virtual bool Init();
|
||||
NS_OVERRIDE virtual void CleanUp();
|
||||
|
||||
// For use on the plugin thread.
|
||||
static void AppendNotesToCrashReport(const nsCString& aNotes);
|
||||
|
||||
protected:
|
||||
static PluginProcessChild* current() {
|
||||
return static_cast<PluginProcessChild*>(ProcessChild::current());
|
||||
|
||||
@@ -146,18 +146,3 @@ TestShellCommandParent::ReleaseCallback()
|
||||
{
|
||||
mCallback.Release();
|
||||
}
|
||||
|
||||
bool
|
||||
TestShellCommandParent::ExecuteCallback(const nsString& aResponse)
|
||||
{
|
||||
return static_cast<TestShellParent*>(Manager())->CommandDone(
|
||||
this, aResponse);
|
||||
}
|
||||
|
||||
void
|
||||
TestShellCommandParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
if (why == AbnormalShutdown) {
|
||||
ExecuteCallback(EmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +92,9 @@ public:
|
||||
void ReleaseCallback();
|
||||
|
||||
protected:
|
||||
bool ExecuteCallback(const nsString& aResponse);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
bool Recv__delete__(const nsString& aResponse) {
|
||||
return ExecuteCallback(aResponse);
|
||||
return static_cast<TestShellParent*>(Manager())->CommandDone(
|
||||
this, aResponse);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -77,9 +77,6 @@ run-if = toolkit == "windows" || toolkit == "cocoa"
|
||||
[include:toolkit/crashreporter/test/unit/xpcshell.ini]
|
||||
skip-if = os == "linux" || !crashreporter
|
||||
|
||||
[include:toolkit/crashreporter/test/unit_ipc/xpcshell.ini]
|
||||
skip-if = os == "linux" || !crashreporter
|
||||
|
||||
#XXX: we don't actually set os = maemo
|
||||
[include:toolkit/crashreporter/client/maemo-unit/xpcshell.ini]
|
||||
run-if = os == "maemo"
|
||||
|
||||
@@ -127,6 +127,4 @@ ifdef ENABLE_TESTS
|
||||
TOOL_DIRS = test
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/dom/CrashReporterChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "nsExceptionHandler.h"
|
||||
|
||||
#if defined(XP_WIN32)
|
||||
@@ -115,8 +112,6 @@ using google_breakpad::CrashGenerationServer;
|
||||
using google_breakpad::ClientInfo;
|
||||
using mozilla::Mutex;
|
||||
using mozilla::MutexAutoLock;
|
||||
using mozilla::dom::CrashReporterChild;
|
||||
using mozilla::dom::PCrashReporterChild;
|
||||
|
||||
namespace CrashReporter {
|
||||
|
||||
@@ -806,7 +801,7 @@ nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
|
||||
|
||||
bool GetEnabled()
|
||||
{
|
||||
return gExceptionHandler != nsnull;
|
||||
return gExceptionHandler != nsnull && !gExceptionHandler->IsOutOfProcess();
|
||||
}
|
||||
|
||||
bool GetMinidumpPath(nsAString& aPath)
|
||||
@@ -1100,9 +1095,11 @@ static PLDHashOperator EnumerateEntries(const nsACString& key,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
EscapeAnnotation(const nsACString& key, nsCString& data)
|
||||
nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data)
|
||||
{
|
||||
if (!GetEnabled())
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (DoFindInReadable(key, NS_LITERAL_CSTRING("=")) ||
|
||||
DoFindInReadable(key, NS_LITERAL_CSTRING("\n")))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@@ -1110,35 +1107,16 @@ EscapeAnnotation(const nsACString& key, nsCString& data)
|
||||
if (DoFindInReadable(data, NS_LITERAL_CSTRING("\0")))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCString escapedData(data);
|
||||
|
||||
// escape backslashes
|
||||
ReplaceChar(data, NS_LITERAL_CSTRING("\\"),
|
||||
ReplaceChar(escapedData, NS_LITERAL_CSTRING("\\"),
|
||||
NS_LITERAL_CSTRING("\\\\"));
|
||||
// escape newlines
|
||||
ReplaceChar(data, NS_LITERAL_CSTRING("\n"),
|
||||
ReplaceChar(escapedData, NS_LITERAL_CSTRING("\n"),
|
||||
NS_LITERAL_CSTRING("\\n"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data)
|
||||
{
|
||||
if (!GetEnabled())
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCString escapedData(data);
|
||||
nsresult rv = EscapeAnnotation(key, escapedData);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
PCrashReporterChild* reporter = CrashReporterChild::GetCrashReporter();
|
||||
if (!reporter)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
if (!reporter->SendAnnotateCrashReport(nsCString(key), escapedData))
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
crashReporterAPIData_Hash->Put(key, escapedData);
|
||||
nsresult rv = crashReporterAPIData_Hash->Put(key, escapedData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// now rebuild the file contents
|
||||
@@ -1157,24 +1135,6 @@ nsresult AppendAppNotesToCrashReport(const nsACString& data)
|
||||
if (DoFindInReadable(data, NS_LITERAL_CSTRING("\0")))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
PCrashReporterChild* reporter = CrashReporterChild::GetCrashReporter();
|
||||
if (!reporter)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// Since we don't go through AnnotateCrashReport in the parent process,
|
||||
// we must ensure that the data is escaped and valid before the parent
|
||||
// sees it.
|
||||
nsCString escapedData(data);
|
||||
nsresult rv = EscapeAnnotation(NS_LITERAL_CSTRING("Notes"), escapedData);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!reporter->SendAppendAppNotes(escapedData))
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
notesField->Append(data);
|
||||
return AnnotateCrashReport(NS_LITERAL_CSTRING("Notes"), *notesField);
|
||||
}
|
||||
@@ -1886,7 +1846,7 @@ SetRemoteExceptionHandler(const nsACString& crashPipe)
|
||||
|
||||
gExceptionHandler = new google_breakpad::
|
||||
ExceptionHandler(L"",
|
||||
FPEFilter,
|
||||
NULL, // no filter callback
|
||||
NULL, // no minidump callback
|
||||
NULL, // no callback context
|
||||
google_breakpad::ExceptionHandler::HANDLER_ALL,
|
||||
|
||||
@@ -44,7 +44,7 @@ relativesrcdir = toolkit/crashreporter/test
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = crashreporter_test
|
||||
XPCSHELL_TESTS = unit unit_ipc
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
LIBRARY_NAME = testcrasher
|
||||
NO_DIST_INSTALL = 1
|
||||
@@ -95,5 +95,4 @@ endif
|
||||
|
||||
libs:: $(SHARED_LIBRARY) $(EXTRA_JS_MODULES)
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit_ipc/
|
||||
|
||||
|
||||
@@ -2,19 +2,11 @@
|
||||
let cwd = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("CurWorkD", Components.interfaces.nsILocalFile);
|
||||
|
||||
let crashReporter =
|
||||
Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
|
||||
.getService(Components.interfaces.nsICrashReporter);
|
||||
|
||||
// the crash reporter is already enabled in content processes,
|
||||
// and setting the minidump path is not allowed
|
||||
let processType = Components.classes["@mozilla.org/xre/runtime;1"].
|
||||
getService(Components.interfaces.nsIXULRuntime).processType;
|
||||
if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
crashReporter.enabled = true;
|
||||
crashReporter.minidumpPath = cwd;
|
||||
}
|
||||
crashReporter.enabled = true;
|
||||
crashReporter.minidumpPath = cwd;
|
||||
|
||||
let ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
||||
@@ -65,11 +65,6 @@ function do_crash(setup, callback, canReturnZero)
|
||||
do_check_neq(process.exitValue, 0);
|
||||
}
|
||||
|
||||
handleMinidump(callback);
|
||||
}
|
||||
|
||||
function handleMinidump(callback)
|
||||
{
|
||||
// find minidump
|
||||
let minidump = null;
|
||||
let en = do_get_cwd().directoryEntries;
|
||||
@@ -106,44 +101,6 @@ function handleMinidump(callback)
|
||||
extrafile.remove(false);
|
||||
}
|
||||
|
||||
function do_content_crash(setup, callback)
|
||||
{
|
||||
do_load_child_test_harness();
|
||||
do_test_pending();
|
||||
|
||||
// Setting the minidump path won't work in the child, so we need to do
|
||||
// that here.
|
||||
let crashReporter =
|
||||
Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
|
||||
.getService(Components.interfaces.nsICrashReporter);
|
||||
crashReporter.minidumpPath = do_get_cwd();
|
||||
|
||||
let headfile = do_get_file("../unit/crasher_subprocess_head.js");
|
||||
let tailfile = do_get_file("../unit/crasher_subprocess_tail.js");
|
||||
if (setup) {
|
||||
if (typeof(setup) == "function")
|
||||
// funky, but convenient
|
||||
setup = "("+setup.toSource()+")();";
|
||||
}
|
||||
|
||||
let handleCrash = function() {
|
||||
try {
|
||||
handleMinidump(callback);
|
||||
} catch (x) {
|
||||
do_report_unexpected_exception(x);
|
||||
}
|
||||
do_test_finished();
|
||||
};
|
||||
|
||||
sendCommand("load(\"" + headfile.path.replace(/\\/g, "/") + "\");", function()
|
||||
sendCommand(setup, function()
|
||||
sendCommand("load(\"" + tailfile.path.replace(/\\/g, "/") + "\");",
|
||||
function() do_execute_soon(handleCrash)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Utility functions for parsing .extra files
|
||||
function parseKeyValuePairs(text) {
|
||||
var lines = text.split('\n');
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
load("../unit/head_crashreporter.js");
|
||||
|
||||
function run_test()
|
||||
{
|
||||
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
|
||||
dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Try crashing with a pure virtual call
|
||||
do_content_crash(function() {
|
||||
crashType = CrashTestUtils.CRASH_RUNTIMEABORT;
|
||||
crashReporter.annotateCrashReport("TestKey", "TestValue");
|
||||
crashReporter.appendAppNotesToCrashReport("!!!foo!!!");
|
||||
},
|
||||
function(mdump, extra) {
|
||||
do_check_eq(extra.TestKey, "TestValue");
|
||||
do_check_true('StartupTime' in extra);
|
||||
do_check_true('ProcessType' in extra);
|
||||
do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1);
|
||||
});
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
[DEFAULT]
|
||||
head = head_crashreporter.js
|
||||
tail =
|
||||
|
||||
[test_content_annotation.js]
|
||||
@@ -359,9 +359,7 @@ XRE_InitChildProcess(int aArgc,
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
SetupErrorHandling(aArgv[0]);
|
||||
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (aArgc < 1)
|
||||
return 1;
|
||||
@@ -388,6 +386,8 @@ XRE_InitChildProcess(int aArgc,
|
||||
gArgv = aArgv;
|
||||
gArgc = aArgc;
|
||||
|
||||
SetupErrorHandling(aArgv[0]);
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
@@ -706,18 +706,16 @@ XRE_ShutdownChildProcess()
|
||||
}
|
||||
|
||||
namespace {
|
||||
TestShellParent* gTestShellParent = nsnull;
|
||||
TestShellParent* GetOrCreateTestShellParent()
|
||||
{
|
||||
ContentParent* parent = ContentParent::GetSingleton();
|
||||
if (!parent) {
|
||||
return nsnull;
|
||||
if (!gTestShellParent) {
|
||||
ContentParent* parent = ContentParent::GetSingleton();
|
||||
NS_ENSURE_TRUE(parent, nsnull);
|
||||
gTestShellParent = parent->CreateTestShell();
|
||||
NS_ENSURE_TRUE(gTestShellParent, nsnull);
|
||||
}
|
||||
TestShellParent* testShell = parent->GetTestShellSingleton();
|
||||
if (testShell) {
|
||||
return testShell;
|
||||
}
|
||||
testShell = parent->CreateTestShell();
|
||||
return testShell;
|
||||
return gTestShellParent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,11 +754,9 @@ XRE_GetChildGlobalObject(JSContext* aCx, JSObject** aGlobalP)
|
||||
bool
|
||||
XRE_ShutdownTestShell()
|
||||
{
|
||||
ContentParent* cp = ContentParent::GetSingleton(PR_FALSE);
|
||||
TestShellParent* tsp = cp ? cp->GetTestShellSingleton() : nsnull;
|
||||
if (!tsp)
|
||||
if (!gTestShellParent)
|
||||
return true;
|
||||
return cp->DestroyTestShell(tsp);
|
||||
return ContentParent::GetSingleton()->DestroyTestShell(gTestShellParent);
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
#include "nsX11ErrorHandler.h"
|
||||
|
||||
#include "mozilla/plugins/PluginProcessChild.h"
|
||||
using mozilla::plugins::PluginProcessChild;
|
||||
|
||||
#include "prenv.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
@@ -153,10 +156,16 @@ X11Error(Display *display, XErrorEvent *event) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
switch (XRE_GetProcessType()) {
|
||||
case GeckoProcessType_Default:
|
||||
case GeckoProcessType_Plugin:
|
||||
case GeckoProcessType_Content:
|
||||
CrashReporter::AppendAppNotesToCrashReport(notes);
|
||||
break;
|
||||
case GeckoProcessType_Plugin:
|
||||
if (CrashReporter::GetEnabled()) {
|
||||
// This is assuming that X operations are performed on the plugin
|
||||
// thread. If plugins are using X on another thread, then we'll need to
|
||||
// handle that differently.
|
||||
PluginProcessChild::AppendNotesToCrashReport(notes);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
; // crash report notes not supported.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user