зеркало из https://github.com/mozilla/pjs.git
Avoid invading JS namespace with global (239122 followup).
This commit is contained in:
Родитель
649fc7e07b
Коммит
3cc36be074
|
@ -55,7 +55,7 @@
|
|||
# include "prmon.h"
|
||||
#endif
|
||||
|
||||
JSBool JSIsCallingApplet = JS_FALSE;
|
||||
JSBool jsj_JSIsCallingApplet = JS_FALSE;
|
||||
|
||||
/*
|
||||
* At certain times during initialization, there may be no JavaScript context
|
||||
|
@ -880,5 +880,5 @@ JSJ_ConvertJSValueToJavaObject(JSContext *cx, jsval v, jobject *vp)
|
|||
JS_EXPORT_API(JSBool)
|
||||
JSJ_IsJSCallApplet()
|
||||
{
|
||||
return JSIsCallingApplet;
|
||||
return jsj_JSIsCallingApplet;
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ JavaArray_checkAccess(JSContext *cx, JSObject *obj, jsid id,
|
|||
JSObjectOps JavaArray_ops = {
|
||||
/* Mandatory non-null function pointer members. */
|
||||
jsj_wrapper_newObjectMap, /* newObjectMap */
|
||||
jsj_wrapper_destroyObjectMap, /* destroyObjectMap */
|
||||
jsj_wrapper_dropObjectMap, /* dropObjectMap */
|
||||
JavaArray_lookupProperty,
|
||||
JavaArray_defineProperty,
|
||||
JavaArray_getPropertyById, /* getProperty */
|
||||
|
|
|
@ -545,7 +545,7 @@ done:
|
|||
JSObjectOps JavaClass_ops = {
|
||||
/* Mandatory non-null function pointer members. */
|
||||
jsj_wrapper_newObjectMap, /* newObjectMap */
|
||||
jsj_wrapper_destroyObjectMap, /* destroyObjectMap */
|
||||
jsj_wrapper_dropObjectMap, /* dropObjectMap */
|
||||
JavaClass_lookupProperty,
|
||||
JavaClass_defineProperty,
|
||||
JavaClass_getPropertyById, /* getProperty */
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jslock.h"
|
||||
#include "jsobj.h"
|
||||
#include "jsj_private.h" /* LiveConnect internals */
|
||||
#include "jsj_hash.h" /* Hash table with Java object as key */
|
||||
|
@ -655,7 +656,7 @@ JavaObject_getPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
field_val = method_val = JSVAL_VOID;
|
||||
|
||||
if (jaApplet && (*jEnv)->IsInstanceOf(jEnv, java_obj, jaApplet)) {
|
||||
JSIsCallingApplet = JS_TRUE;
|
||||
jsj_JSIsCallingApplet = JS_TRUE;
|
||||
}
|
||||
|
||||
/* If a field member, get the value of the field */
|
||||
|
@ -783,7 +784,7 @@ JavaObject_setPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
java_obj = java_wrapper->java_obj;
|
||||
|
||||
if (jaApplet && (*jEnv)->IsInstanceOf(jEnv, java_obj, jaApplet)) {
|
||||
JSIsCallingApplet = JS_TRUE;
|
||||
jsj_JSIsCallingApplet = JS_TRUE;
|
||||
}
|
||||
|
||||
result = jsj_SetJavaFieldValue(cx, jEnv, member_descriptor->field, java_obj, *vp);
|
||||
|
@ -1008,10 +1009,15 @@ jsj_wrapper_newObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
|
|||
return map;
|
||||
}
|
||||
|
||||
void JS_DLL_CALLBACK
|
||||
jsj_wrapper_destroyObjectMap(JSContext *cx, JSObjectMap *map)
|
||||
JSObjectMap * JS_DLL_CALLBACK
|
||||
jsj_wrapper_dropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj)
|
||||
{
|
||||
JS_free(cx, map);
|
||||
JS_ASSERT(map->nrefs > 0);
|
||||
if (JS_ATOMIC_DECREMENT(&map->nrefs) == 0) {
|
||||
JS_free(cx, map);
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
jsval JS_DLL_CALLBACK
|
||||
|
@ -1037,7 +1043,7 @@ jsj_wrapper_setRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
|
|||
JSObjectOps JavaObject_ops = {
|
||||
/* Mandatory non-null function pointer members. */
|
||||
jsj_wrapper_newObjectMap, /* newObjectMap */
|
||||
jsj_wrapper_destroyObjectMap, /* destroyObjectMap */
|
||||
jsj_wrapper_dropObjectMap, /* dropObjectMap */
|
||||
JavaObject_lookupProperty,
|
||||
JavaObject_defineProperty,
|
||||
JavaObject_getPropertyById, /* getProperty */
|
||||
|
|
|
@ -1804,7 +1804,7 @@ jsj_JavaInstanceMethodWrapper(JSContext *cx, JSObject *obj,
|
|||
return JS_FALSE;
|
||||
|
||||
if (jaApplet && (*jEnv)->IsInstanceOf(jEnv, java_obj, jaApplet)) {
|
||||
JSIsCallingApplet = JS_TRUE;
|
||||
jsj_JSIsCallingApplet = JS_TRUE;
|
||||
}
|
||||
|
||||
/* Try to find an instance method with the given name first */
|
||||
|
|
|
@ -357,7 +357,7 @@ extern jfieldID njJSException_wrappedException; /* netscape.javascript.JS
|
|||
* XXX, bug 146458,
|
||||
* whether we are doing a liveconnect call from javascript to java applet
|
||||
*/
|
||||
extern JSBool JSIsCallingApplet;
|
||||
extern JSBool jsj_JSIsCallingApplet;
|
||||
|
||||
/**************** Java <==> JS conversions and Java types *******************/
|
||||
extern JSBool
|
||||
|
@ -652,8 +652,8 @@ extern JSObjectMap * JS_DLL_CALLBACK
|
|||
jsj_wrapper_newObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
|
||||
JSClass *clasp, JSObject *obj);
|
||||
|
||||
extern void JS_DLL_CALLBACK
|
||||
jsj_wrapper_destroyObjectMap(JSContext *cx, JSObjectMap *map);
|
||||
extern JSObjectMap * JS_DLL_CALLBACK
|
||||
jsj_wrapper_dropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj);
|
||||
|
||||
extern jsval JS_DLL_CALLBACK
|
||||
jsj_wrapper_getRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);
|
||||
|
|
|
@ -488,7 +488,7 @@ jsj_EnterJava(JSContext *cx, JNIEnv **envp)
|
|||
extern void
|
||||
jsj_ExitJava(JSJavaThreadState *jsj_env)
|
||||
{
|
||||
JSIsCallingApplet = JS_FALSE;
|
||||
jsj_JSIsCallingApplet = JS_FALSE;
|
||||
if (jsj_env) {
|
||||
JS_ASSERT(jsj_env->recursion_depth > 0);
|
||||
if (--jsj_env->recursion_depth == 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче