зеркало из https://github.com/mozilla/pjs.git
When running in ECMA-compatibility mode, silently ignore attempts to delete
properties of JavaArray objects.
This commit is contained in:
Родитель
1ed0a46a81
Коммит
628c8791a7
|
@ -79,9 +79,17 @@ access_java_array_element(JSContext *cx,
|
||||||
member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
|
member_name = JS_GetStringBytes(JSVAL_TO_STRING(idval));
|
||||||
|
|
||||||
if (do_assignment) {
|
if (do_assignment) {
|
||||||
JS_ReportError(cx, "Attempt to write to invalid Java array "
|
JSVersion version = JS_GetVersion(cx);
|
||||||
"element \"%s\"", member_name);
|
|
||||||
return JS_FALSE;
|
if (!JSVERSION_IS_ECMA(version)) {
|
||||||
|
|
||||||
|
JS_ReportError(cx, "Attempt to write to invalid Java array "
|
||||||
|
"element \"%s\"", member_name);
|
||||||
|
return JS_FALSE;
|
||||||
|
} else {
|
||||||
|
*vp = JSVAL_VOID;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!strcmp(member_name, "length")) {
|
if (!strcmp(member_name, "length")) {
|
||||||
array_length = jsj_GetJavaArrayLength(cx, jEnv, java_array);
|
array_length = jsj_GetJavaArrayLength(cx, jEnv, java_array);
|
||||||
|
@ -170,7 +178,7 @@ JavaArray_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
||||||
JSPropertyOp getter, JSPropertyOp setter,
|
JSPropertyOp getter, JSPropertyOp setter,
|
||||||
uintN attrs, JSProperty **propp)
|
uintN attrs, JSProperty **propp)
|
||||||
{
|
{
|
||||||
JS_ReportError(cx, "Elements of JavaArray objects may not be deleted");
|
JS_ReportError(cx, "Cannot define a new property in a JavaArray");
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +208,16 @@ JavaArray_setAttributes(JSContext *cx, JSObject *obj, jsid id,
|
||||||
static JSBool
|
static JSBool
|
||||||
JavaArray_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
JavaArray_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||||
{
|
{
|
||||||
JS_ReportError(cx, "Elements of JavaArray objects may not be deleted");
|
JSVersion version = JS_GetVersion(cx);
|
||||||
return JS_FALSE;
|
|
||||||
|
if (!JSVERSION_IS_ECMA(version)) {
|
||||||
|
JS_ReportError(cx, "Properties of JavaArray objects may not be deleted");
|
||||||
|
return JS_FALSE;
|
||||||
|
} else {
|
||||||
|
/* Attempts to delete permanent properties are silently ignored
|
||||||
|
by ECMAScript. */
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
|
|
Загрузка…
Ссылка в новой задаче