Bug 779849 - Fix NPAPI wrapping (r=bholley)
authorBill McCloskey <wmccloskey@mozilla.com>
Fri, 03 Aug 2012 12:41:49 -0700
changeset 103254 4f774268e674a746bdcbb5f434d8d75f99b34329
parent 103253 4863aa94957552d113e8f59e081af0e5dec08912
child 103255 21d92e8dd85a8d12a52763874c7440f14a5a723a
push id18
push usershu@rfrn.org
push dateMon, 06 Aug 2012 22:42:45 +0000
reviewersbholley
bugs779849
milestone17.0a1
Bug 779849 - Fix NPAPI wrapping (r=bholley)
dom/plugins/base/nsJSNPRuntime.cpp
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1802,17 +1802,21 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JS
     NS_ERROR("Null NPObject passed to nsNPObjWrapper::GetNewOrUsed()!");
 
     return nullptr;
   }
 
   if (npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass) {
     // npobj is one of our own, return its existing JSObject.
 
-    return ((nsJSObjWrapper *)npobj)->mJSObj;
+    JSObject *obj = ((nsJSObjWrapper *)npobj)->mJSObj;
+    if (!JS_WrapObject(cx, &obj)) {
+      return NULL;
+    }
+    return obj;
   }
 
   if (!npp) {
     NS_ERROR("No npp passed to nsNPObjWrapper::GetNewOrUsed()!");
 
     return nullptr;
   }