Bug 896280 - Pass MutableHandleValue to JS::Call(); r=terrence

This commit is contained in:
Ms2ger 2013-07-24 09:40:01 +02:00
parent d7e09279b4
commit 3c5e135131
6 changed files with 24 additions and 19 deletions

View File

@ -3152,8 +3152,8 @@ nsObjectLoadingContent::LegacyCall(JSContext* aCx,
}
JS::Rooted<JS::Value> retval(aCx);
bool ok = ::JS::Call(aCx, thisVal, pi_obj, args.Length(),
args.Elements(), retval.address());
bool ok = JS::Call(aCx, thisVal, pi_obj, args.Length(), args.Elements(),
&retval);
if (!ok) {
aRv.Throw(NS_ERROR_FAILURE);
return JS::UndefinedValue();

View File

@ -494,7 +494,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv
uint32_t oldOpts =
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
jsval rval;
RootedValue rval(cx);
bool success = JS::Call(cx, vals[1], vals[0], vals.length() - 2, vals.begin() + 2, &rval);
JS_SetOptions(cx, oldOpts);

View File

@ -5799,18 +5799,15 @@ JS_CallFunctionValue(JSContext *cx, JSObject *objArg, jsval fval, unsigned argc,
}
JS_PUBLIC_API(bool)
JS::Call(JSContext *cx, jsval thisv, jsval fval, unsigned argc, jsval *argv, jsval *rval)
JS::Call(JSContext *cx, jsval thisv, jsval fval, unsigned argc, jsval *argv,
MutableHandleValue rval)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, thisv, fval, JSValueArray(argv, argc));
AutoLastFrameCheck lfc(cx);
RootedValue rv(cx);
if (!Invoke(cx, thisv, fval, argc, argv, &rv))
return false;
*rval = rv;
return true;
return Invoke(cx, thisv, fval, argc, argv, rval);
}
JS_PUBLIC_API(JSObject *)

View File

@ -4157,25 +4157,33 @@ JS_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval, unsigned argc,
namespace JS {
static inline bool
Call(JSContext *cx, JSObject *thisObj, JSFunction *fun, unsigned argc, jsval *argv, jsval *rval) {
return !!JS_CallFunction(cx, thisObj, fun, argc, argv, rval);
Call(JSContext *cx, JSObject *thisObj, JSFunction *fun, unsigned argc, jsval *argv,
MutableHandle<Value> rval)
{
return !!JS_CallFunction(cx, thisObj, fun, argc, argv, rval.address());
}
static inline bool
Call(JSContext *cx, JSObject *thisObj, const char *name, unsigned argc, jsval *argv, jsval *rval) {
return !!JS_CallFunctionName(cx, thisObj, name, argc, argv, rval);
Call(JSContext *cx, JSObject *thisObj, const char *name, unsigned argc, jsval *argv,
MutableHandle<Value> rval)
{
return !!JS_CallFunctionName(cx, thisObj, name, argc, argv, rval.address());
}
static inline bool
Call(JSContext *cx, JSObject *thisObj, jsval fun, unsigned argc, jsval *argv, jsval *rval) {
return !!JS_CallFunctionValue(cx, thisObj, fun, argc, argv, rval);
Call(JSContext *cx, JSObject *thisObj, jsval fun, unsigned argc, jsval *argv,
MutableHandle<Value> rval)
{
return !!JS_CallFunctionValue(cx, thisObj, fun, argc, argv, rval.address());
}
extern JS_PUBLIC_API(bool)
Call(JSContext *cx, jsval thisv, jsval fun, unsigned argc, jsval *argv, jsval *rval);
Call(JSContext *cx, jsval thisv, jsval fun, unsigned argc, jsval *argv, MutableHandle<Value> rval);
static inline bool
Call(JSContext *cx, jsval thisv, JSObject *funObj, unsigned argc, jsval *argv, jsval *rval) {
Call(JSContext *cx, jsval thisv, JSObject *funObj, unsigned argc, jsval *argv,
MutableHandle<Value> rval)
{
return Call(cx, thisv, OBJECT_TO_JSVAL(funObj), argc, argv, rval);
}

View File

@ -3072,7 +3072,7 @@ xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle<JSObject*> prox
}
return JS::Call(cx, thisVal, js::GetProxyPrivate(proxy), args.length(), args.array(),
args.rval().address());
args.rval());
}
xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler;

View File

@ -419,7 +419,7 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id,
snapshot_val.address())
&& (snapshot_fn = JS_ValueToFunction(cx, snapshot_val))
&& JS::Call(cx, JSVAL_TO_OBJECT(h),
snapshot_fn, 0, NULL, ss.address())
snapshot_fn, 0, NULL, &ss)
&& JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts.address()));
}