Bug 762436 - Get rid of the nsresult return value for nsIXPCScriptable::GetScriptableFlags(); r=mrbkap

This commit is contained in:
Ms2ger 2012-06-17 10:11:16 +02:00
Родитель 5d0290fff6
Коммит c1e5ff949e
6 изменённых файлов: 20 добавлений и 46 удалений

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

@ -4777,12 +4777,11 @@ nsDOMClassInfo::GetClassName(char **aClassName)
return NS_OK;
}
NS_IMETHODIMP
nsDOMClassInfo::GetScriptableFlags(PRUint32 *aFlags)
// virtual
PRUint32
nsDOMClassInfo::GetScriptableFlags()
{
*aFlags = mData->mScriptableFlags;
return NS_OK;
return mData->mScriptableFlags;
}
NS_IMETHODIMP

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

@ -365,15 +365,10 @@ public:
return NS_OK;
}
NS_IMETHOD GetScriptableFlags(PRUint32 *aFlags)
virtual PRUint32 GetScriptableFlags()
{
PRUint32 flags;
nsresult rv = nsDOMGenericSH::GetScriptableFlags(&flags);
if (NS_SUCCEEDED(rv)) {
*aFlags = flags | nsIXPCScriptable::WANT_POSTCREATE;
}
return rv;
return nsDOMGenericSH::GetScriptableFlags() |
nsIXPCScriptable::WANT_POSTCREATE;
}
#endif
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,

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

@ -37,7 +37,7 @@
* to *_retval unless they want to return PR_FALSE.
*/
[uuid(fca22e1e-a2bf-456e-83db-f73e8de0f7c5)]
[uuid(782d317e-0727-4ccd-8a5b-f5d237f3b03c)]
interface nsIXPCScriptable : nsISupports
{
/* bitflags used for 'flags' (only 32 bits available!) */
@ -80,7 +80,7 @@ interface nsIXPCScriptable : nsISupports
const PRUint32 RESERVED = 1 << 31;
readonly attribute string className;
readonly attribute PRUint32 scriptableFlags;
[notxpcom,nostdcall] PRUint32 getScriptableFlags();
void preCreate(in nsISupports nativeObj, in JSContextPtr cx,
in JSObjectPtr globalObj, out JSObjectPtr parentObj);

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

@ -24,9 +24,11 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(char * *aClassName)
/**************************************************************/
NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScriptableFlags(PRUint32 *aFlags)
// virtual
PRUint32
XPC_MAP_CLASSNAME::GetScriptableFlags()
{
*aFlags =
return
#ifdef XPC_MAP_WANT_PRECREATE
nsIXPCScriptable::WANT_PRECREATE |
#endif
@ -85,7 +87,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScriptableFlags(PRUint32 *aFlags)
XPC_MAP_FLAGS |
#endif
0;
return NS_OK;
}
/**************************************************************/

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

@ -1012,11 +1012,7 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
if (classInfoHelper) {
nsCOMPtr<nsIXPCScriptable> helper =
dont_AddRef(static_cast<nsIXPCScriptable*>(classInfoHelper));
uint32_t flags;
nsresult rv = classInfoHelper->GetScriptableFlags(&flags);
if (NS_FAILED(rv))
flags = 0;
uint32_t flags = classInfoHelper->GetScriptableFlags();
sciProto.SetCallback(helper.forget());
sciProto.SetFlags(flags);
sciProto.SetInterfacesBitmap(classInfoHelper->GetInterfacesBitmap());
@ -1030,11 +1026,7 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
if (NS_SUCCEEDED(rv) && possibleHelper) {
nsCOMPtr<nsIXPCScriptable> helper(do_QueryInterface(possibleHelper));
if (helper) {
uint32_t flags;
rv = helper->GetScriptableFlags(&flags);
if (NS_FAILED(rv))
flags = 0;
uint32_t flags = helper->GetScriptableFlags();
sciProto.SetCallback(helper.forget());
sciProto.SetFlags(flags);
}
@ -1061,11 +1053,7 @@ XPCWrappedNative::GatherScriptableCreateInfo(nsISupports* obj,
// Do the same for the wrapper specific scriptable
nsCOMPtr<nsIXPCScriptable> helper(do_QueryInterface(obj));
if (helper) {
uint32_t flags;
nsresult rv = helper->GetScriptableFlags(&flags);
if (NS_FAILED(rv))
flags = 0;
uint32_t flags = helper->GetScriptableFlags();
sciWrapper.SetCallback(helper.forget());
sciWrapper.SetFlags(flags);
@ -3824,12 +3812,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
nsISupports *identityObj = aHelper.GetCanonical();
nsXPCClassInfo *classInfoHelper = aHelper.GetXPCClassInfo();
uint32_t flagsInt;
nsresult rv = classInfoHelper->GetScriptableFlags(&flagsInt);
if (NS_FAILED(rv))
flagsInt = 0;
XPCNativeScriptableFlags flags(flagsInt);
XPCNativeScriptableFlags flags(classInfoHelper->GetScriptableFlags());
NS_ASSERTION(flags.DontAskInstanceForScriptable(),
"Not supported for cached wrappers!");
@ -3843,7 +3826,7 @@ ConstructSlimWrapper(XPCCallContext &ccx,
}
JSObject* plannedParent = parent;
rv = classInfoHelper->PreCreate(identityObj, ccx, parent, &parent);
nsresult rv = classInfoHelper->PreCreate(identityObj, ccx, parent, &parent);
if (rv != NS_SUCCESS_ALLOW_SLIM_WRAPPERS) {
SLIM_LOG_NOT_CREATED(ccx, identityObj, "PreCreate hook refused");

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

@ -102,12 +102,8 @@ public:
// We should have something by now.
MOZ_ASSERT(sinfo);
// Grab the flags. This should not fail.
PRUint32 flags;
mozilla::DebugOnly<nsresult> rv = sinfo->GetScriptableFlags(&flags);
MOZ_ASSERT(NS_SUCCEEDED(rv));
return flags;
// Grab the flags.
return sinfo->GetScriptableFlags();
}
nsWrapperCache *GetWrapperCache()