Bug 839376 (part 11) - Fix two more easy rooting hazards. r=terrence.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 14 Feb 2013 18:54:04 -0800
changeset 131875 fb11273bd848fbb202d02b7d8d015cfe329f9207
parent 131874 e2843bae075f879996138140ef819d22c62cc757
child 131876 a3697783abdf5a3835f8df96bdd0db4f25f5e2ce
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs839376
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 839376 (part 11) - Fix two more easy rooting hazards. r=terrence.
js/src/jsdbgapi.cpp
js/src/jswrapper.cpp
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -507,27 +507,25 @@ JS_ReleaseFunctionLocalNameArray(JSConte
     cx->tempLifoAlloc().release(mark);
 }
 
 JS_PUBLIC_API(JSScript *)
 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)
 JS_GetFunctionNative(JSContext *cx, JSFunction *fun)
 {
     return fun->maybeNative();
 }
 
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -372,17 +372,17 @@ js::TransparentObjectWrapper(JSContext *
     JS_ASSERT(!obj->isWrapper() || obj->getClass()->ext.innerObject);
     return Wrapper::New(cx, obj, wrappedProto, parent, &CrossCompartmentWrapper::singleton);
 }
 
 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();
             Rooted<JSObject*> errObj(cx, &exc.toObject());
             JSObject *copyobj = js_CopyErrorObject(cx, errObj, scope);
             if (copyobj)
                 cx->setPendingException(ObjectValue(*copyobj));
         }