Bug 839376 (part 6) - Fix five more easy rooting hazards. r=sfink.

--HG--
extra : rebase_source : 8b430a1de5dcbfecd4799b31a5e30ab35cd53fd7
This commit is contained in:
Nicholas Nethercote 2013-02-12 14:57:20 -08:00
parent 22b9a13778
commit 94d1dcaadf
4 changed files with 9 additions and 9 deletions

View File

@ -25,10 +25,10 @@ static void
AssertInnerizedScopeChain(JSContext *cx, JSObject &scopeobj)
{
#ifdef DEBUG
for (JSObject *o = &scopeobj; o; o = o->enclosingScope()) {
if (JSObjectOp op = o->getClass()->ext.innerObject) {
Rooted<JSObject*> obj(cx, o);
JS_ASSERT(op(cx, obj) == o);
RootedObject obj(cx);
for (obj = &scopeobj; obj; obj = obj->enclosingScope()) {
if (JSObjectOp op = obj->getClass()->ext.innerObject) {
JS_ASSERT(op(cx, obj) == obj);
}
}
#endif

View File

@ -1482,7 +1482,7 @@ js::CloneFunctionObject(JSContext *cx, HandleFunction fun, HandleObject parent,
allocKind, newKind);
if (!cloneobj)
return NULL;
JSFunction *clone = cloneobj->toFunction();
RootedFunction clone(cx, cloneobj->toFunction());
clone->nargs = fun->nargs;
clone->flags = fun->flags & ~JSFunction::EXTENDED;

View File

@ -266,7 +266,7 @@ bool
js::RunScript(JSContext *cx, StackFrame *fp)
{
JS_ASSERT(fp == cx->fp());
JSScript *script = fp->script();
RootedScript script(cx, fp->script());
JS_ASSERT_IF(!fp->isGeneratorFrame(), cx->regs().pc == script->code);
JS_ASSERT_IF(fp->isEvalFrame(), script->isActiveEval);
@ -430,7 +430,7 @@ js::InvokeConstructorKernel(JSContext *cx, CallArgs args)
JSObject &callee = args.callee();
if (callee.isFunction()) {
JSFunction *fun = callee.toFunction();
RootedFunction fun(cx, callee.toFunction());
if (fun->isNativeConstructor()) {
Probes::calloutBegin(cx, fun);

View File

@ -3689,14 +3689,14 @@ js::ValueToSource(JSContext *cx, const Value &v)
return ToString<CanGC>(cx, v);
}
Value rval = NullValue();
RootedValue rval(cx, NullValue());
RootedValue fval(cx);
RootedId id(cx, NameToId(cx->names().toSource));
Rooted<JSObject*> obj(cx, &v.toObject());
if (!GetMethod(cx, obj, id, 0, &fval))
return NULL;
if (js_IsCallable(fval)) {
if (!Invoke(cx, ObjectValue(*obj), fval, 0, NULL, &rval))
if (!Invoke(cx, ObjectValue(*obj), fval, 0, NULL, rval.address()))
return NULL;
}