2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code, released
|
|
|
|
* March 31, 1998.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* John Bandhauer <jband@netscape.com> (original author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIXPConnect.idl"
|
|
|
|
|
|
|
|
%{ C++
|
|
|
|
#define NS_SUCCESS_I_DID_SOMETHING \
|
|
|
|
(NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCONNECT,1))
|
2010-05-28 16:01:08 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Classes that want to only be touched by chrome (or from code whose filename
|
|
|
|
* begins with chrome://global/) shoudl return this from their scriptable
|
|
|
|
* helper's PreCreate hook.
|
|
|
|
*/
|
2009-04-23 00:21:22 -07:00
|
|
|
#define NS_SUCCESS_CHROME_ACCESS_ONLY \
|
|
|
|
(NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCONNECT,2))
|
2009-09-28 14:00:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Classes that want slim wrappers should return NS_SUCCESS_ALLOW_SLIM_WRAPPERS
|
|
|
|
* from their scriptable helper's PreCreate hook. They must also force a parent
|
|
|
|
* for their wrapper (from the PreCreate hook), they must implement
|
|
|
|
* nsWrapperCache and their scriptable helper must implement nsXPCClassInfo and
|
|
|
|
* must return DONT_ASK_INSTANCE_FOR_SCRIPTABLE in the flags.
|
|
|
|
*/
|
2009-05-12 13:20:42 -07:00
|
|
|
#define NS_SUCCESS_ALLOW_SLIM_WRAPPERS \
|
|
|
|
(NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCONNECT,3))
|
2007-03-22 10:30:00 -07:00
|
|
|
%}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* boolean to PR_TRUE before making the call. Implementations may skip writing
|
|
|
|
* to *_retval unless they want to return PR_FALSE.
|
|
|
|
*/
|
|
|
|
|
2012-01-04 14:13:15 -08:00
|
|
|
[uuid(fca22e1e-a2bf-456e-83db-f73e8de0f7c5)]
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsIXPCScriptable : nsISupports
|
|
|
|
{
|
|
|
|
/* bitflags used for 'flags' (only 32 bits available!) */
|
|
|
|
|
|
|
|
const PRUint32 WANT_PRECREATE = 1 << 0;
|
|
|
|
const PRUint32 WANT_CREATE = 1 << 1;
|
|
|
|
const PRUint32 WANT_POSTCREATE = 1 << 2;
|
|
|
|
const PRUint32 WANT_ADDPROPERTY = 1 << 3;
|
|
|
|
const PRUint32 WANT_DELPROPERTY = 1 << 4;
|
|
|
|
const PRUint32 WANT_GETPROPERTY = 1 << 5;
|
|
|
|
const PRUint32 WANT_SETPROPERTY = 1 << 6;
|
|
|
|
const PRUint32 WANT_ENUMERATE = 1 << 7;
|
|
|
|
const PRUint32 WANT_NEWENUMERATE = 1 << 8;
|
|
|
|
const PRUint32 WANT_NEWRESOLVE = 1 << 9;
|
|
|
|
const PRUint32 WANT_CONVERT = 1 << 10;
|
|
|
|
const PRUint32 WANT_FINALIZE = 1 << 11;
|
|
|
|
const PRUint32 WANT_CHECKACCESS = 1 << 12;
|
|
|
|
const PRUint32 WANT_CALL = 1 << 13;
|
|
|
|
const PRUint32 WANT_CONSTRUCT = 1 << 14;
|
|
|
|
const PRUint32 WANT_HASINSTANCE = 1 << 15;
|
2012-03-05 15:22:43 -08:00
|
|
|
// Unused bit here!
|
2007-03-22 10:30:00 -07:00
|
|
|
const PRUint32 USE_JSSTUB_FOR_ADDPROPERTY = 1 << 17;
|
|
|
|
const PRUint32 USE_JSSTUB_FOR_DELPROPERTY = 1 << 18;
|
|
|
|
const PRUint32 USE_JSSTUB_FOR_SETPROPERTY = 1 << 19;
|
|
|
|
const PRUint32 DONT_ENUM_STATIC_PROPS = 1 << 20;
|
|
|
|
const PRUint32 DONT_ENUM_QUERY_INTERFACE = 1 << 21;
|
|
|
|
const PRUint32 DONT_ASK_INSTANCE_FOR_SCRIPTABLE = 1 << 22;
|
|
|
|
const PRUint32 CLASSINFO_INTERFACES_ONLY = 1 << 23;
|
|
|
|
const PRUint32 ALLOW_PROP_MODS_DURING_RESOLVE = 1 << 24;
|
|
|
|
const PRUint32 ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
|
2012-03-05 15:22:44 -08:00
|
|
|
const PRUint32 IS_GLOBAL_OBJECT = 1 << 26;
|
2007-03-22 10:30:00 -07:00
|
|
|
const PRUint32 DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
|
|
|
|
const PRUint32 WANT_EQUALITY = 1 << 28;
|
|
|
|
const PRUint32 WANT_OUTER_OBJECT = 1 << 29;
|
2011-09-07 08:06:33 -07:00
|
|
|
const PRUint32 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.
|
|
|
|
const PRUint32 RESERVED = 1 << 31;
|
|
|
|
|
|
|
|
readonly attribute string className;
|
|
|
|
readonly attribute PRUint32 scriptableFlags;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
void postCreate(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,
|
2010-07-14 23:19:36 -07:00
|
|
|
in PRUint32 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,
|
2007-03-22 10:30:00 -07:00
|
|
|
in PRUint32 flags, out JSObjectPtr objp);
|
|
|
|
|
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,
|
|
|
|
in PRUint32 type, in JSValPtr vp);
|
|
|
|
|
|
|
|
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,
|
2007-03-22 10:30:00 -07:00
|
|
|
in PRUint32 mode, in JSValPtr vp);
|
|
|
|
|
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,
|
|
|
|
in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
|
|
|
|
|
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,
|
|
|
|
in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
|
|
|
|
|
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
|
|
|
|
|
|
|
virtual PRUint32 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));
|
|
|
|
}
|
|
|
|
|
|
|
|
%}
|