Bug 541076 - add minidump id and plugin name to PluginCrashed event. p=ted+dolske, r=jst, r=ted

This commit is contained in:
Ted Mielczarek
2010-02-09 17:05:31 -08:00
parent 6bc188d3fa
commit 63191b3db1
8 changed files with 198 additions and 15 deletions

View File

@@ -50,6 +50,24 @@ using namespace mozilla::plugins;
PR_STATIC_ASSERT(sizeof(NPIdentifier) == sizeof(void*));
class PluginCrashed : public nsRunnable
{
public:
PluginCrashed(nsNPAPIPlugin* plugin,
const nsString& dumpID)
: mDumpID(dumpID),
mPlugin(plugin) { }
NS_IMETHOD Run() {
mPlugin->PluginCrashed(mDumpID);
return NS_OK;
}
private:
nsNPAPIPlugin* mPlugin;
nsString mDumpID;
};
// static
PluginLibrary*
PluginModuleParent::LoadModule(const char* aFilePath)
@@ -160,8 +178,13 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
switch (why) {
case AbnormalShutdown: {
nsCOMPtr<nsIFile> dump;
nsAutoString dumpID;
if (GetMinidump(getter_AddRefs(dump))) {
WriteExtraDataForMinidump(dump);
if (NS_SUCCEEDED(dump->GetLeafName(dumpID))) {
dumpID.Replace(dumpID.Length() - 4, 4,
NS_LITERAL_STRING(""));
}
}
else {
NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
@@ -172,8 +195,7 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
// and potentially modify the actor child list while enumerating it.
if (mPlugin) {
nsCOMPtr<nsIRunnable> r =
new nsRunnableMethod<nsNPAPIPlugin>(
mPlugin, &nsNPAPIPlugin::PluginCrashed);
new PluginCrashed(mPlugin, dumpID);
NS_DispatchToMainThread(r);
}
break;