diff --git a/js/src/jsarray.c b/js/src/jsarray.c index 89a588e8738..0c7bb345627 100644 --- a/js/src/jsarray.c +++ b/js/src/jsarray.c @@ -1316,16 +1316,12 @@ Array(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) if (argc > 1) { length = (jsuint) argc; vector = argv; - } - else { - if (!ValueIsLength(cx, argv[0], &length)) { - vector = argv; - length = 1; - } else { - vector = NULL; - } - - } + } else if (!ValueIsLength(cx, argv[0], &length)) { + length = 1; + vector = argv; + } else { + vector = NULL; + } } return InitArrayObject(cx, obj, length, vector); } diff --git a/js/src/jsconfig.h b/js/src/jsconfig.h index 61b3058a02e..ce1a05f2e13 100644 --- a/js/src/jsconfig.h +++ b/js/src/jsconfig.h @@ -335,7 +335,7 @@ #define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */ #define JS_HAS_ERROR_EXCEPTIONS 1 /* rt errors reflected as exceptions */ #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */ -#define JS_HAS_NEW_OBJ_METHODS 0 /* has Object.prototype query methods */ +#define JS_HAS_NEW_OBJ_METHODS 1 /* has Object.prototype query methods */ #define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */ #define JS_HAS_DFLT_MSG_STRINGS 1 /* provides English error messages */ #define JS_HAS_NUMBER_FORMATS 1 /* numbers have formatting methods */ diff --git a/js/src/jsobj.c b/js/src/jsobj.c index 52e8168c88d..26f43668fc6 100644 --- a/js/src/jsobj.c +++ b/js/src/jsobj.c @@ -868,24 +868,16 @@ static JSBool obj_propertyIsEnumerable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - JSObject *obj2; - JSProperty *prop; JSAtom *atom; uintN attrs; - JSBool ok; atom = js_ValueToStringAtom(cx, *argv); - if (atom == NULL || !OBJ_LOOKUP_PROPERTY(cx, obj, (jsid)atom, &obj2, &prop)) + if (atom == NULL) return JS_FALSE; - if (!prop) { - *rval = JSVAL_FALSE; - return JS_TRUE; - } - ok = OBJ_GET_ATTRIBUTES(cx, obj2, (jsid)atom, prop, &attrs); - if (ok) - *rval = BOOLEAN_TO_JSVAL((attrs & JSPROP_ENUMERATE) != 0); - OBJ_DROP_PROPERTY(cx, obj2, prop); - return ok; + if (!OBJ_GET_ATTRIBUTES(cx, obj, (jsid)atom, NULL, &attrs)) + return JS_FALSE; + *rval = BOOLEAN_TO_JSVAL((attrs & JSPROP_ENUMERATE) != 0); + return JS_TRUE; } #endif /* JS_HAS_NEW_OBJ_METHODS */ @@ -2075,8 +2067,10 @@ js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop, if (noprop) { if (!js_LookupProperty(cx, obj, id, &obj, &prop)) return JS_FALSE; - if (!prop) - return JS_TRUE; + if (!prop) { + *attrsp = 0; + return JS_TRUE; + } if (!OBJ_IS_NATIVE(obj)) { ok = OBJ_GET_ATTRIBUTES(cx, obj, id, prop, attrsp); OBJ_DROP_PROPERTY(cx, obj, prop);