|
|
Line 31: |
Line 31: |
| === nsIScriptable interface === | | === nsIScriptable interface === |
|
| |
|
| Something like (recall that xpidl capitalizes names for C++):
| | Using XPCOM vocabulary (attribute for property, e.g.), the interface should look something like this (recall that xpidl capitalizes names for C++): |
|
| |
|
| typedef nsDISPID PRUint32;
| | typedef PRUint32 nsDISPID; |
|
| | |
| [scriptable, uuid(...)]
| | [scriptable, uuid(...)] |
| interface nsIScriptable : nsISupports
| | interface nsIScriptable : nsISupports |
| {
| | { |
| // Deletes a member by DISPID.
| | // Maps a single member name to its corresponding DISPID, which can then |
| deleteMemberByDispID(in nsDISPID dispID);
| | // be used on subsequent calls to invoke() |
|
| | nsDISPID getDispID(in AString aName); |
| // Deletes a member by name.
| | |
| deleteMemberByName(in DOMString &name);
| | // Deletes a member by DISPID. |
|
| | deleteMemberByDispID(in nsDISPID aDispID); |
| // Maps a single member name to its corresponding DISPID, which can then
| | |
| // be used on subsequent calls to Invoke()
| | // Deletes a member by name. |
| nsDISPID getDispID(in DOMString &name);
| | deleteMemberByName(in AString aName); |
|
| | |
| // Retrieves the name of a member.
| | // Retrieves the name of a member. |
| DOMString getMemberName(in nsDISPID dispID);
| | AString getMemberName(in nsDISPID aDispID); |
|
| | |
| // Retrieves a member's properties.
| | // Retrieves a member's properties. |
| PRUint32 getMemberProperties(in nsDISPID dispID, in PRUint32 propsToFetch);
| | PRUint32 getMemberFlags(in nsDISPID aDispID); |
|
| | |
| // Retrieves the interface for the namespace parent of an object.
| | // Flags describing members. |
| nsIScriptable getNameSpaceParent();
| | const PRUint32 MEMBER_METHOD = 1; // member is a method |
|
| | const PRUint32 MEMBER_CONSTRUCTOR = 2; // member is a constructor |
| // Enumerates the members of the object.
| | const PRUint32 MEMBER_ATTRIBUTE = 4; // member is an attribute |
| nsDISPID getNextDispID(in PRUint32 flags, in nsDISPID dispid);
| | const PRUint32 MEMBER_READONLY = 8; // member is readonly |
|
| | |
| // Provides access to properties and methods exposed by an IScriptable object.
| | // Retrieves the interface for the scope parent of an object. |
| nsIVariant invoke(in nsDISPID dispID, in nsLOCALE????? locale,
| | nsIScriptable getParentObject(); |
| // flags for the call
| | |
| in PRUint32 flags,
| | // Enumerates the members of the object. |
| // Like the MSCOM DISPARGS struct.
| | nsDISPID getNextDispID(in PRUint32 aFlags, in nsDISPID aDispID); |
| [array, sizeis(aNumArgs)] in nsIVariant aArgs,
| | |
| in PRUint32 aNumArgs,
| | // Invoke a method or access an attribute exposed by an IScriptable. |
| // Array of DISPIDs of named args.
| | |
| // XXX - semantics of DISPID and params is not clear.
| | // XXX - semantics of DISPID and params is not clear. |
| // presumably all possible param names must also provide
| | // presumably all possible param names must also provide |
| // a dispid when asked.
| | // a dispid when asked. |
| [array, sizeof(aNumNamedArgs)] in PRUint32 aNamedArgs,
| | |
| in PRUint32 aNumNamedArgs,
| | // MSCOM EXCEPTINFO param not used - existing |
| // End of DISPARGS struct
| | // nsIExceptionService semantics should be used instead. |
| out nsIVariant *result,
| | |
| // MSCOM EXCEPTINFO param not used - existing
| | nsIVariant invoke(in nsDISPID aDispID, |
| // nsIExceptionService semantics should be used instead.
| | in PRUint32 aInvokeHow, |
| // Service provider - may be NULL.
| | [array, sizeis(aNumArgs)] in nsIVariant aArgs, |
| in nsISupports aServiceProvider);
| | in PRUint32 aNumArgs, |
| };
| | [array, sizeof(aNumNamedArgs)] in nsDISPID aNamedArgs, |
|
| | in PRUint32 aNumNamedArgs, |
| // Flags for Invoke
| | out nsIVariant aResult); |
| const PRUint32 SCRIPTABLE_METHOD = 0 //The member is invoked as a method.
| | |
| const PRUint32 SCRIPTABLE_PROPERTYGET = 1; // The member is retrieved as a property or data member
| | // Values for the aInvokeHow argument to invoke. |
| const PRUint32 SCRIPTABLE_PROPERTYPUT = 2; // The member is changed as a property or data member
| | const PRUint32 INVOKE_CALL = 0; // invoke as a method |
| const PRUint32 SCRIPTABLE_CONSTRUCT = 3; // The member is being used as a constructor.
| | const PRUint32 INVOKE_CONSTRUCT = 1; // invoke as a constructor |
|
| | const PRUint32 INVOKE_GETATTR = 2; // get an attribute value |
| // Predefined DISPID values
| | const PRUint32 INVOKE_SETATTR = 3; // set an attribute value |
| ...
| | |
|
| | // Predefined nsDISPID values |
| // a subset of property flags for GetMemberProperties
| | ... |
| // The distinction between 'Can' and 'Cannot' escapes me...
| | }; |
| const PRUint32 ScriptablePropCanGet // The member can be obtained using SCRIPTABLE_PROPERTYGET.
| |
| const PRUint32 ScriptablePropCannotGet // The member cannot be obtained using SCRIPTABLE_PROPERTYGET.
| |
| const PRUint32 ScriptablePropCanPut // The member can be set using SCRIPTABLE_PROPERTYPUT.
| |
| const PRUint32 ScriptablePropCannotPut // The member cannot be set using SCRIPTABLE_PROPERTYPUT.
| |
| const PRUint32 ScriptablePropCanCall // The member can be called as a method using SCRIPTABLE_METHOD.
| |
| const PRUint32 ScriptablePropCannotCall // The member cannot be called as a method using SCRIPTABLE_METHOD.
| |
| const PRUint32 ScriptablePropCanConstruct // The member can be called as a constructor using SCRIPTABLE_CONSTRUCT.
| |
| const PRUint32 ScriptablePropCannotConstruct // The member cannot be called as a constructor using SCRIPTABLE_CONSTRUCT.
| |
|
| |
| // MSCOM flags *not* supported.
| |
| // fdexScriptablePropCanPutRef The member can be set using DISPATCH_PROPERTYPUTREF.
| |
| // fdexScriptablePropCannotPutRef The member cannot be set using DISPATCH_PROPERTYPUTREF.
| |
| // fdexPropCanSourceEvents The member can fire events.
| |
| // fdexPropCannotSourceEvents The member cannot fire events
| |
| // fdexScriptablePropNoSideEffects The member does not have any side effects. For example, a debugger could safely get/set/call this member without changing the state of the script being debugged.
| |
| // fdexScriptablePropDynamicType The member is dynamic and can change during the lifetime of the object.
| |
|
| |
|
| === Language Helpers === | | === Language Helpers === |