vendor/tracemonkey/xpconnect/src/xpcinlines.h in johnson-2.0.0.pre0 vs vendor/tracemonkey/xpconnect/src/xpcinlines.h in johnson-2.0.0.pre1
- old
+ new
@@ -166,11 +166,15 @@
inline nsISupports*
XPCCallContext::GetIdentityObject() const
{
CHECK_STATE(HAVE_OBJECT);
- return mWrapper->GetIdentityObject();
+ if(mWrapper)
+ return mWrapper->GetIdentityObject();
+ return mCurrentJSObject ?
+ static_cast<nsISupports*>(xpc_GetJSPrivate(mCurrentJSObject)) :
+ nsnull;
}
inline XPCWrappedNative*
XPCCallContext::GetWrapper() const
{
@@ -179,10 +183,19 @@
CHECK_STATE(HAVE_OBJECT);
return mWrapper;
}
+inline XPCWrappedNativeProto*
+XPCCallContext::GetProto() const
+{
+ CHECK_STATE(HAVE_OBJECT);
+ if(mWrapper)
+ return mWrapper->GetProto();
+ return mCurrentJSObject ? GetSlimWrapperProto(mCurrentJSObject) : nsnull;
+}
+
inline JSBool
XPCCallContext::CanGetTearOff() const
{
return mState >= HAVE_OBJECT;
}
@@ -531,12 +544,16 @@
}
inline JSBool
XPCNativeSet::HasInterfaceWithAncestor(XPCNativeInterface* aInterface) const
{
- const nsIID* iid = aInterface->GetIID();
+ return HasInterfaceWithAncestor(aInterface->GetIID());
+}
+inline JSBool
+XPCNativeSet::HasInterfaceWithAncestor(const nsIID* iid) const
+{
// We can safely skip the first interface which is *always* nsISupports.
XPCNativeInterface* const * pp = mInterfaces+1;
for(int i = (int) mInterfaceCount; i > 1; i--, pp++)
if((*pp)->HasAncestor(iid))
return JS_TRUE;
@@ -660,16 +677,10 @@
}
/***************************************************************************/
inline JSBool
-XPCWrappedNative::HasInterfaceNoQI(XPCNativeInterface* aInterface)
-{
- return GetSet()->HasInterface(aInterface);
-}
-
-inline JSBool
XPCWrappedNative::HasInterfaceNoQI(const nsIID& iid)
{
return nsnull != GetSet()->FindInterfaceWithIID(iid);
}
@@ -744,14 +755,20 @@
}
return JS_FALSE;
}
+inline jsid
+GetRTIdByIndex(JSContext *cx, uintN index)
+{
+ XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
+ return rt->GetStringID(index);
+}
+
inline jsval
GetRTStringByIndex(JSContext *cx, uintN index)
{
- XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
- return ID_TO_VALUE(rt->GetStringID(index));
+ return ID_TO_VALUE(GetRTIdByIndex(cx, index));
}
inline
JSBool ThrowBadParam(nsresult rv, uintN paramNum, XPCCallContext& ccx)
{