mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 00:25:27 +00:00
Bug 314874: Function.call/apply pass thisArg.valueOf() as this value when thisArg is not a primitive, r=brendan
This commit is contained in:
parent
29ed6ecfe7
commit
743598bdfe
@ -1582,7 +1582,9 @@ fun_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
obj = NULL;
|
||||
} else {
|
||||
/* Otherwise convert the first arg to 'this' and skip over it. */
|
||||
if (!js_ValueToObject(cx, argv[0], &obj))
|
||||
if (!JSVAL_IS_PRIMITIVE(argv[0]))
|
||||
obj = JSVAL_TO_OBJECT(argv[0]);
|
||||
else if (!js_ValueToObject(cx, argv[0], &obj))
|
||||
return JS_FALSE;
|
||||
argc--;
|
||||
argv++;
|
||||
@ -1669,7 +1671,9 @@ fun_apply(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
}
|
||||
|
||||
/* Convert the first arg to 'this' and skip over it. */
|
||||
if (!js_ValueToObject(cx, argv[0], &obj))
|
||||
if (!JSVAL_IS_PRIMITIVE(argv[0]))
|
||||
obj = JSVAL_TO_OBJECT(argv[0]);
|
||||
else if (!js_ValueToObject(cx, argv[0], &obj))
|
||||
return JS_FALSE;
|
||||
|
||||
/* Allocate stack space for fval, obj, and the args. */
|
||||
|
Loading…
Reference in New Issue
Block a user