Correctly set the strict mode flag when calling eval()
authorLars Knoll <lars.knoll@digia.com>
Tue, 4 Dec 2012 19:02:26 +0000 (11:02 -0800)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 4 Dec 2012 19:09:28 +0000 (20:09 +0100)
Change-Id: I677eea907a3b79373c0784c1496ed97f0f5ee6f6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qmljs_objects.cpp

index f12999b..12cc447 100644 (file)
@@ -508,8 +508,14 @@ Value EvalFunction::call(ExecutionContext *context, Value /*thisObject*/, Value
         ctx = context;
     }
 
+    // set the correct strict mode flag on the context
+    bool cstrict = ctx->strictMode;
+    ctx->strictMode = strict;
+
     Value result = f->code(ctx, f->codeData);
 
+    ctx->strictMode = cstrict;
+
     if (strict)
         ctx->leaveCallContext();