Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Created May 18, 2012 22:12
Show Gist options
  • Save jorendorff/2727853 to your computer and use it in GitHub Desktop.
Save jorendorff/2727853 to your computer and use it in GitHub Desktop.
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -824,22 +824,22 @@ Evaluate(JSContext *cx, unsigned argc, j
"evaluate");
return false;
}
if (!JSVAL_IS_STRING(argv[0]) || (argc == 2 && JSVAL_IS_PRIMITIVE(argv[1]))) {
JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS, "evaluate");
return false;
}
- bool newContext;
- RootedVarObject global(cx, NULL);
+ bool newContext = false;
bool compileAndGo = true;
const char *fileName = "@evaluate";
JSAutoByteString fileNameBytes;
unsigned lineNumber = 1;
+ RootedVarObject global(cx, NULL);
global = JS_GetGlobalForObject(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
if (!global)
return false;
if (argc == 2) {
RootedVarObject options(cx, JSVAL_TO_OBJECT(argv[1]));
jsval v;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment