*_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
Method overview
Attributes
Attribute | Type | Description |
className | string | |
scriptableFlags | PRUint32 | The bitwise or'd set of flags (define below) that indicate the behavior of this object. |
Constants
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. |
Methods
preCreate()
void preCreate( in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj );
Parameters
nativeObj
cx
globalObj
parentObj
create()
void create( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
postCreate()
void postCreate( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
addProperty()
PRBool addProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
Parameters
wrapper
cx
obj
id
vp
Return value
delProperty()
PRBool delProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
Parameters
wrapper
cx
obj
id
vp
Return value
getProperty()
PRBool getProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
Parameters
wrapper
cx
obj
id
vp
Return value
NS_SUCCESS_I_DID_SOMETHING
if this method does something.
setProperty()
PRBool setProperty( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp );
Parameters
wrapper
cx
obj
id
vp
Return value
NS_SUCCESS_I_DID_SOMETHING
if this method does something.
enumerate()
PRBool enumerate( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
Return value
newEnumerate()
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 );
Parameters
wrapper
cx
- The pointer to the
JSContext
newEnumerate
is being called from.
obj
- The pointer to the
JSObject
being enumerated.
enum_op
- Indicates what
statep
andidp
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
- An in/out pointer to a
jsval
whose meaning depends on the value ofenum_op
.
idp
- An in/out pointer to a
jsid
whose meaning depends on the value ofenum_op
.
Return value
This should (although does not need to) return PR_TRUE
to indicate success or must return PR_FALSE
to indicate failure.
newResolve()
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 );
Parameters
wrapper
cx
- The pointer to the
JSContext
newResolve
is being called from.
obj
- The pointer to the
JSObject
that the property named byid
that is being accessed.
id
- The name or index of the property being accessed as a
jsval
.
flags
- The flags that describe the access to the property named by
id
. SeeJS_LookupProperty
for the flags and their meaning.
objp
- An out parameter that, on success, points to the
JSObject
that the property named byid
has been defined on. If the property named byid
was not defined, this should be set toNULL
.
Return value
This should (although does not need to) return PR_TRUE
to indicate success or must return PR_FALSE
to indicate failure.
convert()
PRBool convert( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 type, in JSValPtr vp );
Parameters
wrapper
cx
obj
type
vp
Return value
finalize()
void finalize( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
checkAccess()
PRBool checkAccess( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 mode, in JSValPtr vp );
Parameters
wrapper
cx
obj
id
mode
vp
Return value
call()
PRBool call( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp );
Parameters
wrapper
cx
obj
argc
argv
vp
Return value
construct()
PRBool construct( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp );
Parameters
wrapper
cx
obj
argc
argv
vp
Return value
hasInstance()
PRBool hasInstance( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val, out PRBool bp );
Parameters
wrapper
cx
obj
val
bp
Return value
trace()
void trace( in nsIXPConnectWrappedNative wrapper, in JSTracerPtr trc, in JSObjectPtr obj );
Parameters
wrapper
trc
obj
equality()
PRBool equality( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val );
Parameters
wrapper
cx
obj
val
Return value
outerObject()
JSObjectPtr outerObject( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
Return value
innerObject()
JSObjectPtr innerObject( in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj );
Parameters
wrapper
cx
obj
Return value