Back to index

lightning-sunbird  0.9+nobinonly
nsIXPCScriptable.idl
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is Mozilla Communicator client code, released
00017  * March 31, 1998.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1998
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   John Bandhauer <jband@netscape.com> (original author)
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "nsISupports.idl"
00042 #include "nsIXPConnect.idl"
00043 
00044 %{ C++
00045 #define NS_SUCCESS_I_DID_SOMETHING \
00046    (NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCONNECT,1))
00047 %}
00048 
00056 [uuid(9cc0c2e0-f769-4f14-8cd6-2d2d40466f6c)]
00057 interface nsIXPCScriptable : nsISupports
00058 {
00059     /* bitflags used for 'flags' (only 32 bits available!) */
00060 
00061     const PRUint32 WANT_PRECREATE                   = 1 <<  0;
00062     const PRUint32 WANT_CREATE                      = 1 <<  1;
00063     const PRUint32 WANT_POSTCREATE                  = 1 <<  2;
00064     const PRUint32 WANT_ADDPROPERTY                 = 1 <<  3;
00065     const PRUint32 WANT_DELPROPERTY                 = 1 <<  4;
00066     const PRUint32 WANT_GETPROPERTY                 = 1 <<  5;
00067     const PRUint32 WANT_SETPROPERTY                 = 1 <<  6;
00068     const PRUint32 WANT_ENUMERATE                   = 1 <<  7;
00069     const PRUint32 WANT_NEWENUMERATE                = 1 <<  8;
00070     const PRUint32 WANT_NEWRESOLVE                  = 1 <<  9;
00071     const PRUint32 WANT_CONVERT                     = 1 << 10;
00072     const PRUint32 WANT_FINALIZE                    = 1 << 11;
00073     const PRUint32 WANT_CHECKACCESS                 = 1 << 12;
00074     const PRUint32 WANT_CALL                        = 1 << 13;
00075     const PRUint32 WANT_CONSTRUCT                   = 1 << 14;
00076     const PRUint32 WANT_HASINSTANCE                 = 1 << 15;
00077     const PRUint32 WANT_MARK                        = 1 << 16;
00078     const PRUint32 USE_JSSTUB_FOR_ADDPROPERTY       = 1 << 17;
00079     const PRUint32 USE_JSSTUB_FOR_DELPROPERTY       = 1 << 18;
00080     const PRUint32 USE_JSSTUB_FOR_SETPROPERTY       = 1 << 19;
00081     const PRUint32 DONT_ENUM_STATIC_PROPS           = 1 << 20;
00082     const PRUint32 DONT_ENUM_QUERY_INTERFACE        = 1 << 21;
00083     const PRUint32 DONT_ASK_INSTANCE_FOR_SCRIPTABLE = 1 << 22;
00084     const PRUint32 CLASSINFO_INTERFACES_ONLY        = 1 << 23;
00085     const PRUint32 ALLOW_PROP_MODS_DURING_RESOLVE   = 1 << 24;
00086     const PRUint32 ALLOW_PROP_MODS_TO_PROTOTYPE     = 1 << 25;
00087     const PRUint32 DONT_SHARE_PROTOTYPE             = 1 << 26;
00088     const PRUint32 DONT_REFLECT_INTERFACE_NAMES     = 1 << 27;
00089     const PRUint32 WANT_EQUALITY                    = 1 << 28;
00090     const PRUint32 WANT_OUTER_OBJECT                = 1 << 29;
00091     const PRUint32 WANT_INNER_OBJECT                = 1 << 30;
00092 
00093     // The high order bit is RESERVED for consumers of these flags. 
00094     // No implementor of this interface should ever return flags 
00095     // with this bit set.
00096     const PRUint32 RESERVED                         = 1 << 31;
00097 
00098     readonly attribute string   className;
00099     readonly attribute PRUint32 scriptableFlags;
00100 
00101     void   preCreate(in nsISupports nativeObj, in JSContextPtr cx,
00102                      in JSObjectPtr globalObj, out JSObjectPtr parentObj);
00103 
00104     void   create(in nsIXPConnectWrappedNative wrapper,
00105                   in JSContextPtr cx, in JSObjectPtr obj);
00106 
00107     void   postCreate(in nsIXPConnectWrappedNative wrapper,
00108                       in JSContextPtr cx, in JSObjectPtr obj);
00109 
00110     PRBool addProperty(in nsIXPConnectWrappedNative wrapper,
00111                        in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00112                        in JSValPtr vp);
00113 
00114     PRBool delProperty(in nsIXPConnectWrappedNative wrapper,
00115                        in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00116                        in JSValPtr vp);
00117 
00118     // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
00119     // this method does something.
00120     PRBool getProperty(in nsIXPConnectWrappedNative wrapper,
00121                        in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00122                        in JSValPtr vp);
00123 
00124     // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
00125     // this method does something.
00126     PRBool setProperty(in nsIXPConnectWrappedNative wrapper,
00127                        in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00128                        in JSValPtr vp);
00129 
00130     PRBool enumerate(in nsIXPConnectWrappedNative wrapper,
00131                      in JSContextPtr cx, in JSObjectPtr obj);
00132 
00133     PRBool newEnumerate(in nsIXPConnectWrappedNative wrapper,
00134                         in JSContextPtr cx, in JSObjectPtr obj,
00135                         in PRUint32 enum_op, in JSValPtr statep, out JSID idp);
00136 
00137     PRBool newResolve(in nsIXPConnectWrappedNative wrapper,
00138                       in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00139                       in PRUint32 flags, out JSObjectPtr objp);
00140 
00141     PRBool convert(in nsIXPConnectWrappedNative wrapper,
00142                    in JSContextPtr cx, in JSObjectPtr obj,
00143                    in PRUint32 type, in JSValPtr vp);
00144 
00145     void   finalize(in nsIXPConnectWrappedNative wrapper,
00146                     in JSContextPtr cx, in JSObjectPtr obj);
00147 
00148     PRBool checkAccess(in nsIXPConnectWrappedNative wrapper,
00149                        in JSContextPtr cx, in JSObjectPtr obj, in JSVal id,
00150                        in PRUint32 mode, in JSValPtr vp);
00151 
00152     PRBool call(in nsIXPConnectWrappedNative wrapper,
00153                 in JSContextPtr cx, in JSObjectPtr obj,
00154                 in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
00155 
00156     PRBool construct(in nsIXPConnectWrappedNative wrapper,
00157                      in JSContextPtr cx, in JSObjectPtr obj,
00158                      in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
00159 
00160     PRBool hasInstance(in nsIXPConnectWrappedNative wrapper,
00161                        in JSContextPtr cx, in JSObjectPtr obj,
00162                        in JSVal val, out PRBool bp);
00163 
00164     PRUint32 mark(in nsIXPConnectWrappedNative wrapper,
00165                   in JSContextPtr cx, in JSObjectPtr obj, in voidPtr arg);
00166 
00167     PRBool equality(in nsIXPConnectWrappedNative wrapper,
00168                     in JSContextPtr cx, in JSObjectPtr obj, in JSVal val);
00169 
00170     JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
00171                             in JSContextPtr cx, in JSObjectPtr obj);
00172 
00173     JSObjectPtr innerObject(in nsIXPConnectWrappedNative wrapper,
00174                             in JSContextPtr cx, in JSObjectPtr obj);
00175 };