Bug 839376 (part 12) - Fix two easy rooting hazards in shell/js.cpp. r=terrence.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 14 Feb 2013 18:54:39 -0800
changeset 131876 a3697783abdf5a3835f8df96bdd0db4f25f5e2ce
parent 131875 fb11273bd848fbb202d02b7d8d015cfe329f9207
child 131877 d30c69e19fa05ecf7e15c6709b89a38dede27b6d
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 12) - Fix two easy rooting hazards in shell/js.cpp. r=terrence.
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1864,19 +1864,19 @@ DisassembleScript(JSContext *cx, HandleS
     TryNotes(cx, script, sp);
 
     if (recursive && script->hasObjects()) {
         ObjectArray *objects = script->objects();
         for (unsigned i = 0; i != objects->length; ++i) {
             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;
             }
         }
     }
     return true;
 }
 
@@ -5085,18 +5085,18 @@ ProcessArgs(JSContext *cx, JSObject *obj
         if (fpArgno < ccArgno) {
             char *path = filePaths.front();
             Process(cx, obj, path, false);
             if (gExitCode)
                 return gExitCode;
             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();
         }
     }
 
     /* The |script| argument is processed after all options. */
     if (const char *path = op->getStringArg("script")) {
         Process(cx, obj, path, false);