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

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

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

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

@ -771,6 +771,16 @@ public:
* @return true if this is a property
*/
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
* @return true if this is a parameterized property
@ -802,15 +812,17 @@ public:
PRUint32 GetDispID() const;
/**
* 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
*/
PRUint32 GetParamCount() const;
PRUint32 GetParamCount(PRBool getter = PR_FALSE) const;
/**
* Returns parameter information for the specified parameter
* @param index the index of the parameter
* @param Ask from getter instead of setter version of the function
* @return Parameter information
*/
ParamInfo GetParamInfo(PRUint32 index);
ParamInfo GetParamInfo(PRUint32 index, PRBool getter = PR_FALSE) const;
// === Setup functions ===
/**
* Sets the name of the method
@ -843,6 +855,12 @@ public:
*/
void SetTypeInfo(DISPID dispID, ITypeInfo* pTypeInfo,
FUNCDESC* funcdesc);
/**
* Sets the function description for the getter version of the function.
* @param funcdesc function description
*/
void SetGetterFuncDesc(FUNCDESC* funcdesc);
private:
/**
* Our internal flags identify the type of member
@ -860,7 +878,9 @@ public:
jsval mVal; // Mutable
jsval mName; // Mutable
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
* @param index index of the parameter to return the type of