mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 981237 - Remove DataContainerEvent dependency from Plugin crash handler. r=jst,johns
This commit is contained in:
parent
6a5ee8cce4
commit
50eae496d9
@ -1142,15 +1142,16 @@ var gPluginHandler = {
|
|||||||
// plugin in content.
|
// plugin in content.
|
||||||
pluginInstanceCrashed: function (plugin, aEvent) {
|
pluginInstanceCrashed: function (plugin, aEvent) {
|
||||||
// Ensure the plugin and event are of the right type.
|
// Ensure the plugin and event are of the right type.
|
||||||
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent))
|
if (!(aEvent instanceof Ci.nsIDOMCustomEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let submittedReport = aEvent.getData("submittedCrashReport");
|
let propBag = aEvent.detail.QueryInterface(Ci.nsIPropertyBag2);
|
||||||
let doPrompt = true; // XXX followup for .getData("doPrompt");
|
let submittedReport = propBag.getPropertyAsBool("submittedCrashReport");
|
||||||
let submitReports = true; // XXX followup for .getData("submitReports");
|
let doPrompt = true; // XXX followup for .getPropertyAsBool("doPrompt");
|
||||||
let pluginName = aEvent.getData("pluginName");
|
let submitReports = true; // XXX followup for .getPropertyAsBool("submitReports");
|
||||||
let pluginDumpID = aEvent.getData("pluginDumpID");
|
let pluginName = propBag.getPropertyAsAString("pluginName");
|
||||||
let browserDumpID = aEvent.getData("browserDumpID");
|
let pluginDumpID = propBag.getPropertyAsAString("pluginDumpID");
|
||||||
|
let browserDumpID = propBag.getPropertyAsAString("browserDumpID");
|
||||||
|
|
||||||
// Remap the plugin name to a more user-presentable form.
|
// Remap the plugin name to a more user-presentable form.
|
||||||
pluginName = this.makeNicePluginName(pluginName);
|
pluginName = this.makeNicePluginName(pluginName);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMDataContainerEvent.h"
|
#include "nsIDOMCustomEvent.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMHTMLObjectElement.h"
|
#include "nsIDOMHTMLObjectElement.h"
|
||||||
#include "nsIDOMHTMLAppletElement.h"
|
#include "nsIDOMHTMLAppletElement.h"
|
||||||
@ -318,63 +318,52 @@ nsPluginCrashedEvent::Run()
|
|||||||
|
|
||||||
ErrorResult rv;
|
ErrorResult rv;
|
||||||
nsRefPtr<Event> event =
|
nsRefPtr<Event> event =
|
||||||
doc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"), rv);
|
doc->CreateEvent(NS_LITERAL_STRING("customevent"), rv);
|
||||||
nsCOMPtr<nsIDOMDataContainerEvent> containerEvent(do_QueryObject(event));
|
nsCOMPtr<nsIDOMCustomEvent> customEvent(do_QueryObject(event));
|
||||||
if (!containerEvent) {
|
if (!customEvent) {
|
||||||
NS_WARNING("Couldn't QI event for PluginCrashed event!");
|
NS_WARNING("Couldn't QI event for PluginCrashed event!");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), true, true);
|
nsCOMPtr<nsIWritableVariant> variant;
|
||||||
|
variant = do_CreateInstance("@mozilla.org/variant;1");
|
||||||
|
if (!variant) {
|
||||||
|
NS_WARNING("Couldn't create detail variant for PluginCrashed event!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
customEvent->InitCustomEvent(NS_LITERAL_STRING("PluginCrashed"),
|
||||||
|
true, true, variant);
|
||||||
event->SetTrusted(true);
|
event->SetTrusted(true);
|
||||||
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
|
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
|
||||||
|
|
||||||
nsCOMPtr<nsIWritableVariant> variant;
|
nsCOMPtr<nsIWritablePropertyBag2> propBag;
|
||||||
|
propBag = do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
||||||
|
if (!propBag) {
|
||||||
|
NS_WARNING("Couldn't create a property bag for PluginCrashed event!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// add a "pluginDumpID" property to this event
|
// add a "pluginDumpID" property to this event
|
||||||
variant = do_CreateInstance("@mozilla.org/variant;1");
|
propBag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"),
|
||||||
if (!variant) {
|
mPluginDumpID);
|
||||||
NS_WARNING("Couldn't create pluginDumpID variant for PluginCrashed event!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
variant->SetAsAString(mPluginDumpID);
|
|
||||||
containerEvent->SetData(NS_LITERAL_STRING("pluginDumpID"), variant);
|
|
||||||
|
|
||||||
// add a "browserDumpID" property to this event
|
// add a "browserDumpID" property to this event
|
||||||
variant = do_CreateInstance("@mozilla.org/variant;1");
|
propBag->SetPropertyAsAString(NS_LITERAL_STRING("browserDumpID"),
|
||||||
if (!variant) {
|
mBrowserDumpID);
|
||||||
NS_WARNING("Couldn't create browserDumpID variant for PluginCrashed event!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
variant->SetAsAString(mBrowserDumpID);
|
|
||||||
containerEvent->SetData(NS_LITERAL_STRING("browserDumpID"), variant);
|
|
||||||
|
|
||||||
// add a "pluginName" property to this event
|
// add a "pluginName" property to this event
|
||||||
variant = do_CreateInstance("@mozilla.org/variant;1");
|
propBag->SetPropertyAsAString(NS_LITERAL_STRING("pluginName"),
|
||||||
if (!variant) {
|
mPluginName);
|
||||||
NS_WARNING("Couldn't create pluginName variant for PluginCrashed event!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
variant->SetAsAString(mPluginName);
|
|
||||||
containerEvent->SetData(NS_LITERAL_STRING("pluginName"), variant);
|
|
||||||
|
|
||||||
// add a "pluginFilename" property to this event
|
// add a "pluginFilename" property to this event
|
||||||
variant = do_CreateInstance("@mozilla.org/variant;1");
|
propBag->SetPropertyAsAString(NS_LITERAL_STRING("pluginFilename"),
|
||||||
if (!variant) {
|
mPluginFilename);
|
||||||
NS_WARNING("Couldn't create pluginFilename variant for PluginCrashed event!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
variant->SetAsAString(mPluginFilename);
|
|
||||||
containerEvent->SetData(NS_LITERAL_STRING("pluginFilename"), variant);
|
|
||||||
|
|
||||||
// add a "submittedCrashReport" property to this event
|
// add a "submittedCrashReport" property to this event
|
||||||
variant = do_CreateInstance("@mozilla.org/variant;1");
|
propBag->SetPropertyAsBool(NS_LITERAL_STRING("submittedCrashReport"),
|
||||||
if (!variant) {
|
mSubmittedCrashReport);
|
||||||
NS_WARNING("Couldn't create crashSubmit variant for PluginCrashed event!");
|
|
||||||
return NS_OK;
|
variant->SetAsISupports(propBag);
|
||||||
}
|
|
||||||
variant->SetAsBool(mSubmittedCrashReport);
|
|
||||||
containerEvent->SetData(NS_LITERAL_STRING("submittedCrashReport"), variant);
|
|
||||||
|
|
||||||
EventDispatcher::DispatchDOMEvent(mContent, nullptr, event, nullptr, nullptr);
|
EventDispatcher::DispatchDOMEvent(mContent, nullptr, event, nullptr, nullptr);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -92,16 +92,17 @@ function onPluginCrashed(aEvent) {
|
|||||||
var pluginElement = document.getElementById("plugin1");
|
var pluginElement = document.getElementById("plugin1");
|
||||||
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
||||||
|
|
||||||
ok(aEvent instanceof Ci.nsIDOMDataContainerEvent,
|
ok(aEvent instanceof Ci.nsIDOMCustomEvent,
|
||||||
"plugin crashed event has the right interface");
|
"plugin crashed event has the right interface");
|
||||||
|
|
||||||
var minidumpID = aEvent.getData("minidumpID");
|
var propBag = aEvent.detail.QueryInterface(Ci.nsIPropertyBag2);
|
||||||
isnot(minidumpID, "", "got a non-empty dump ID");
|
var pluginDumpID = propBag.getPropertyAsAString("pluginDumpID");
|
||||||
var pluginName = aEvent.getData("pluginName");
|
isnot(pluginDumpID, "", "got a non-empty dump ID");
|
||||||
|
var pluginName = propBag.getPropertyAsAString("pluginName");
|
||||||
is(pluginName, "Test Plug-in", "got correct plugin name");
|
is(pluginName, "Test Plug-in", "got correct plugin name");
|
||||||
var pluginFilename = aEvent.getData("pluginFilename");
|
var pluginFilename = propBag.getPropertyAsAString("pluginFilename");
|
||||||
isnot(pluginFilename, "", "got a non-empty filename");
|
isnot(pluginFilename, "", "got a non-empty filename");
|
||||||
var didReport = aEvent.getData("submittedCrashReport");
|
var didReport = propBag.getPropertyAsBool("submittedCrashReport");
|
||||||
// The app itself may or may not have decided to submit the report, so
|
// The app itself may or may not have decided to submit the report, so
|
||||||
// allow either true or false here.
|
// allow either true or false here.
|
||||||
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
||||||
|
@ -68,16 +68,17 @@ function onPluginCrashed(aEvent) {
|
|||||||
var pluginElement = document.getElementById("plugin1");
|
var pluginElement = document.getElementById("plugin1");
|
||||||
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
||||||
|
|
||||||
ok(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent,
|
ok(aEvent instanceof Components.interfaces.nsIDOMCustomEvent,
|
||||||
"plugin crashed event has the right interface");
|
"plugin crashed event has the right interface");
|
||||||
|
|
||||||
var minidumpID = aEvent.getData("minidumpID");
|
var propBag = aEvent.detail.QueryInterface(Components.interfaces.nsIPropertyBag2);
|
||||||
isnot(minidumpID, "", "got a non-empty dump ID");
|
var pluginDumpID = propBag.getPropertyAsAString("pluginDumpID");
|
||||||
var pluginName = aEvent.getData("pluginName");
|
isnot(pluginDumpID, "", "got a non-empty dump ID");
|
||||||
|
var pluginName = propBag.getPropertyAsAString("pluginName");
|
||||||
is(pluginName, "Test Plug-in", "got correct plugin name");
|
is(pluginName, "Test Plug-in", "got correct plugin name");
|
||||||
var pluginFilename = aEvent.getData("pluginFilename");
|
var pluginFilename = propBag.getPropertyAsAString("pluginFilename");
|
||||||
isnot(pluginFilename, "", "got a non-empty filename");
|
isnot(pluginFilename, "", "got a non-empty filename");
|
||||||
var didReport = aEvent.getData("submittedCrashReport");
|
var didReport = propBag.getPropertyAsBool("submittedCrashReport");
|
||||||
// The app itself may or may not have decided to submit the report, so
|
// The app itself may or may not have decided to submit the report, so
|
||||||
// allow either true or false here.
|
// allow either true or false here.
|
||||||
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
||||||
|
@ -71,11 +71,12 @@ function onPluginCrashed(aEvent) {
|
|||||||
var pluginElement = document.getElementById("plugin1");
|
var pluginElement = document.getElementById("plugin1");
|
||||||
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
||||||
|
|
||||||
ok(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent,
|
ok(aEvent instanceof Components.interfaces.nsIDOMCustomEvent,
|
||||||
"plugin crashed event has the right interface");
|
"plugin crashed event has the right interface");
|
||||||
var pluginName = aEvent.getData("pluginName");
|
var propBag = aEvent.detail.QueryInterface(Components.interfaces.nsIPropertyBag2);
|
||||||
|
var pluginName = propBag.getPropertyAsAString("pluginName");
|
||||||
is(pluginName, "Test Plug-in");
|
is(pluginName, "Test Plug-in");
|
||||||
var didReport = aEvent.getData("submittedCrashReport");
|
var didReport = propBag.getPropertyAsBool("submittedCrashReport");
|
||||||
// The app itself may or may not have decided to submit the report, so
|
// The app itself may or may not have decided to submit the report, so
|
||||||
// allow either true or false here.
|
// allow either true or false here.
|
||||||
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
ok((didReport == true || didReport == false), "event said crash report was submitted");
|
||||||
|
Loading…
Reference in New Issue
Block a user