*_retval
of the various methods that return a boolean to PR_TRUE
before making the call. Implementations may skip writing to *_retval
unless they want to return PR_FALSE
.js/src/xpconnect/idl/nsIXPCScriptable.idl
Not scriptableInherits from: nsISupports
Attribute | Type | Description |
className | string | |
scriptableFlags | PRUint32 | The bitwise or'd set of flags (define below) that indicate the behavior of this object. |
Constant | Value | Description |
WANT_PRECREATE | 1 << 0 | |
WANT_CREATE | 1 << 1 | |
WANT_POSTCREATE | 1 << 2 | |
WANT_ADDPROPERTY | 1 << 3 | |
WANT_DELPROPERTY | 1 << 4 | |
WANT_GETPROPERTY | 1 << 5 | |
WANT_SETPROPERTY | 1 << 6 | |
WANT_ENUMERATE | 1 << 7 | |
WANT_NEWENUMERATE | 1 << 8 | Indicates that the object wants to have its newEnumerate method called. |
WANT_NEWRESOLVE | 1 << 9 | Indicates that the object wants to have its newResolve method called. |
WANT_CONVERT | 1 << 10 | |
WANT_FINALIZE | 1 << 11 | |
WANT_CHECKACCESS | 1 << 12 | |
WANT_CALL | 1 << 13 | |
WANT_CONSTRUCT | 1 << 14 | |
WANT_HASINSTANCE | 1 << 15 | |
WANT_TRACE | 1 << 16 | |
USE_JSSTUB_FOR_ADDPROPERTY | 1 << 17 | |
USE_JSSTUB_FOR_DELPROPERTY | 1 << 18 | |
USE_JSSTUB_FOR_SETPROPERTY | 1 << 19 | |
DONT_ENUM_STATIC_PROPS | 1 << 20 | |
DONT_ENUM_QUERY_INTERFACE | 1 << 21 | |
DONT_ASK_INSTANCE_FOR_SCRIPTABLE | 1 << 22 | |
CLASSINFO_INTERFACES_ONLY | 1 << 23 | |
ALLOW_PROP_MODS_DURING_RESOLVE | 1 << 24 | |
ALLOW_PROP_MODS_TO_PROTOTYPE | 1 << 25 | |
DONT_SHARE_PROTOTYPE | 1 << 26 | |
DONT_REFLECT_INTERFACE_NAMES | 1 << 27 | |
WANT_EQUALITY | 1 << 28 | |
WANT_OUTER_OBJECT | 1 << 29 | |
WANT_INNER_OBJECT | 1 << 30 | |
RESERVED | 1 << 31 | The high order bit is RESERVED for consumers of these flags. No implementor of this interface should ever return flags with this bit set. |
void preCreate( in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj );
nativeObj
cx
globalObj
parentObj
void create( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj
void postCreate( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj
PRBool addProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
wrapper
cx
obj
id
vp
PRBool delProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
wrapper
cx
obj
id
vp
PRBool getProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
wrapper
cx
obj
id
vp
NS_SUCCESS_I_DID_SOMETHING
if this method does something.
PRBool setProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
wrapper
cx
obj
id
vp
NS_SUCCESS_I_DID_SOMETHING
if this method does something.
PRBool enumerate( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj
This method is called when the WANT_NEWENUMERATE
flag is set. It allows the object to implement the for..in
enumeration in JavaScript.
JSClass.enumerate
.PRBool newEnumerate( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 enum_op, in JSValPtr statep, out JSID idp );
wrapper
cx
JSContext
newEnumerate
is being called from.obj
JSObject
being enumerated.enum_op
statep
and idp
represent, as well as indicates how the function should behave. This will always be one of three values:JSENUMERATE_INIT
A new, opaque iterator state should be allocated and stored in statep
. You can use PRIVATE_TO_JSVAL()
to tag the pointer to be stored. If idp
is non-null, and provided the number of enumerable properties is known, the number of properties that will be enumerated should be returned as an integer jsval
in idp.
If idp
is non-null and the number of enumerable properties cannot be computed in advance, idp
should be set to
.JSVAL_ZERO
idp
.JSENUMERATE_NEXT
A previously allocated opaque iterator state is passed in via statep
. Return the next jsid
in the iteration using idp
. The opaque iterator state pointed at by statep
is destroyed and *statep
is set to JSVAL_NULL
if there are no properties left to enumerate.
JSENUMERATE_DESTROY
This function should destroy the opaque iterator state previously allocated in statep
by this function when enum_op
was JSENUMERATE_INIT
.
statep
jsval
whose meaning depends on the value of enum_op
.idp
jsid
whose meaning depends on the value of enum_op
.Return value
This should (although does not need to) return PR_TRUE
to indicate success or must return PR_FALSE
to indicate failure.
This method is called when the WANT_NEWRESOLVE
flag is set. When this method is called, XPConnect is attempting to resolve a lazy property named by id
on obj
. The JS engine will check if the property named by id
is defined after this method has been called.
JSNewResolveOp
.PRBool newResolve( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 flags, out JSObjectPtr objp );
wrapper
cx
JSContext
newResolve
is being called from.obj
JSObject
that the property named by id
that is being accessed.id
jsval
.flags
id
. See JS_LookupProperty
for the flags and their meaning.objp
JSObject
that the property named by id
has been defined on. If the property named by id
was not defined, this should be set to NULL
. This should (although does not need to) return PR_TRUE
to indicate success or must return PR_FALSE
to indicate failure.
PRBool convert( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 type, in JSValPtr vp );
wrapper
cx
obj
type
vp
void finalize( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj
PRBool checkAccess( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 mode, in JSValPtr vp );
wrapper
cx
obj
id
mode
vp
PRBool call( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp );
wrapper
cx
obj
argc
argv
vp
PRBool construct( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp );
wrapper
cx
obj
argc
argv
vp
PRBool hasInstance( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val, out PRBool bp );
wrapper
cx
obj
val
bp
void trace( in nsIXPConnectWrappedNative wrapper, in JSTracerPtr trc, in JSObjectPtr obj );
wrapper
trc
obj
PRBool equality( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val );
wrapper
cx
obj
val
JSObjectPtr outerObject( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj
JSObjectPtr innerObject( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
wrapper
cx
obj