Bug 602514 [@ AutoGCRooter::AutoGCRooter] if !ccx.IsValid() in nsXPCWrappedJSClass::CallMethod
authortimeless@mozdev.org
Mon, 28 Mar 2011 17:26:33 -0400
changeset 64116 9f3bde4148003592895a2e4dbabf35b0f6566889
parent 64115 a52e34d1bb4e9b6cdd28383b1d3c53c904158a1d
child 64117 dd6d201316bb8dee95afc6cdd679a7bad7fd4d66
push idunknown
push userunknown
push dateunknown
bugs602514
milestone2.2a1pre
Bug 602514 [@ AutoGCRooter::AutoGCRooter] if !ccx.IsValid() in nsXPCWrappedJSClass::CallMethod r=mrbkap
js/src/xpconnect/src/xpcwrappedjsclass.cpp
--- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp
@@ -1293,26 +1293,21 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
     JSObject* thisObj;
 
     // Make sure not to set the callee on ccx until after we've gone through
     // the whole nsIXPCFunctionThisTranslator bit.  That code uses ccx to
     // convert natives to JSObjects, but we do NOT plan to pass those JSObjects
     // to our real callee.
     JSContext *context = GetContextFromObject(wrapper->GetJSObject());
     XPCCallContext ccx(NATIVE_CALLER, context);
-    if(ccx.IsValid())
-    {
-        xpcc = ccx.GetXPCContext();
-        cx = ccx.GetJSContext();
-    }
-    else
-    {
-        xpcc = nsnull;
-        cx = nsnull;
-    }
+    if(!ccx.IsValid())
+        return retval;
+
+    xpcc = ccx.GetXPCContext();
+    cx = ccx.GetJSContext();
 
     if(!cx || !xpcc || !IsReflectable(methodIndex))
         return NS_ERROR_FAILURE;
 
     obj = thisObj = wrapper->GetJSObject();
 
     JSAutoEnterCompartment ac;
     if (!ac.enter(cx, obj))