diff --git a/modules/plugin/base/src/nsJSNPRuntime.cpp b/modules/plugin/base/src/nsJSNPRuntime.cpp index 5abd0e43dbc..1618855f496 100644 --- a/modules/plugin/base/src/nsJSNPRuntime.cpp +++ b/modules/plugin/base/src/nsJSNPRuntime.cpp @@ -56,7 +56,6 @@ #include "nsIDOMElement.h" #include "prmem.h" #include "nsIContent.h" -#include "xpcpublic.h" using namespace mozilla::plugins::parent; @@ -2038,18 +2037,20 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp) return; } - nsCOMPtr node(do_QueryInterface(element)); - - JSObject *obj; - if (!node || !(obj = node->GetWrapper())) { + nsCOMPtr holder; + xpc->GetWrappedNativeOfNativeObject(cx, sgo->GetGlobalJSObject(), content, + NS_GET_IID(nsISupports), + getter_AddRefs(holder)); + if (!holder) { return; } - JSObject *proto; + JSObject *obj, *proto; + holder->GetJSObject(&obj); JSAutoEnterCompartment ac; - if (!ac.enter(cx, obj)) { + if (obj && !ac.enter(cx, obj)) { // Failure to enter compartment, nothing more we can do then. return; }