From 063d4ec39a547354f2efdc03a7787445c18f3928 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 14 Jan 2014 21:46:43 -0500 Subject: [PATCH] Bug 959695 part 2. Make ReportIfNotFunction take a Handle. r=terrence --- js/src/jsapi.cpp | 5 +++-- js/src/vm/Interpreter-inl.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 0adef45a61e..68b6c273f1c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -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); diff --git a/js/src/vm/Interpreter-inl.h b/js/src/vm/Interpreter-inl.h index cefe234bc06..4032b5bd790 100644 --- a/js/src/vm/Interpreter-inl.h +++ b/js/src/vm/Interpreter-inl.h @@ -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()) return &v.toObject().as();