Bug 705324 - Remove nsAXPCNativeCallContext::{GetRetValPtr,GetReturnValueWasSet,SetReturnValueWasSet}; r=bholley sr=bz
authorMs2ger <ms2ger@gmail.com>
Sun, 18 Dec 2011 11:09:58 +0100
changeset 83679 dddd8c46f9a90eeb14bae4ed31a20699665651f2
parent 83678 935634dccf0c727dbe740be89abe5ae8db55eb7a
child 83680 b456317ba3e46675e53e44a19f7a59dea73110a1
push id628
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 14:41:57 +0000
treeherdermozilla-aurora@24a61ad789e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, bz
bugs705324
milestone11.0a1
Bug 705324 - Remove nsAXPCNativeCallContext::{GetRetValPtr,GetReturnValueWasSet,SetReturnValueWasSet}; r=bholley sr=bz
js/xpconnect/public/nsAXPCNativeCallContext.h
js/xpconnect/src/XPCCallContext.cpp
js/xpconnect/src/XPCInlines.h
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/xpconnect/public/nsAXPCNativeCallContext.h
+++ b/js/xpconnect/public/nsAXPCNativeCallContext.h
@@ -54,29 +54,16 @@ class nsAXPCNativeCallContext
 public:
     NS_IMETHOD GetCallee(nsISupports **aResult) = 0;
     NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aResult) = 0;
     NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative **aResult) = 0;
     NS_IMETHOD GetJSContext(JSContext **aResult) = 0;
     NS_IMETHOD GetArgc(PRUint32 *aResult) = 0;
     NS_IMETHOD GetArgvPtr(jsval **aResult) = 0;
 
-    /**
-     * This may be NULL if the JS caller is ignoring the result of the call.
-     */
-    NS_IMETHOD GetRetValPtr(jsval **aResult) = 0;
-
-    /**
-     * Set this to indicate that the callee has directly set the return value
-     * (using RetValPtr and the JSAPI). If set then xpconnect will not attempt
-     * to overwrite it with the converted retval from the C++ callee.
-     */
-    NS_IMETHOD GetReturnValueWasSet(bool *aResult) = 0;
-    NS_IMETHOD SetReturnValueWasSet(bool aValue) = 0;
-
     // Methods added since mozilla 0.6....
 
     NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo **aResult) = 0;
     NS_IMETHOD GetCalleeClassInfo(nsIClassInfo **aResult) = 0;
 
     NS_IMETHOD GetPreviousCallContext(nsAXPCNativeCallContext **aResult) = 0;
 
     enum { LANG_UNKNOWN = 0,
--- a/js/xpconnect/src/XPCCallContext.cpp
+++ b/js/xpconnect/src/XPCCallContext.cpp
@@ -272,17 +272,16 @@ XPCCallContext::SetArgsAndResultPtr(uint
         mMember = nsnull;
         mStaticMemberIsLocal = false;
     }
 
     mArgc   = argc;
     mArgv   = argv;
     mRetVal = rval;
 
-    mReturnValueWasSet = false;
     mState = HAVE_ARGS;
 }
 
 nsresult
 XPCCallContext::CanCallNow()
 {
     nsresult rv;
 
@@ -491,38 +490,16 @@ XPCCallContext::GetArgc(PRUint32 *aArgc)
 /* readonly attribute JSValPtr ArgvPtr; */
 NS_IMETHODIMP
 XPCCallContext::GetArgvPtr(jsval * *aArgvPtr)
 {
     *aArgvPtr = mArgv;
     return NS_OK;
 }
 
-/* readonly attribute JSValPtr RetValPtr; */
-NS_IMETHODIMP
-XPCCallContext::GetRetValPtr(jsval * *aRetValPtr)
-{
-    *aRetValPtr = mRetVal;
-    return NS_OK;
-}
-
-/* attribute bool ReturnValueWasSet; */
-NS_IMETHODIMP
-XPCCallContext::GetReturnValueWasSet(bool *aReturnValueWasSet)
-{
-    *aReturnValueWasSet = mReturnValueWasSet;
-    return NS_OK;
-}
-NS_IMETHODIMP
-XPCCallContext::SetReturnValueWasSet(bool aReturnValueWasSet)
-{
-    mReturnValueWasSet = aReturnValueWasSet;
-    return NS_OK;
-}
-
 NS_IMETHODIMP
 XPCCallContext::GetPreviousCallContext(nsAXPCNativeCallContext **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = GetPrevCallContext();
   return NS_OK;
 }
 
--- a/js/xpconnect/src/XPCInlines.h
+++ b/js/xpconnect/src/XPCInlines.h
@@ -295,23 +295,16 @@ XPCCallContext::GetArgv() const
 
 inline jsval*
 XPCCallContext::GetRetVal() const
 {
     CHECK_STATE(READY_TO_CALL);
     return mRetVal;
 }
 
-inline JSBool
-XPCCallContext::GetReturnValueWasSet() const
-{
-    CHECK_STATE(READY_TO_CALL);
-    return mReturnValueWasSet;
-}
-
 inline void
 XPCCallContext::SetRetVal(jsval val)
 {
     CHECK_STATE(HAVE_ARGS);
     if (mRetVal)
         *mRetVal = val;
 }
 
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2452,23 +2452,17 @@ CallMethodHelper::GatherAndConvertResult
             if (!XPCConvert::NativeData2JS(mCallContext, &v, &dp->val, datum_type,
                                            &param_iid, &err)) {
                 ThrowBadParam(err, i, mCallContext);
                 return false;
             }
         }
 
         if (paramInfo.IsRetval()) {
-            if (!mCallContext.GetReturnValueWasSet()) {
-                mCallContext.SetRetVal(v);
-            } else {
-                // really, this should assert TagPart() == nsXPTType::T_VOID
-                NS_ASSERTION(type.TagPart() != nsXPTType::T_JSVAL,
-                             "dropping declared return value");
-            }
+            mCallContext.SetRetVal(v);
         } else if (i < mArgc) {
             // we actually assured this before doing the invoke
             NS_ASSERTION(JSVAL_IS_OBJECT(mArgv[i]), "out var is not object");
             if (!JS_SetPropertyById(mCallContext,
                                     JSVAL_TO_OBJECT(mArgv[i]),
                                     mIdxValueId, &v)) {
                 ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, i, mCallContext);
                 return false;
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1031,19 +1031,16 @@ class XPCCallContext : public nsAXPCNati
 {
 public:
     NS_IMETHOD GetCallee(nsISupports **aResult);
     NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aResult);
     NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative **aResult);
     NS_IMETHOD GetJSContext(JSContext **aResult);
     NS_IMETHOD GetArgc(PRUint32 *aResult);
     NS_IMETHOD GetArgvPtr(jsval **aResult);
-    NS_IMETHOD GetRetValPtr(jsval **aResult);
-    NS_IMETHOD GetReturnValueWasSet(bool *aResult);
-    NS_IMETHOD SetReturnValueWasSet(bool aValue);
     NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo **aResult);
     NS_IMETHOD GetCalleeClassInfo(nsIClassInfo **aResult);
     NS_IMETHOD GetPreviousCallContext(nsAXPCNativeCallContext **aResult);
     NS_IMETHOD GetLanguage(PRUint16 *aResult);
 
     enum {NO_ARGS = (uintN) -1};
 
     XPCCallContext(XPCContext::LangType callerLanguage,
@@ -1095,17 +1092,16 @@ public:
     inline XPCNativeInterface*          GetInterface() const ;
     inline XPCNativeMember*             GetMember() const ;
     inline JSBool                       HasInterfaceAndMember() const ;
     inline jsid                         GetName() const ;
     inline JSBool                       GetStaticMemberIsLocal() const ;
     inline uintN                        GetArgc() const ;
     inline jsval*                       GetArgv() const ;
     inline jsval*                       GetRetVal() const ;
-    inline JSBool                       GetReturnValueWasSet() const ;
 
     inline PRUint16                     GetMethodIndex() const ;
     inline void                         SetMethodIndex(PRUint16 index) ;
 
     inline JSBool   GetDestroyJSContextInDestructor() const;
     inline void     SetDestroyJSContextInDestructor(JSBool b);
 
     inline jsid GetResolveName() const;
@@ -1212,17 +1208,16 @@ private:
 
     jsid                            mName;
     JSBool                          mStaticMemberIsLocal;
 
     uintN                           mArgc;
     jsval*                          mArgv;
     jsval*                          mRetVal;
 
-    JSBool                          mReturnValueWasSet;
     PRUint16                        mMethodIndex;
 
 #define XPCCCX_STRING_CACHE_SIZE 2
 
     // String wrapper entry, holds a string, and a boolean that tells
     // whether the string is in use or not.
     //
     // NB: The string is not stored by value so that we avoid the cost of