Fix delegation to function object for length and other properties (313570, r/sr=mrbkap/shaver).

This commit is contained in:
brendan%mozilla.org 2005-12-10 18:46:37 +00:00
Родитель e539eeb6a7
Коммит f20ad4a946
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -916,10 +916,13 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return JS_TRUE;
slot = JSVAL_TO_INT(id);
/* No valid function object should lack private data, but check anyway. */
fun = (JSFunction *)JS_GetInstancePrivate(cx, obj, &js_FunctionClass, NULL);
if (!fun)
return JS_TRUE;
/* Loop because getter and setter can be delegated from another class. */
while (!(fun = (JSFunction *)
JS_GetInstancePrivate(cx, obj, &js_FunctionClass, NULL))) {
obj = OBJ_GET_PROTO(cx, obj);
if (!obj)
return JS_TRUE;
}
/* Find fun's top-most activation record. */
for (fp = cx->fp; fp && (fp->fun != fun || (fp->flags & JSFRAME_SPECIAL));