Bug 198668 - [AxPlugin] Ofoto control does not return the value of properties correctly. r=dbradley/adamloc, sr=jst

IDispatch only changes, not part of the regular build
This commit is contained in:
dbradley%netscape.com 2003-03-26 04:20:33 +00:00
Родитель 4f6c56114b
Коммит c3244ab6bc
3 изменённых файлов: 60 добавлений и 13 удалений

Просмотреть файл

@ -108,7 +108,7 @@ VARTYPE XPCDispInterface::Member::ParamInfo::GetType() const
inline inline
XPCDispInterface::Member::Member() : XPCDispInterface::Member::Member() :
mType(UNINITIALIZED), mFuncDesc(0), mType(UNINITIALIZED), mFuncDesc(0), mGetterFuncDesc(0),
mTypeInfo(0) mTypeInfo(0)
{ {
} }
@ -116,8 +116,13 @@ XPCDispInterface::Member::Member() :
inline inline
XPCDispInterface::Member::~Member() XPCDispInterface::Member::~Member()
{ {
if(mTypeInfo && mFuncDesc) if(mTypeInfo)
{
if (mFuncDesc)
mTypeInfo->ReleaseFuncDesc(mFuncDesc); mTypeInfo->ReleaseFuncDesc(mFuncDesc);
if (mGetterFuncDesc)
mTypeInfo->ReleaseFuncDesc(mGetterFuncDesc);
}
} }
inline inline
@ -183,10 +188,23 @@ PRBool XPCDispInterface::Member::IsFunction() const
return IsFlagSet(FUNCTION); return IsFlagSet(FUNCTION);
} }
inline
PRBool XPCDispInterface::Member::IsParameterizedSetter() const
{
return IsSetter() && GetParamCount() > 1;
}
inline
PRBool XPCDispInterface::Member::IsParameterizedGetter() const
{
return IsGetter() && (GetParamCount(PR_TRUE) > 1 ||
(GetParamCount(PR_TRUE) == 1 && GetParamInfo(0, PR_TRUE).IsRetVal()));
}
inline inline
PRBool XPCDispInterface::Member::IsParameterizedProperty() const PRBool XPCDispInterface::Member::IsParameterizedProperty() const
{ {
return (IsSetter() && GetParamCount() > 1) || (IsGetter() && GetParamCount() > 0); return IsParameterizedSetter() || IsParameterizedGetter();
} }
inline inline
@ -208,16 +226,16 @@ PRUint32 XPCDispInterface::Member::GetDispID() const
} }
inline inline
PRUint32 XPCDispInterface::Member::GetParamCount() const PRUint32 XPCDispInterface::Member::GetParamCount(PRBool getter) const
{ {
return mFuncDesc->cParams; return (getter && mGetterFuncDesc) ? mGetterFuncDesc->cParams : mFuncDesc->cParams;
} }
inline inline
XPCDispInterface::Member::ParamInfo XPCDispInterface::Member::GetParamInfo(PRUint32 index) XPCDispInterface::Member::ParamInfo XPCDispInterface::Member::GetParamInfo(PRUint32 index, PRBool getter) const
{ {
NS_ASSERTION(index < GetParamCount(), "Array bounds error"); NS_ASSERTION(index < GetParamCount(getter), "Array bounds error");
return ParamInfo(mFuncDesc->lprgelemdescParam + index); return ParamInfo(((getter && mGetterFuncDesc) ? mGetterFuncDesc->lprgelemdescParam : mFuncDesc->lprgelemdescParam) + index);
} }
inline inline
@ -229,6 +247,12 @@ void XPCDispInterface::Member::SetTypeInfo(DISPID dispID,
mFuncDesc = funcdesc; mFuncDesc = funcdesc;
} }
inline
void XPCDispInterface::Member::SetGetterFuncDesc(FUNCDESC* funcdesc)
{
mGetterFuncDesc = funcdesc;
}
inline inline
PRUint16 XPCDispInterface::Member::GetParamType(PRUint32 index) const PRUint16 XPCDispInterface::Member::GetParamType(PRUint32 index) const
{ {

Просмотреть файл

@ -189,7 +189,10 @@ PRBool XPCDispInterface::InspectIDispatch(JSContext * cx, ITypeInfo * pTypeInfo,
// property // property
else else
{ {
ConvertInvokeKind(pFuncDesc->invkind, *(pInfo - 1)); XPCDispInterface::Member * lastInfo = pInfo - 1;
ConvertInvokeKind(pFuncDesc->invkind, *lastInfo);
lastInfo->SetGetterFuncDesc(pFuncDesc);
release = PR_FALSE;
} }
} }
if(release) if(release)

Просмотреть файл

@ -771,6 +771,16 @@ public:
* @return true if this is a property * @return true if this is a property
*/ */
PRBool IsProperty() const; PRBool IsProperty() const;
/**
* Is this a parameterized setter
* @return true if this is a parameterized property
*/
PRBool IsParameterizedSetter() const;
/**
* Is this a parameterized getter
* @return true if this is a parameterized property
*/
PRBool IsParameterizedGetter() const;
/** /**
* Is this a parameterized property * Is this a parameterized property
* @return true if this is a parameterized property * @return true if this is a parameterized property
@ -802,15 +812,17 @@ public:
PRUint32 GetDispID() const; PRUint32 GetDispID() const;
/** /**
* returns the number of parameters of the method * returns the number of parameters of the method
* @param Ask from getter instead of setter version of the function
* @return the number of parameters of the method * @return the number of parameters of the method
*/ */
PRUint32 GetParamCount() const; PRUint32 GetParamCount(PRBool getter = PR_FALSE) const;
/** /**
* Returns parameter information for the specified parameter * Returns parameter information for the specified parameter
* @param index the index of the parameter * @param index the index of the parameter
* @param Ask from getter instead of setter version of the function
* @return Parameter information * @return Parameter information
*/ */
ParamInfo GetParamInfo(PRUint32 index); ParamInfo GetParamInfo(PRUint32 index, PRBool getter = PR_FALSE) const;
// === Setup functions === // === Setup functions ===
/** /**
* Sets the name of the method * Sets the name of the method
@ -843,6 +855,12 @@ public:
*/ */
void SetTypeInfo(DISPID dispID, ITypeInfo* pTypeInfo, void SetTypeInfo(DISPID dispID, ITypeInfo* pTypeInfo,
FUNCDESC* funcdesc); FUNCDESC* funcdesc);
/**
* Sets the function description for the getter version of the function.
* @param funcdesc function description
*/
void SetGetterFuncDesc(FUNCDESC* funcdesc);
private: private:
/** /**
* Our internal flags identify the type of member * Our internal flags identify the type of member
@ -860,7 +878,9 @@ public:
jsval mVal; // Mutable jsval mVal; // Mutable
jsval mName; // Mutable jsval mName; // Mutable
CComPtr<ITypeInfo> mTypeInfo; CComPtr<ITypeInfo> mTypeInfo;
FUNCDESC* mFuncDesc; // We keep hold on this so we don't have FUNCDESC* mFuncDesc; // We own this, and must release it
FUNCDESC* mGetterFuncDesc; // We own this, and must release it
// This may be the same as mFuncDesc
/** /**
* Helper function to return the parameter type * Helper function to return the parameter type
* @param index index of the parameter to return the type of * @param index index of the parameter to return the type of