Bug 839376 (part 11) - Fix two more easy rooting hazards. r=terrence.

--HG--
extra : rebase_source : 37e7f5748b62018ab8ba8010f64d2c84f14578fa
This commit is contained in:
Nicholas Nethercote 2013-02-14 18:54:04 -08:00
parent 67a647ce1c
commit 24b24b5cdf
2 changed files with 4 additions and 6 deletions

View File

@ -512,17 +512,15 @@ JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
{
if (fun->isNative())
return NULL;
UnrootedScript script;
if (fun->isInterpretedLazy()) {
RootedFunction rootedFun(cx, fun);
AutoCompartment funCompartment(cx, rootedFun);
script = rootedFun->getOrCreateScript(cx);
UnrootedScript script = rootedFun->getOrCreateScript(cx);
if (!script)
MOZ_CRASH();
} else {
script = fun->nonLazyScript();
return script;
}
return script;
return fun->nonLazyScript();
}
JS_PUBLIC_API(JSNative)

View File

@ -377,7 +377,7 @@ ErrorCopier::~ErrorCopier()
{
JSContext *cx = ac.ref().context();
if (ac.ref().origin() != cx->compartment && cx->isExceptionPending()) {
Value exc = cx->getPendingException();
RootedValue exc(cx, cx->getPendingException());
if (exc.isObject() && exc.toObject().isError() && exc.toObject().getPrivate()) {
cx->clearPendingException();
ac.destroy();