2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIXPConnect.idl"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Note: This is not really an XPCOM interface. For example, callers must
|
|
|
|
* guarantee that they set the *_retval of the various methods that return a
|
2012-10-25 09:32:24 -07:00
|
|
|
* boolean to PR_TRUE before making the call. Implementations may skip writing
|
|
|
|
* to *_retval unless they want to return PR_FALSE.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
|
2012-07-13 01:55:14 -07:00
|
|
|
[uuid(c4788e02-3239-490a-8aeb-60fad08303fd)]
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsIXPCScriptable : nsISupports
|
|
|
|
{
|
|
|
|
/* bitflags used for 'flags' (only 32 bits available!) */
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t WANT_PRECREATE = 1 << 0;
|
|
|
|
const uint32_t WANT_CREATE = 1 << 1;
|
|
|
|
const uint32_t WANT_POSTCREATE = 1 << 2;
|
|
|
|
const uint32_t WANT_ADDPROPERTY = 1 << 3;
|
|
|
|
const uint32_t WANT_DELPROPERTY = 1 << 4;
|
|
|
|
const uint32_t WANT_GETPROPERTY = 1 << 5;
|
|
|
|
const uint32_t WANT_SETPROPERTY = 1 << 6;
|
|
|
|
const uint32_t WANT_ENUMERATE = 1 << 7;
|
|
|
|
const uint32_t WANT_NEWENUMERATE = 1 << 8;
|
|
|
|
const uint32_t WANT_NEWRESOLVE = 1 << 9;
|
|
|
|
const uint32_t WANT_CONVERT = 1 << 10;
|
|
|
|
const uint32_t WANT_FINALIZE = 1 << 11;
|
|
|
|
const uint32_t WANT_CHECKACCESS = 1 << 12;
|
|
|
|
const uint32_t WANT_CALL = 1 << 13;
|
|
|
|
const uint32_t WANT_CONSTRUCT = 1 << 14;
|
|
|
|
const uint32_t WANT_HASINSTANCE = 1 << 15;
|
2012-03-05 15:22:43 -08:00
|
|
|
// Unused bit here!
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t USE_JSSTUB_FOR_ADDPROPERTY = 1 << 17;
|
|
|
|
const uint32_t USE_JSSTUB_FOR_DELPROPERTY = 1 << 18;
|
|
|
|
const uint32_t USE_JSSTUB_FOR_SETPROPERTY = 1 << 19;
|
|
|
|
const uint32_t DONT_ENUM_STATIC_PROPS = 1 << 20;
|
|
|
|
const uint32_t DONT_ENUM_QUERY_INTERFACE = 1 << 21;
|
|
|
|
const uint32_t DONT_ASK_INSTANCE_FOR_SCRIPTABLE = 1 << 22;
|
|
|
|
const uint32_t CLASSINFO_INTERFACES_ONLY = 1 << 23;
|
|
|
|
const uint32_t ALLOW_PROP_MODS_DURING_RESOLVE = 1 << 24;
|
|
|
|
const uint32_t ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
|
|
|
|
const uint32_t IS_GLOBAL_OBJECT = 1 << 26;
|
|
|
|
const uint32_t DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
|
|
|
|
const uint32_t WANT_EQUALITY = 1 << 28;
|
|
|
|
const uint32_t WANT_OUTER_OBJECT = 1 << 29;
|
|
|
|
const uint32_t USE_STUB_EQUALITY_HOOK = 1 << 30;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The high order bit is RESERVED for consumers of these flags.
|
|
|
|
// No implementor of this interface should ever return flags
|
|
|
|
// with this bit set.
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t RESERVED = 1 << 31;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
readonly attribute string className;
|
2012-08-22 08:56:38 -07:00
|
|
|
[notxpcom,nostdcall] uint32_t getScriptableFlags();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void preCreate(in nsISupports nativeObj, in JSContextPtr cx,
|
|
|
|
in JSObjectPtr globalObj, out JSObjectPtr parentObj);
|
|
|
|
|
|
|
|
void create(in nsIXPConnectWrappedNative wrapper,
|
|
|
|
in JSContextPtr cx, in JSObjectPtr obj);
|
|
|
|
|
2012-07-13 01:55:14 -07:00
|
|
|
// Both methods here are protected by WANT_POSTCREATE. If you want to do
|
|
|
|
// something after a wrapper is created, there's a good chance you also
|
|
|
|
// want to do something when the wrapper is transplanted to a new
|
|
|
|
// compartment.
|
2007-03-22 10:30:00 -07:00
|
|
|
void postCreate(in nsIXPConnectWrappedNative wrapper,
|
|
|
|
in JSContextPtr cx, in JSObjectPtr obj);
|
|
|
|
|
2012-07-13 01:55:14 -07:00
|
|
|
void postTransplant(in nsIXPConnectWrappedNative wrapper,
|
|
|
|
in JSContextPtr cx, in JSObjectPtr obj);
|
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean addProperty(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSValPtr vp);
|
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean delProperty(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSValPtr vp);
|
|
|
|
|
|
|
|
// The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
|
|
|
|
// this method does something.
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean getProperty(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSValPtr vp);
|
|
|
|
|
|
|
|
// The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
|
|
|
|
// this method does something.
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean setProperty(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSValPtr vp);
|
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean enumerate(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj);
|
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean newEnumerate(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t enum_op, in JSValPtr statep, out jsid idp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean newResolve(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t flags, out JSObjectPtr objp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean convert(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t type, in JSValPtr vp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void finalize(in nsIXPConnectWrappedNative wrapper,
|
2012-03-19 07:34:55 -07:00
|
|
|
in JSFreeOpPtr fop, in JSObjectPtr obj);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean checkAccess(in nsIXPConnectWrappedNative wrapper,
|
2010-07-14 23:19:36 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t mode, in JSValPtr vp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean call(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t argc, in JSValPtr argv, in JSValPtr vp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean construct(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t argc, in JSValPtr argv, in JSValPtr vp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean hasInstance(in nsIXPConnectWrappedNative wrapper,
|
2007-03-22 10:30:00 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj,
|
2011-08-06 22:03:32 -07:00
|
|
|
in jsval val, out boolean bp);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-06 22:03:32 -07:00
|
|
|
boolean equality(in nsIXPConnectWrappedNative wrapper,
|
2010-05-12 06:18:51 -07:00
|
|
|
in JSContextPtr cx, in JSObjectPtr obj, in jsval val);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
|
|
|
|
in JSContextPtr cx, in JSObjectPtr obj);
|
2008-08-19 19:38:24 -07:00
|
|
|
|
|
|
|
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
2009-09-28 14:00:35 -07:00
|
|
|
|
|
|
|
%{ C++
|
|
|
|
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
|
|
|
|
#define NS_XPCCLASSINFO_IID \
|
2010-01-12 06:24:00 -08:00
|
|
|
{ 0x9a5b0342, 0x0f70, 0x4d31, \
|
|
|
|
{ 0xb7, 0xd7, 0x29, 0x68, 0xa5, 0x70, 0x4b, 0xd8 } }
|
2009-09-28 14:00:35 -07:00
|
|
|
|
|
|
|
class NS_NO_VTABLE nsXPCClassInfo : public nsIClassInfo,
|
|
|
|
public nsIXPCScriptable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XPCCLASSINFO_IID)
|
|
|
|
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef() = 0;
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release() = 0;
|
|
|
|
|
|
|
|
virtual void PreserveWrapper(nsISupports *aNative) = 0;
|
2010-01-12 06:24:00 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual uint32_t GetInterfacesBitmap() = 0;
|
2009-09-28 14:00:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCClassInfo, NS_XPCCLASSINFO_IID)
|
|
|
|
|
|
|
|
inline
|
|
|
|
nsresult
|
|
|
|
CallQueryInterface(nsISupports* aSourcePtr,
|
|
|
|
nsRefPtrGetterAddRefs<nsXPCClassInfo> aDestPtr)
|
|
|
|
{
|
|
|
|
return CallQueryInterface(aSourcePtr,
|
|
|
|
static_cast<nsXPCClassInfo**>(aDestPtr));
|
|
|
|
}
|
|
|
|
|
|
|
|
%}
|