mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
This commit is contained in:
parent
a406584d82
commit
b74a05397f
@ -870,17 +870,13 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
|
||||
const nsXPTParamInfo& param,
|
||||
uint16 methodIndex,
|
||||
uint8 paramIndex,
|
||||
SizeMode mode,
|
||||
nsXPTCMiniVariant* nativeParams,
|
||||
JSUint32* result)
|
||||
{
|
||||
uint8 argnum;
|
||||
nsresult rv;
|
||||
|
||||
if (mode == GET_SIZE)
|
||||
rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
else
|
||||
rv = mInfo->GetLengthIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
if (NS_FAILED(rv))
|
||||
return JS_FALSE;
|
||||
|
||||
@ -1421,8 +1417,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
||||
|
||||
if (isArray || isSizedString) {
|
||||
if (!GetArraySizeFromParam(cx, info, param, methodIndex,
|
||||
i, GET_LENGTH, nativeParams,
|
||||
&array_count))
|
||||
i, nativeParams, &array_count))
|
||||
goto pre_call_clean_up;
|
||||
}
|
||||
|
||||
@ -1495,10 +1490,12 @@ pre_call_clean_up:
|
||||
1, &datum_type)) &&
|
||||
datum_type.IsPointer() &&
|
||||
GetArraySizeFromParam(cx, info, param, methodIndex,
|
||||
i, GET_LENGTH, nativeParams,
|
||||
&array_count) && array_count) {
|
||||
i, nativeParams, &array_count) &&
|
||||
array_count) {
|
||||
|
||||
CleanupPointerArray(datum_type, array_count, pp);
|
||||
}
|
||||
|
||||
// always release the array if it is inout
|
||||
nsMemory::Free(pp);
|
||||
}
|
||||
@ -1669,8 +1666,7 @@ pre_call_clean_up:
|
||||
|
||||
if (isArray || isSizedString) {
|
||||
if (!GetArraySizeFromParam(cx, info, param, methodIndex,
|
||||
i, GET_LENGTH, nativeParams,
|
||||
&array_count))
|
||||
i, nativeParams, &array_count))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1721,8 +1717,9 @@ pre_call_clean_up:
|
||||
1, &datum_type)) &&
|
||||
datum_type.IsPointer() &&
|
||||
GetArraySizeFromParam(cx, info, param, methodIndex,
|
||||
k, GET_LENGTH, nativeParams,
|
||||
&array_count) && array_count) {
|
||||
k, nativeParams, &array_count) &&
|
||||
array_count) {
|
||||
|
||||
CleanupPointerArray(datum_type, array_count, pp);
|
||||
}
|
||||
nsMemory::Free(pp);
|
||||
|
@ -2026,26 +2026,8 @@ class CallMethodHelper
|
||||
jsval* const mArgv;
|
||||
const PRUint32 mArgc;
|
||||
|
||||
enum SizeMode {
|
||||
eGetSize,
|
||||
eGetLength
|
||||
};
|
||||
|
||||
JS_ALWAYS_INLINE JSBool
|
||||
GetArrayInfoFromParam(uint8 paramIndex, SizeMode mode,
|
||||
JSUint32* result) const;
|
||||
|
||||
JSBool
|
||||
GetArraySizeFromParam(uint8 paramIndex, JSUint32* result) const
|
||||
{
|
||||
return GetArrayInfoFromParam(paramIndex, eGetSize, result);
|
||||
}
|
||||
|
||||
JSBool
|
||||
GetArrayLengthFromParam(uint8 paramIndex, JSUint32* result) const
|
||||
{
|
||||
return GetArrayInfoFromParam(paramIndex, eGetLength, result);
|
||||
}
|
||||
GetArraySizeFromParam(uint8 paramIndex, JSUint32* result) const;
|
||||
|
||||
JS_ALWAYS_INLINE JSBool
|
||||
GetInterfaceTypeFromParam(uint8 paramIndex,
|
||||
@ -2270,7 +2252,7 @@ CallMethodHelper::~CallMethodHelper()
|
||||
}
|
||||
|
||||
JSBool
|
||||
CallMethodHelper::GetArrayInfoFromParam(uint8 paramIndex, SizeMode mode,
|
||||
CallMethodHelper::GetArraySizeFromParam(uint8 paramIndex,
|
||||
JSUint32* result) const
|
||||
{
|
||||
nsresult rv;
|
||||
@ -2278,10 +2260,7 @@ CallMethodHelper::GetArrayInfoFromParam(uint8 paramIndex, SizeMode mode,
|
||||
|
||||
// TODO fixup the various exceptions that are thrown
|
||||
|
||||
if (mode == eGetSize)
|
||||
rv = mIFaceInfo->GetSizeIsArgNumberForParam(mVTableIndex, ¶mInfo, 0, ¶mIndex);
|
||||
else
|
||||
rv = mIFaceInfo->GetLengthIsArgNumberForParam(mVTableIndex, ¶mInfo, 0, ¶mIndex);
|
||||
rv = mIFaceInfo->GetSizeIsArgNumberForParam(mVTableIndex, ¶mInfo, 0, ¶mIndex);
|
||||
if (NS_FAILED(rv))
|
||||
return Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, mCallContext);
|
||||
|
||||
@ -2700,7 +2679,6 @@ CallMethodHelper::ConvertDependentParams()
|
||||
|
||||
nsXPTType datum_type;
|
||||
JSUint32 array_count;
|
||||
JSUint32 array_capacity;
|
||||
bool isArray = type.IsArray();
|
||||
|
||||
bool isSizedString = isArray ?
|
||||
@ -2764,8 +2742,7 @@ CallMethodHelper::ConvertDependentParams()
|
||||
uintN err;
|
||||
|
||||
if (isArray || isSizedString) {
|
||||
if (!GetArraySizeFromParam(i, &array_capacity) ||
|
||||
!GetArrayLengthFromParam(i, &array_count))
|
||||
if (!GetArraySizeFromParam(i, &array_count))
|
||||
return JS_FALSE;
|
||||
|
||||
if (isArray) {
|
||||
|
@ -2926,14 +2926,11 @@ private:
|
||||
{if (b) mDescriptors[i/32] |= (1 << (i%32));
|
||||
else mDescriptors[i/32] &= ~(1 << (i%32));}
|
||||
|
||||
enum SizeMode {GET_SIZE, GET_LENGTH};
|
||||
|
||||
JSBool GetArraySizeFromParam(JSContext* cx,
|
||||
const XPTMethodDescriptor* method,
|
||||
const nsXPTParamInfo& param,
|
||||
uint16 methodIndex,
|
||||
uint8 paramIndex,
|
||||
SizeMode mode,
|
||||
nsXPTCMiniVariant* params,
|
||||
JSUint32* result);
|
||||
|
||||
|
@ -58,7 +58,7 @@ class nsXPTType;
|
||||
%}
|
||||
|
||||
/* this is NOT intended to be scriptable */
|
||||
[uuid(7de126a2-ef4b-4e3b-a952-78ce4c133e38)]
|
||||
[uuid(1affa260-8965-4612-869a-78af4ccfb287)]
|
||||
interface nsIInterfaceInfo : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
@ -115,10 +115,6 @@ interface nsIInterfaceInfo : nsISupports
|
||||
[const] in nsXPTParamInfoPtr param,
|
||||
in PRUint16 dimension);
|
||||
|
||||
PRUint8 getLengthIsArgNumberForParam(in PRUint16 methodIndex,
|
||||
[const] in nsXPTParamInfoPtr param,
|
||||
in PRUint16 dimension);
|
||||
|
||||
PRUint8 getInterfaceIsArgNumberForParam(in PRUint16 methodIndex,
|
||||
[const] in nsXPTParamInfoPtr param);
|
||||
|
||||
|
@ -484,52 +484,6 @@ xptiInterfaceEntry::GetSizeIsArgNumberForParam(uint16 methodIndex,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xptiInterfaceEntry::GetLengthIsArgNumberForParam(uint16 methodIndex,
|
||||
const nsXPTParamInfo* param,
|
||||
uint16 dimension,
|
||||
uint8* argnum)
|
||||
{
|
||||
if(!EnsureResolved())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if(methodIndex < mMethodBaseIndex)
|
||||
return mParent->
|
||||
GetLengthIsArgNumberForParam(methodIndex, param, dimension, argnum);
|
||||
|
||||
if(methodIndex >= mMethodBaseIndex +
|
||||
mDescriptor->num_methods)
|
||||
{
|
||||
NS_ERROR("bad index");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const XPTTypeDescriptor *td;
|
||||
|
||||
if(dimension) {
|
||||
nsresult rv = GetTypeInArray(param, dimension, &td);
|
||||
if(NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
else
|
||||
td = ¶m->type;
|
||||
|
||||
// verify that this is a type that has length_is
|
||||
switch (XPT_TDP_TAG(td->prefix)) {
|
||||
case TD_ARRAY:
|
||||
case TD_PSTRING_SIZE_IS:
|
||||
case TD_PWSTRING_SIZE_IS:
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("not a length_is");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*argnum = td->argnum2;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xptiInterfaceEntry::GetInterfaceIsArgNumberForParam(uint16 methodIndex,
|
||||
const nsXPTParamInfo* param,
|
||||
|
@ -307,7 +307,6 @@ public:
|
||||
nsresult GetIIDForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, nsIID * *_retval);
|
||||
nsresult GetTypeForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, nsXPTType *_retval);
|
||||
nsresult GetSizeIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, PRUint8 *_retval);
|
||||
nsresult GetLengthIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, PRUint8 *_retval);
|
||||
nsresult GetInterfaceIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint8 *_retval);
|
||||
nsresult IsIID(const nsIID * IID, bool *_retval);
|
||||
nsresult GetNameShared(const char **name);
|
||||
@ -389,7 +388,6 @@ public:
|
||||
NS_IMETHOD GetIIDForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, nsIID * *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParam(methodIndex, param, _retval); }
|
||||
NS_IMETHOD GetTypeForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, nsXPTType *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetTypeForParam(methodIndex, param, dimension, _retval); }
|
||||
NS_IMETHOD GetSizeIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, PRUint8 *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetSizeIsArgNumberForParam(methodIndex, param, dimension, _retval); }
|
||||
NS_IMETHOD GetLengthIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint16 dimension, PRUint8 *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetLengthIsArgNumberForParam(methodIndex, param, dimension, _retval); }
|
||||
NS_IMETHOD GetInterfaceIsArgNumberForParam(PRUint16 methodIndex, const nsXPTParamInfo * param, PRUint8 *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInterfaceIsArgNumberForParam(methodIndex, param, _retval); }
|
||||
NS_IMETHOD IsIID(const nsIID * IID, bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsIID(IID, _retval); }
|
||||
NS_IMETHOD GetNameShared(const char **name) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetNameShared(name); }
|
||||
|
Loading…
Reference in New Issue
Block a user