bug 320172: Functions that call eval need to be heavyweight functions so that var declarations in their eval'd string have a varobj to call home. r=brendan

This commit is contained in:
mrbkap%gmail.com 2005-12-15 02:30:16 +00:00
Родитель 4f86c6b578
Коммит f143012f3e
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -1146,6 +1146,14 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_TRUE;
}
/*
* If the caller is a lightweight function and doesn't have a variables
* object, then we need to provide one for the compiler to stick any
* declared (var) variables into.
*/
if (caller && !caller->varobj && !js_GetCallObject(cx, caller, NULL))
return JS_FALSE;
#if JS_HAS_SCRIPT_OBJECT
/*
* Script.prototype.compile/exec and Object.prototype.eval all take an