Bug 566773 - Don't force indirect eval to have a callobj. r=brendan
authorBlake Kaplan <mrbkap@gmail.com>
Mon, 24 May 2010 15:53:11 -0700
changeset 42833 8bc3bb17cb43d85234b3d49d0b13780891705705
parent 42832 060a7e1a5635ce3e7e25661682e080b0da4907d5
child 42834 54acf298872bff6cb3a74a7174a2080ae9a08e04
push idunknown
push userunknown
push dateunknown
reviewersbrendan
bugs566773
milestone1.9.3a5pre
Bug 566773 - Don't force indirect eval to have a callobj. r=brendan
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1113,24 +1113,16 @@ obj_eval(JSContext *cx, uintN argc, jsva
         }
     }
 
     if (!JSVAL_IS_STRING(argv[0])) {
         *vp = argv[0];
         return JS_TRUE;
     }
 
-    /*
-     * If the caller is a lightweight function and doesn't have a variables
-     * object, then we need to provide one for the compiler to stick any
-     * declared (var) variables into.
-     */
-    if (caller->fun && !caller->callobj && !js_GetCallObject(cx, caller))
-        return JS_FALSE;
-
     /* Accept an optional trailing argument that overrides the scope object. */
     JSObject *scopeobj = NULL;
     if (argc >= 2) {
         if (!js_ValueToObject(cx, argv[1], &scopeobj))
             return JS_FALSE;
         argv[1] = OBJECT_TO_JSVAL(scopeobj);
         JSObject *obj = scopeobj;
         while (obj) {
@@ -1191,16 +1183,17 @@ obj_eval(JSContext *cx, uintN argc, jsva
             scopeobj = obj;
         } else {
             /*
              * Compile using the caller's current scope object.
              *
              * NB: This means that native callers (who reach this point through
              * the C API) must use the two parameter form.
              */
+            JS_ASSERT_IF(caller->argv, caller->callobj);
             scopeobj = callerScopeChain;
         }
 #endif
     } else {
         scopeobj = js_GetWrappedObject(cx, scopeobj);
         OBJ_TO_INNER_OBJECT(cx, scopeobj);
         if (!scopeobj)
             return JS_FALSE;