32 #include <nsIClassInfoImpl.h>
33 #include <nsStringGlue.h>
42 static PRLogModuleInfo* gScriptableFunctionLog = nsnull;
46 #define LOG(args) PR_LOG( gScriptableFunctionLog, PR_LOG_WARN, args )
47 #define TRACE(args) PR_LOG( gScriptableFunctionLog, PR_LOG_DEBUG, args )
59 if (!gScriptableFunctionLog) {
60 gScriptableFunctionLog = PR_NewLogModule(
"sbScriptableFunction" );
63 TRACE((
"sbScriptableFunctionBase::sbScriptableFunctionBase()"));
68 TRACE((
"sbScriptableFunctionBase::~sbScriptableFunctionBase()"));
80 LOG((
"sbScriptableFunctionBase::GetClassName()"));
81 NS_ENSURE_ARG_POINTER(aClassName);
83 NS_NAMED_LITERAL_CSTRING( kClassName,
"sbScriptableFunction" );
84 *aClassName = ToNewCString(kClassName);
85 return aClassName ?
NS_OK : NS_ERROR_OUT_OF_MEMORY;
91 LOG((
"sbScriptableFunctionBase::GetScriptableFlags()"));
92 NS_ENSURE_ARG_POINTER(aScriptableFlags);
93 *aScriptableFlags = DONT_ENUM_STATIC_PROPS |
94 DONT_ENUM_QUERY_INTERFACE |
96 DONT_REFLECT_INTERFACE_NAMES ;
107 sbScriptableFunctionBase::CanCreateWrapper(
const nsIID *iid,
char **_retval )
109 TRACE((
"sbScriptableFunctionBase::CanCreateWrapper()"));
111 NS_ENSURE_ARG_POINTER(_retval);
112 *_retval = ToNewCString( NS_LITERAL_CSTRING(
"AllAccess") );
117 sbScriptableFunctionBase::CanCallMethod(
const nsIID *iid,
118 const PRUnichar *methodName,
121 TRACE((
"sbScriptableFunctionBase::CanCallMethod() - %s",
122 NS_LossyConvertUTF16toASCII(methodName).BeginReading() ));
124 NS_ENSURE_ARG_POINTER(_retval);
125 *_retval = ToNewCString( NS_LITERAL_CSTRING(
"AllAccess") );
130 sbScriptableFunctionBase::CanGetProperty(
const nsIID *iid,
131 const PRUnichar *propertyName,
134 TRACE((
"sbScriptableFunctionBase::CanGetProperty() - %s",
135 NS_LossyConvertUTF16toASCII(propertyName).BeginReading() ));
137 NS_ENSURE_ARG_POINTER(_retval);
138 *_retval = ToNewCString( NS_LITERAL_CSTRING(
"AllAccess") );
143 sbScriptableFunctionBase::CanSetProperty(
const nsIID *iid,
144 const PRUnichar *propertyName,
147 TRACE((
"sbScriptableFunctionBase::CanSetProperty() - %s",
148 NS_LossyConvertUTF16toASCII(propertyName).BeginReading() ));
150 NS_ENSURE_ARG_POINTER(_retval);
151 *_retval = ToNewCString( NS_LITERAL_CSTRING(
"NoAccess") );
170 if (!gScriptableFunctionLog) {
171 gScriptableFunctionLog = PR_NewLogModule(
"sbScriptableFunction" );
174 TRACE((
"sbScriptableLibraryFunction::sbScriptableLibraryFunction()"));
179 TRACE((
"sbScriptableLibraryFunction::~sbScriptableLibraryFunction()"));
191 TRACE((
"sbScriptableLibraryFunction::Call()"));
196 NS_ENSURE_ARG_POINTER(obj);
197 NS_ENSURE_ARG_POINTER(vp);
198 NS_ENSURE_ARG_POINTER(_retval);
202 nsCOMPtr<nsIXPConnect> xpc;
203 rv = wrapper->GetXPConnect( getter_AddRefs(xpc) );
204 NS_ENSURE_SUCCESS( rv, rv );
206 nsCOMPtr<nsIXPConnectJSObjectHolder> objectHolder;
207 rv = xpc->WrapNative( cx, obj,
mObject,
mIID, getter_AddRefs(objectHolder) );
208 NS_ENSURE_SUCCESS( rv, rv );
211 rv = objectHolder->GetJSObject( &
object );
212 NS_ENSURE_SUCCESS( rv, rv );
214 *vp = OBJECT_TO_JSVAL(
object);
232 if (!gScriptableFunctionLog) {
233 gScriptableFunctionLog = PR_NewLogModule(
"sbScriptableFunction" );
236 TRACE((
"sbScriptableMediaListFunction::sbScriptableMediaListFunction()"));
241 TRACE((
"sbScriptableMediaListFunction::~sbScriptableMediaListFunction()"));
253 TRACE((
"sbScriptableMediaListFunction::Call()"));
NS_IMPL_ISUPPORTS_INHERITED0(sbScriptableLibraryFunction, sbScriptableFunctionBase) sbScriptableLibraryFunction
NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp, PRBool *_retval)
nsISecurityCheckedComponent
NS_IMPL_ISUPPORTS2_CI(sbScriptableFunctionBase, nsISecurityCheckedComponent, nsIXPCScriptable) sbScriptableFunctionBase
virtual ~sbScriptableFunctionBase()
nsCOMPtr< nsISupports > mObject
virtual ~sbScriptableLibraryFunction()
NS_DECL_ISUPPORTS NS_DECL_NSICLASSINFO NS_DECL_NSISECURITYCHECKEDCOMPONENT NS_IMETHOD GetClassName(char **aClassName)
NS_IMETHOD GetScriptableFlags(PRUint32 *aScriptableFlags)
#define SB_IMPL_CLASSINFO_INTERFACES_ONLY(_class)