зеркало из https://github.com/mozilla/gecko-dev.git
New errorNumber handling
This commit is contained in:
Родитель
474bde20c3
Коммит
f4649b191c
|
@ -728,7 +728,8 @@ Java_netscape_javascript_JSObject_getMember(JNIEnv *jEnv,
|
|||
|
||||
property_name_ucs2 = NULL;
|
||||
if (!property_name_jstr) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NULL_MEMBER_NAME);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NULL_MEMBER_NAME);
|
||||
member = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
@ -819,7 +820,8 @@ Java_netscape_javascript_JSObject_setMember(JNIEnv *jEnv,
|
|||
|
||||
property_name_ucs2 = NULL;
|
||||
if (!property_name_jstr) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NULL_MEMBER_NAME);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NULL_MEMBER_NAME);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -895,7 +897,8 @@ Java_netscape_javascript_JSObject_removeMember(JNIEnv *jEnv,
|
|||
return;
|
||||
|
||||
if (!property_name_jstr) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NULL_MEMBER_NAME);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NULL_MEMBER_NAME);
|
||||
goto done;
|
||||
}
|
||||
/* Get the Unicode string for the JS property name */
|
||||
|
@ -945,8 +948,8 @@ Java_netscape_javascript_JSObject_call(JNIEnv *jEnv, jobject java_wrapper_obj,
|
|||
function_name_ucs2 = NULL;
|
||||
result = NULL;
|
||||
if (!function_name_jstr) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JSJMSG_NULL_FUNCTION_NAME);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NULL_FUNCTION_NAME);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1037,8 @@ Java_netscape_javascript_JSObject_eval(JNIEnv *jEnv,
|
|||
result = NULL;
|
||||
eval_ucs2 = NULL;
|
||||
if (!eval_jstr) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NULL_EVAL_ARG);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NULL_EVAL_ARG);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ access_java_array_element(JSContext *cx,
|
|||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_OP_JARRAY);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_OP_JARRAY);
|
||||
return JS_FALSE;
|
||||
}
|
||||
class_descriptor = java_wrapper->class_descriptor;
|
||||
|
@ -109,7 +110,7 @@ access_java_array_element(JSContext *cx,
|
|||
|
||||
if (!JSVERSION_IS_ECMA(version)) {
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_CANT_WRITE_JARRAY, member_name);
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
|
@ -131,7 +132,8 @@ access_java_array_element(JSContext *cx,
|
|||
}
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_INDEX_EXPR);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_INDEX_EXPR);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -146,7 +148,7 @@ access_java_array_element(JSContext *cx,
|
|||
if (index < 0 || index >= array_length) {
|
||||
char numBuf[12];
|
||||
sprintf(numBuf, "%d", index);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_JARRAY_INDEX, numBuf);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -207,7 +209,8 @@ JavaArray_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
JSPropertyOp getter, JSPropertyOp setter,
|
||||
uintN attrs, JSProperty **propp)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JARRAY_PROP_DEFINE);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JARRAY_PROP_DEFINE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -242,7 +245,8 @@ JavaArray_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
*vp = JSVAL_FALSE;
|
||||
|
||||
if (!JSVERSION_IS_ECMA(version)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JARRAY_PROP_DELETE);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JARRAY_PROP_DELETE);
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
/* Attempts to delete permanent properties are silently ignored
|
||||
|
@ -319,11 +323,13 @@ JavaArray_checkAccess(JSContext *cx, JSObject *obj, jsid id,
|
|||
{
|
||||
switch (mode) {
|
||||
case JSACC_WATCH:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JARRAY_PROP_WATCH);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JARRAY_PROP_WATCH);
|
||||
return JS_FALSE;
|
||||
|
||||
case JSACC_IMPORT:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JARRAY_PROP_EXPORT);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JARRAY_PROP_EXPORT);
|
||||
return JS_FALSE;
|
||||
|
||||
default:
|
||||
|
|
|
@ -90,8 +90,8 @@ lookup_static_member_by_id(JSContext *cx, JNIEnv *jEnv, JSObject *obj,
|
|||
if (!member_descriptor) {
|
||||
JS_IdToValue(cx, id, &idval);
|
||||
if (!JSVAL_IS_STRING(idval)) {
|
||||
JS_ReportErrorNumber(cx,
|
||||
jsj_GetErrorMessage, JSJMSG_BAD_JCLASS_EXPR);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_JCLASS_EXPR);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,8 @@ lookup_static_member_by_id(JSContext *cx, JNIEnv *jEnv, JSObject *obj,
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_MISSING_NAME,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_MISSING_NAME,
|
||||
class_descriptor->name, member_name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -195,7 +196,8 @@ JavaClass_setPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
no_such_field:
|
||||
JS_IdToValue(cx, id, &idval);
|
||||
member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_MISSING_STATIC,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_MISSING_STATIC,
|
||||
member_name, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -258,7 +260,8 @@ JavaClass_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
JSPropertyOp getter, JSPropertyOp setter,
|
||||
uintN attrs, JSProperty **propp)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JCLASS_PROP_DEFINE);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JCLASS_PROP_DEFINE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -293,7 +296,7 @@ JavaClass_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
*vp = JSVAL_FALSE;
|
||||
|
||||
if (!JSVERSION_IS_ECMA(version)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JCLASS_PROP_DELETE);
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
|
@ -365,12 +368,12 @@ JavaClass_checkAccess(JSContext *cx, JSObject *obj, jsid id,
|
|||
{
|
||||
switch (mode) {
|
||||
case JSACC_WATCH:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JCLASS_PROP_WATCH);
|
||||
return JS_FALSE;
|
||||
|
||||
case JSACC_IMPORT:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JCLASS_PROP_EXPORT);
|
||||
return JS_FALSE;
|
||||
|
||||
|
@ -399,7 +402,8 @@ JavaClass_hasInstance(JSContext *cx, JSObject *obj, jsval candidate_jsval,
|
|||
has_instance = JS_FALSE;
|
||||
class_descriptor = JS_GetPrivate(cx, obj);
|
||||
if (!class_descriptor) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_OP_JCLASS);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_OP_JCLASS);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -417,7 +421,8 @@ JavaClass_hasInstance(JSContext *cx, JSObject *obj, jsval candidate_jsval,
|
|||
java_class = class_descriptor->java_class;
|
||||
java_wrapper = JS_GetPrivate(cx, candidate_obj);
|
||||
if (!java_wrapper) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_OP_PROTO);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_OP_PROTO);
|
||||
return JS_FALSE;
|
||||
}
|
||||
java_obj = java_wrapper->java_obj;
|
||||
|
@ -535,13 +540,15 @@ getClass(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
!(obj_arg = JSVAL_TO_OBJECT(argv[0])) ||
|
||||
(!JS_InstanceOf(cx, obj_arg, &JavaObject_class, 0) &&
|
||||
!JS_InstanceOf(cx, obj_arg, &JavaArray_class, 0))) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NEED_JOBJECT_ARG);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NEED_JOBJECT_ARG);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
java_wrapper = JS_GetPrivate(cx, obj_arg);
|
||||
if (!java_wrapper) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_PROTO_GETCLASS);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_PROTO_GETCLASS);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,8 @@ JavaObject_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_OP_JOBJECT);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_OP_JOBJECT);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,8 @@ JavaObject_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
return JS_TRUE;
|
||||
|
||||
case JSTYPE_FUNCTION:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_CONVERT_TO_FUNC);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_CONVERT_TO_FUNC);
|
||||
return JS_FALSE;
|
||||
|
||||
case JSTYPE_VOID:
|
||||
|
@ -301,7 +303,8 @@ lookup_member_by_id(JSContext *cx, JNIEnv *jEnv, JSObject *obj,
|
|||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_BAD_OP_JOBJECT);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_OP_JOBJECT);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -313,14 +316,14 @@ lookup_member_by_id(JSContext *cx, JNIEnv *jEnv, JSObject *obj,
|
|||
if (!member_descriptor) {
|
||||
JS_IdToValue(cx, id, &idval);
|
||||
if (!JSVAL_IS_STRING(idval)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_JOBJECT_EXPR);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NO_INSTANCE_NAME,
|
||||
class_descriptor->name, member_name);
|
||||
return JS_FALSE;
|
||||
|
@ -452,7 +455,8 @@ no_such_field:
|
|||
JS_IdToValue(cx, id, &idval);
|
||||
member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
|
||||
class_descriptor = java_wrapper->class_descriptor;
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_NO_NAME_IN_CLASS,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NO_NAME_IN_CLASS,
|
||||
member_name, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -493,7 +497,8 @@ JavaObject_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
JSPropertyOp getter, JSPropertyOp setter,
|
||||
uintN attrs, JSProperty **propp)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_JOBJECT_PROP_DEFINE);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JOBJECT_PROP_DEFINE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -528,7 +533,7 @@ JavaObject_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
*vp = JSVAL_FALSE;
|
||||
|
||||
if (!JSVERSION_IS_ECMA(version)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JOBJECT_PROP_DELETE);
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
|
@ -605,12 +610,12 @@ JavaObject_checkAccess(JSContext *cx, JSObject *obj, jsid id,
|
|||
{
|
||||
switch (mode) {
|
||||
case JSACC_WATCH:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JOBJECT_PROP_WATCH);
|
||||
return JS_FALSE;
|
||||
|
||||
case JSACC_IMPORT:
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_JOBJECT_PROP_EXPORT);
|
||||
return JS_FALSE;
|
||||
|
||||
|
|
|
@ -81,11 +81,12 @@ JavaPackage_setProperty(JSContext *cx, JSObject *obj, jsval slot, jsval *vp)
|
|||
{
|
||||
JavaPackage_Private *package = JS_GetPrivate(cx, obj);
|
||||
if (!package) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_ADD_TO_PACKAGE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_DONT_ADD_TO_PACKAGE);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_DONT_ADD_TO_PACKAGE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -201,7 +202,7 @@ JavaPackage_resolve(JSContext *cx, JSObject *obj, jsval id)
|
|||
for (cp = msg; *cp != '\0'; cp++)
|
||||
if (*cp == '/')
|
||||
*cp = '.';
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_MISSING_PACKAGE, msg);
|
||||
free((char*)msg);
|
||||
}
|
||||
|
@ -384,7 +385,7 @@ pre_define_java_packages(JSContext *cx, JSObject *global_obj,
|
|||
jsval v;
|
||||
|
||||
if (!simple_name) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_DOUBLE_SHIPPING, package_name);
|
||||
goto error;
|
||||
}
|
||||
|
@ -401,7 +402,7 @@ pre_define_java_packages(JSContext *cx, JSObject *global_obj,
|
|||
/* New package objects should only be created at the terminal
|
||||
sub-package in a fully-qualified package-name */
|
||||
if (strtok(NULL, ".")) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_BAD_PACKAGE_PREDEF,
|
||||
package_def->name);
|
||||
goto error;
|
||||
|
|
|
@ -41,7 +41,8 @@ convert_js_obj_to_JSObject_wrapper(JSContext *cx, JNIEnv *jEnv, JSObject *js_obj
|
|||
{
|
||||
if (!njJSObject) {
|
||||
if (java_value)
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_CANT_LOAD_JSOBJECT);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_CANT_LOAD_JSOBJECT);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -502,8 +503,8 @@ conversion_error:
|
|||
if (!jsval_string)
|
||||
jsval_string = "";
|
||||
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_CANT_CONVERT_JS,
|
||||
jsval_string, signature->name);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_CANT_CONVERT_JS, jsval_string, signature->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
return success;
|
||||
|
|
|
@ -733,7 +733,7 @@ convert_JS_method_args_to_java_argv(JSContext *cx, JNIEnv *jEnv, jsval *argv,
|
|||
ok = jsj_ConvertJSValueToJavaValue(cx, jEnv, argv[i], arg_signatures[i],
|
||||
&dummy_cost, &jargv[i], &localv[i]);
|
||||
if (!ok) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_CONVERT_JS_VALUE);
|
||||
JS_free(cx, jargv);
|
||||
JS_free(cx, localv);
|
||||
|
@ -785,7 +785,8 @@ invoke_java_method(JSContext *cx, JSJavaThreadState *jsj_env,
|
|||
|
||||
#ifdef DEBUG
|
||||
if (old_cx && (old_cx != cx)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_MULTIPLE_JTHREADS);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_MULTIPLE_JTHREADS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1036,7 +1037,8 @@ invoke_java_constructor(JSContext *cx,
|
|||
|
||||
#ifdef DEBUG
|
||||
if (old_cx && (old_cx != cx)) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, JSJMSG_MULTIPLE_JTHREADS);
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_MULTIPLE_JTHREADS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1122,24 +1124,24 @@ jsj_JavaConstructorWrapper(JSContext *cx, JSObject *obj,
|
|||
/* Get class/interface flags and check them */
|
||||
modifiers = class_descriptor->modifiers;
|
||||
if (modifiers & ACC_ABSTRACT) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_ABSTRACT_JCLASS, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (modifiers & ACC_INTERFACE) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_IS_INTERFACE, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
if ( !(modifiers & ACC_PUBLIC) ) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NOT_PUBLIC, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
member_descriptor = jsj_LookupJavaClassConstructors(cx, jEnv, class_descriptor);
|
||||
if (!member_descriptor) {
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage,
|
||||
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
|
||||
JSJMSG_NO_CONSTRUCTORS, class_descriptor->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ extern void
|
|||
jsj_LogError(const char *error_msg);
|
||||
|
||||
extern const JSErrorFormatString *
|
||||
jsj_GetErrorMessage(const uintN errorNumber);
|
||||
jsj_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber);
|
||||
|
||||
PR_CALLBACK JSJHashNumber
|
||||
jsj_HashJavaObject(const void *key, void* env);
|
||||
|
|
|
@ -302,14 +302,19 @@ jsj_LogError(const char *error_msg)
|
|||
to convert an error number into an error format string.
|
||||
*/
|
||||
JSErrorFormatString jsj_ErrorFormatString[JSJ_Err_Limit] = {
|
||||
#if JS_HAS_DFLT_MSG_STRINGS
|
||||
#define MSG_DEF(name, number, count, format) \
|
||||
{ format, count } ,
|
||||
#else
|
||||
#define MSG_DEF(name, number, count, format) \
|
||||
{ NULL, count } ,
|
||||
#endif
|
||||
#include "jsj_msg.def"
|
||||
#undef MSG_DEF
|
||||
};
|
||||
|
||||
const JSErrorFormatString *
|
||||
jsj_GetErrorMessage(const uintN errorNumber)
|
||||
jsj_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber)
|
||||
{
|
||||
if ((errorNumber > 0) && (errorNumber < JSJ_Err_Limit))
|
||||
return &jsj_ErrorFormatString[errorNumber];
|
||||
|
|
Загрузка…
Ссылка в новой задаче