Follow ECMA when .call is passed zero args (290488, r=shaver, a=me).

git-svn-id: svn://10.0.0.236/trunk@172377 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org
2005-04-17 20:15:32 +00:00
parent 4e5a031388
commit c577d9d9ea

View File

@@ -1411,6 +1411,7 @@ static JSBool
fun_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsval fval, *sp, *oldsp;
JSObject *tmp;
void *mark;
uintN i;
JSStackFrame *fp;
@@ -1429,8 +1430,9 @@ fun_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
if (argc == 0) {
/* Call fun with its parent as the 'this' parameter if no args. */
obj = OBJ_GET_PARENT(cx, obj);
/* Call fun with its global object as the 'this' param if no args. */
while ((tmp = OBJ_GET_PARENT(cx, obj)) != NULL)
obj = tmp;
} else {
/* Otherwise convert the first arg to 'this' and skip over it. */
if (!js_ValueToObject(cx, argv[0], &obj))