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; return NS_OK;
} }
NS_IMETHODIMP // virtual
nsDOMClassInfo::GetScriptableFlags(PRUint32 *aFlags) PRUint32
nsDOMClassInfo::GetScriptableFlags()
{ {
*aFlags = mData->mScriptableFlags; return mData->mScriptableFlags;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

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

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

@ -37,7 +37,7 @@
* to *_retval unless they want to return PR_FALSE. * to *_retval unless they want to return PR_FALSE.
*/ */
[uuid(fca22e1e-a2bf-456e-83db-f73e8de0f7c5)] [uuid(782d317e-0727-4ccd-8a5b-f5d237f3b03c)]
interface nsIXPCScriptable : nsISupports interface nsIXPCScriptable : nsISupports
{ {
/* bitflags used for 'flags' (only 32 bits available!) */ /* bitflags used for 'flags' (only 32 bits available!) */
@ -80,7 +80,7 @@ interface nsIXPCScriptable : nsISupports
const PRUint32 RESERVED = 1 << 31; const PRUint32 RESERVED = 1 << 31;
readonly attribute string className; readonly attribute string className;
readonly attribute PRUint32 scriptableFlags; [notxpcom,nostdcall] PRUint32 getScriptableFlags();
void preCreate(in nsISupports nativeObj, in JSContextPtr cx, void preCreate(in nsISupports nativeObj, in JSContextPtr cx,
in JSObjectPtr globalObj, out JSObjectPtr parentObj); 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 #ifdef XPC_MAP_WANT_PRECREATE
nsIXPCScriptable::WANT_PRECREATE | nsIXPCScriptable::WANT_PRECREATE |
#endif #endif
@ -85,7 +87,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScriptableFlags(PRUint32 *aFlags)
XPC_MAP_FLAGS | XPC_MAP_FLAGS |
#endif #endif
0; 0;
return NS_OK;
} }
/**************************************************************/ /**************************************************************/

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

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

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

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