Bug 959695 part 2. Make ReportIfNotFunction take a Handle. r=terrence

This commit is contained in:
Boris Zbarsky 2014-01-14 21:46:43 -05:00
parent d974ba4f3c
commit 063d4ec39a
2 changed files with 4 additions and 3 deletions

View File

@ -228,7 +228,8 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
}
if (sp == argv + argc) {
if (required) {
if (JSFunction *fun = ReportIfNotFunction(cx, argv[-2])) {
HandleValue callee = HandleValue::fromMarkedLocation(&argv[-2]);
if (JSFunction *fun = ReportIfNotFunction(cx, callee)) {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%u", argc);
JSAutoByteString funNameBytes;
@ -298,7 +299,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
*va_arg(ap, JSObject **) = obj;
break;
case 'f':
obj = ReportIfNotFunction(cx, *sp);
obj = ReportIfNotFunction(cx, HandleValue::fromMarkedLocation(sp));
if (!obj)
return false;
*sp = OBJECT_TO_JSVAL(obj);

View File

@ -637,7 +637,7 @@ UrshOperation(JSContext *cx, HandleValue lhs, HandleValue rhs, Value *out)
#undef RELATIONAL_OP
inline JSFunction *
ReportIfNotFunction(JSContext *cx, const Value &v, MaybeConstruct construct = NO_CONSTRUCT)
ReportIfNotFunction(JSContext *cx, HandleValue v, MaybeConstruct construct = NO_CONSTRUCT)
{
if (v.isObject() && v.toObject().is<JSFunction>())
return &v.toObject().as<JSFunction>();