Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / modules / oji / public / nsISecureJNI2.h
blob43f6e27daf976b1804e65ffd4b48d61ca457b9f1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsISecureJNI2_h___
39 #define nsISecureJNI2_h___
41 #include "nsISupports.h"
42 #include "nsIFactory.h"
43 #include "nsISecurityContext.h"
44 #include "jni.h"
46 enum jni_type
48 jobject_type = 0,
49 jboolean_type,
50 jbyte_type,
51 jchar_type,
52 jshort_type,
53 jint_type,
54 jlong_type,
55 jfloat_type,
56 jdouble_type,
57 jvoid_type
60 class nsISecureJNI2 : public nsISupports {
61 public:
63 /**
64 * Create new Java object in LiveConnect.
66 * @param clazz -- Java Class object.
67 * @param methodID -- Method id
68 * @param args -- arguments for invoking the constructor.
69 * @param result -- return new Java object.
70 * @param ctx -- security context
72 NS_IMETHOD NewObject(/*[in]*/ jclass clazz,
73 /*[in]*/ jmethodID methodID,
74 /*[in]*/ jvalue *args,
75 /*[out]*/ jobject* result,
76 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
78 /**
79 * Invoke method on Java object in LiveConnect.
81 * @param type -- Return type
82 * @param obj -- Java object.
83 * @param methodID -- method id
84 * @param args -- arguments for invoking the constructor.
85 * @param result -- return result of invocation.
86 * @param ctx -- security context
88 NS_IMETHOD CallMethod(/*[in]*/ jni_type type,
89 /*[in]*/ jobject obj,
90 /*[in]*/ jmethodID methodID,
91 /*[in]*/ jvalue *args,
92 /*[out]*/ jvalue* result,
93 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
95 /**
96 * Invoke non-virtual method on Java object in LiveConnect.
98 * @param type -- Return type
99 * @param obj -- Java object.
100 * @param clazz -- Class object
101 * @param methodID -- method id
102 * @param args -- arguments for invoking the constructor.
103 * @param ctx -- security context
104 * @param result -- return result of invocation.
106 NS_IMETHOD CallNonvirtualMethod(/*[in]*/ jni_type type,
107 /*[in]*/ jobject obj,
108 /*[in]*/ jclass clazz,
109 /*[in]*/ jmethodID methodID,
110 /*[in]*/ jvalue *args,
111 /*[out]*/ jvalue* result,
112 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
115 * Get a field on Java object in LiveConnect.
117 * @param type -- Return type
118 * @param obj -- Java object.
119 * @param fieldID -- field id
120 * @param result -- return field value
121 * @param ctx -- security context
123 NS_IMETHOD GetField(/*[in]*/ jni_type type,
124 /*[in]*/ jobject obj,
125 /*[in]*/ jfieldID fieldID,
126 /*[out]*/ jvalue* result,
127 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
130 * Set a field on Java object in LiveConnect.
132 * @param type -- Return type
133 * @param obj -- Java object.
134 * @param fieldID -- field id
135 * @param val -- field value to set
136 * @param ctx -- security context
138 NS_IMETHOD SetField(/*[in]*/ jni_type type,
139 /*[in]*/ jobject obj,
140 /*[in]*/ jfieldID fieldID,
141 /*[in]*/ jvalue val,
142 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
145 * Invoke static method on Java object in LiveConnect.
147 * @param type -- Return type
148 * @param clazz -- Class object.
149 * @param methodID -- method id
150 * @param args -- arguments for invoking the constructor.
151 * @param result -- return result of invocation.
152 * @param ctx -- security context
154 NS_IMETHOD CallStaticMethod(/*[in]*/ jni_type type,
155 /*[in]*/ jclass clazz,
156 /*[in]*/ jmethodID methodID,
157 /*[in]*/ jvalue *args,
158 /*[out]*/ jvalue* result,
159 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
162 * Get a static field on Java object in LiveConnect.
164 * @param type -- Return type
165 * @param clazz -- Class object.
166 * @param fieldID -- field id
167 * @param result -- return field value
168 * @param ctx -- security context
170 NS_IMETHOD GetStaticField(/*[in]*/ jni_type type,
171 /*[in]*/ jclass clazz,
172 /*[in]*/ jfieldID fieldID,
173 /*[out]*/ jvalue* result,
174 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
178 * Set a static field on Java object in LiveConnect.
180 * @param type -- Return type
181 * @param clazz -- Class object.
182 * @param fieldID -- field id
183 * @param val -- field value to set
184 * @param ctx -- security context
186 NS_IMETHOD SetStaticField(/*[in]*/ jni_type type,
187 /*[in]*/ jclass clazz,
188 /*[in]*/ jfieldID fieldID,
189 /*[in]*/ jvalue val,
190 /*[in]*/ nsISecurityContext* ctx = NULL) = 0;
193 NS_IMETHOD GetVersion(/*[out]*/ jint* version) = 0;
195 NS_IMETHOD DefineClass(/*[in]*/ const char* name,
196 /*[in]*/ jobject loader,
197 /*[in]*/ const jbyte *buf,
198 /*[in]*/ jsize len,
199 /*[out]*/ jclass* clazz) = 0;
201 NS_IMETHOD FindClass(/*[in]*/ const char* name,
202 /*[out]*/ jclass* clazz) = 0;
204 NS_IMETHOD GetSuperclass(/*[in]*/ jclass sub,
205 /*[out]*/ jclass* super) = 0;
207 NS_IMETHOD IsAssignableFrom(/*[in]*/ jclass sub,
208 /*[in]*/ jclass super,
209 /*[out]*/ jboolean* result) = 0;
211 NS_IMETHOD Throw(/*[in]*/ jthrowable obj,
212 /*[out]*/ jint* result) = 0;
214 NS_IMETHOD ThrowNew(/*[in]*/ jclass clazz,
215 /*[in]*/ const char *msg,
216 /*[out]*/ jint* result) = 0;
218 NS_IMETHOD ExceptionOccurred(/*[out]*/ jthrowable* result) = 0;
220 NS_IMETHOD ExceptionDescribe(void) = 0;
222 NS_IMETHOD ExceptionClear(void) = 0;
224 NS_IMETHOD FatalError(/*[in]*/ const char* msg) = 0;
226 NS_IMETHOD NewGlobalRef(/*[in]*/ jobject lobj,
227 /*[out]*/ jobject* result) = 0;
229 NS_IMETHOD DeleteGlobalRef(/*[in]*/ jobject gref) = 0;
231 NS_IMETHOD DeleteLocalRef(/*[in]*/ jobject obj) = 0;
233 NS_IMETHOD IsSameObject(/*[in]*/ jobject obj1,
234 /*[in]*/ jobject obj2,
235 /*[out]*/ jboolean* result) = 0;
237 NS_IMETHOD AllocObject(/*[in]*/ jclass clazz,
238 /*[out]*/ jobject* result) = 0;
240 NS_IMETHOD GetObjectClass(/*[in]*/ jobject obj,
241 /*[out]*/ jclass* result) = 0;
243 NS_IMETHOD IsInstanceOf(/*[in]*/ jobject obj,
244 /*[in]*/ jclass clazz,
245 /*[out]*/ jboolean* result) = 0;
247 NS_IMETHOD GetMethodID(/*[in]*/ jclass clazz,
248 /*[in]*/ const char* name,
249 /*[in]*/ const char* sig,
250 /*[out]*/ jmethodID* id) = 0;
252 NS_IMETHOD GetFieldID(/*[in]*/ jclass clazz,
253 /*[in]*/ const char* name,
254 /*[in]*/ const char* sig,
255 /*[out]*/ jfieldID* id) = 0;
257 NS_IMETHOD GetStaticMethodID(/*[in]*/ jclass clazz,
258 /*[in]*/ const char* name,
259 /*[in]*/ const char* sig,
260 /*[out]*/ jmethodID* id) = 0;
262 NS_IMETHOD GetStaticFieldID(/*[in]*/ jclass clazz,
263 /*[in]*/ const char* name,
264 /*[in]*/ const char* sig,
265 /*[out]*/ jfieldID* id) = 0;
267 NS_IMETHOD NewString(/*[in]*/ const jchar* unicode,
268 /*[in]*/ jsize len,
269 /*[out]*/ jstring* result) = 0;
271 NS_IMETHOD GetStringLength(/*[in]*/ jstring str,
272 /*[out]*/ jsize* result) = 0;
274 NS_IMETHOD GetStringChars(/*[in]*/ jstring str,
275 /*[in]*/ jboolean *isCopy,
276 /*[out]*/ const jchar** result) = 0;
278 NS_IMETHOD ReleaseStringChars(/*[in]*/ jstring str,
279 /*[in]*/ const jchar *chars) = 0;
281 NS_IMETHOD NewStringUTF(/*[in]*/ const char *utf,
282 /*[out]*/ jstring* result) = 0;
284 NS_IMETHOD GetStringUTFLength(/*[in]*/ jstring str,
285 /*[out]*/ jsize* result) = 0;
287 NS_IMETHOD GetStringUTFChars(/*[in]*/ jstring str,
288 /*[in]*/ jboolean *isCopy,
289 /*[out]*/ const char** result) = 0;
291 NS_IMETHOD ReleaseStringUTFChars(/*[in]*/ jstring str,
292 /*[in]*/ const char *chars) = 0;
294 NS_IMETHOD GetArrayLength(/*[in]*/ jarray array,
295 /*[out]*/ jsize* result) = 0;
297 NS_IMETHOD NewObjectArray(/*[in]*/ jsize len,
298 /*[in]*/ jclass clazz,
299 /*[in]*/ jobject init,
300 /*[out]*/ jobjectArray* result) = 0;
302 NS_IMETHOD GetObjectArrayElement(/*[in]*/ jobjectArray array,
303 /*[in]*/ jsize index,
304 /*[out]*/ jobject* result) = 0;
306 NS_IMETHOD SetObjectArrayElement(/*[in]*/ jobjectArray array,
307 /*[in]*/ jsize index,
308 /*[in]*/ jobject val) = 0;
310 NS_IMETHOD NewArray(/*[in]*/ jni_type element_type,
311 /*[in]*/ jsize len,
312 /*[out]*/ jarray* result) = 0;
314 NS_IMETHOD GetArrayElements(/*[in]*/ jni_type type,
315 /*[in]*/ jarray array,
316 /*[in]*/ jboolean *isCopy,
317 /*[out]*/ void* result) = 0;
319 NS_IMETHOD ReleaseArrayElements(/*[in]*/ jni_type type,
320 /*[in]*/ jarray array,
321 /*[in]*/ void *elems,
322 /*[in]*/ jint mode) = 0;
324 NS_IMETHOD GetArrayRegion(/*[in]*/ jni_type type,
325 /*[in]*/ jarray array,
326 /*[in]*/ jsize start,
327 /*[in]*/ jsize len,
328 /*[out]*/ void* buf) = 0;
330 NS_IMETHOD SetArrayRegion(/*[in]*/ jni_type type,
331 /*[in]*/ jarray array,
332 /*[in]*/ jsize start,
333 /*[in]*/ jsize len,
334 /*[in]*/ void* buf) = 0;
336 NS_IMETHOD RegisterNatives(/*[in]*/ jclass clazz,
337 /*[in]*/ const JNINativeMethod *methods,
338 /*[in]*/ jint nMethods,
339 /*[out]*/ jint* result) = 0;
341 NS_IMETHOD UnregisterNatives(/*[in]*/ jclass clazz,
342 /*[out]*/ jint* result) = 0;
344 NS_IMETHOD MonitorEnter(/*[in]*/ jobject obj,
345 /*[out]*/ jint* result) = 0;
347 NS_IMETHOD MonitorExit(/*[in]*/ jobject obj,
348 /*[out]*/ jint* result) = 0;
350 NS_IMETHOD GetJavaVM(/*[in]*/ JavaVM **vm,
351 /*[out]*/ jint* result) = 0;
354 #define NS_ISECUREJNI2_IID \
355 { /* ca9148d0-598a-11d2-a1d4-00805f8f694d */ \
356 0xca9148d0, \
357 0x598a, \
358 0x11d2, \
359 {0xa1, 0xd4, 0x00, 0x80, 0x5f, 0x8f, 0x69, 0x4d } \
362 #endif // nsISecureJNI2_h___