Bug 594969 - Fix DisassFile (r=lw)
authorBill McCloskey <wmccloskey@mozilla.com>
Fri, 10 Sep 2010 11:39:59 -0700
changeset 53637 2d1202fb9d284bf70cd3a9ad415deb5c444772b8
parent 53636 e892ea04158179ad911c496c8119d815d20d66a8
child 53638 672b30ace9bf9e2ace28af30e59ca093dbab8bb2
push idunknown
push userunknown
push dateunknown
reviewerslw
bugs594969
milestone2.0b6pre
Bug 594969 - Fix DisassFile (r=lw)
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1965,25 +1965,26 @@ Disassemble(JSContext *cx, uintN argc, j
 static JSBool
 DisassFile(JSContext *cx, uintN argc, jsval *vp)
 {
     JSString *str;
     const char *filename;
     JSScript *script;
     JSBool ok;
     uint32 oldopts;
+    jsval *argv = JS_ARGV(cx, vp);
 
     if (!argc)
         return JS_TRUE;
 
     JSObject *thisobj = JS_THIS_OBJECT(cx, vp);
     if (!thisobj)
         return JS_FALSE;
 
-    str = JS_ValueToString(cx, vp[2]);
+    str = JS_ValueToString(cx, argv[0]);
     if (!str)
         return JS_FALSE;
 
     filename = JS_GetStringBytes(str);
     oldopts = JS_GetOptions(cx);
     JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO | JSOPTION_NO_SCRIPT_RVAL);
     script = JS_CompileFile(cx, thisobj, filename);
     JS_SetOptions(cx, oldopts);
@@ -1992,17 +1993,17 @@ DisassFile(JSContext *cx, uintN argc, js
 
     if (script->isEmpty())
         return JS_TRUE;
 
     JSObject *obj = JS_NewScriptObject(cx, script);
     if (!obj)
         return JS_FALSE;
 
-    *vp = OBJECT_TO_JSVAL(obj); /* I like to root it, root it. */
+    argv[0] = OBJECT_TO_JSVAL(obj); /* I like to root it, root it. */
     ok = Disassemble(cx, 1, vp); /* gross, but works! */
     JS_SET_RVAL(cx, vp, JSVAL_VOID);
 
     return ok;
 }
 
 static JSBool
 DisassWithSrc(JSContext *cx, uintN argc, jsval *vp)