Bug 839376 (part 12) - Fix two easy rooting hazards in shell/js.cpp. r=terrence.

--HG--
extra : rebase_source : f542f9d056b956463ddf474efa538ea9a20d970d
This commit is contained in:
Nicholas Nethercote 2013-02-14 18:54:39 -08:00
parent 24b24b5cdf
commit 02bd075401

View File

@ -1869,9 +1869,9 @@ DisassembleScript(JSContext *cx, HandleScript script, JSFunction *fun, bool line
RawObject obj = objects->vector[i];
if (obj->isFunction()) {
Sprint(sp, "\n");
RootedFunction fun(cx, obj->toFunction());
RootedFunction f(cx, obj->toFunction());
RootedScript script(cx);
JSFunction::maybeGetOrCreateScript(cx, fun, &script);
JSFunction::maybeGetOrCreateScript(cx, f, &script);
if (!DisassembleScript(cx, script, fun, lines, recursive, sp))
return false;
}
@ -5090,8 +5090,8 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
filePaths.popFront();
} else {
const char *code = codeChunks.front();
jsval rval;
if (!JS_EvaluateScript(cx, obj, code, strlen(code), "-e", 1, &rval))
RootedValue rval(cx);
if (!JS_EvaluateScript(cx, obj, code, strlen(code), "-e", 1, rval.address()))
return gExitCode ? gExitCode : EXITCODE_RUNTIME_ERROR;
codeChunks.popFront();
}