author | Bobby Holley <bobbyholley@gmail.com> |
Fri, 25 Nov 2011 17:09:07 -0800 | |
changeset 82428 | 4d417032d8878ed97c1093544e9ae13aa964999d |
parent 82427 | 8790687685ee53327539a05ae6636c6f6ddfcb29 |
child 82429 | a03dd8e80c34d8ae160128641cb7062d05811857 |
push id | 519 |
push user | akeybl@mozilla.com |
push date | Wed, 01 Feb 2012 00:38:35 +0000 |
treeherder | mozilla-beta@788ea1ef610b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 692342 |
milestone | 11.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -2118,16 +2118,17 @@ class CallMethodHelper return const_cast<CallMethodHelper*>(this)->GetDispatchParam(paramIndex); } JS_ALWAYS_INLINE JSBool InitializeDispatchParams(); JS_ALWAYS_INLINE JSBool ConvertIndependentParams(JSBool* foundDependentParam); JS_ALWAYS_INLINE JSBool ConvertIndependentParam(uint8 i); JS_ALWAYS_INLINE JSBool ConvertDependentParams(); + JS_ALWAYS_INLINE JSBool ConvertDependentParam(uint8 i); JS_ALWAYS_INLINE void CleanupParam(nsXPTCMiniVariant& param, nsXPTType& type); JS_ALWAYS_INLINE JSBool HandleDipperParam(nsXPTCVariant* dp, const nsXPTParamInfo& paramInfo); JS_ALWAYS_INLINE nsresult Invoke(); @@ -2688,21 +2689,31 @@ CallMethodHelper::ConvertIndependentPara } JSBool CallMethodHelper::ConvertDependentParams() { const uint8 paramCount = mMethodInfo->GetParamCount(); for (uint8 i = 0; i < paramCount; i++) { const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(i); + + if (!paramInfo.GetType().IsDependent()) + continue; + if (!ConvertDependentParam(i)) + return JS_FALSE; + } + + return JS_TRUE; +} + +JSBool +CallMethodHelper::ConvertDependentParam(uint8 i) +{ + const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(i); const nsXPTType& type = paramInfo.GetType(); - - if (!type.IsDependent()) - continue; - nsXPTType datum_type; JSUint32 array_count = 0; bool isArray = type.IsArray(); bool isSizedString = isArray ? JS_FALSE : type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS || type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS; @@ -2735,17 +2746,17 @@ CallMethodHelper::ConvertDependentParams if (paramInfo.IsOut()) { if (datum_type.IsPointer() && !datum_type.IsInterfacePointer() && isArray) { dp->SetValNeedsCleanup(); } if (!paramInfo.IsIn()) - continue; + return JS_TRUE; } else { NS_ASSERTION(i < mArgc || paramInfo.IsOptional(), "Expected either enough arguments or an optional argument"); src = i < mArgc ? mArgv[i] : JSVAL_NULL; if (datum_type.TagPart() == nsXPTType::T_IID || datum_type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS || datum_type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS || @@ -2786,19 +2797,18 @@ CallMethodHelper::ConvertDependentParams } } else { if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type, JS_TRUE, ¶m_iid, &err)) { ThrowBadParam(err, i, mCallContext); return JS_FALSE; } } - } - - return JS_TRUE; + + return JS_TRUE; } // Performs all necessary teardown on a parameter after method invocation. // // This method should only be called if the value in question was flagged // for cleanup (ie, if dp->DoesValNeedCleanup()). void CallMethodHelper::CleanupParam(nsXPTCMiniVariant& param, nsXPTType& type)