diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-10 19:30:08 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2012-12-10 20:08:26 +0100 |
commit | 9c104bb97098f690e4c8af6e17b7217891a8c690 (patch) | |
tree | 00a85b1e91d5f64c186355807b416a248e2b92d8 /qmljs_objects.cpp | |
parent | df458859f443c6c559c39c667952bcb85f277e9a (diff) |
Properly set up the 'this' pointer
Make sure the this pointer is setup correctly for
function calls. Also make sure we set the strict mode
flag correctly in all functions.
Change-Id: Idaacc92bf6469145b7addfac2bbddea588e85c2d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'qmljs_objects.cpp')
-rw-r--r-- | qmljs_objects.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/qmljs_objects.cpp b/qmljs_objects.cpp index d74a501a7e..6e0af63109 100644 --- a/qmljs_objects.cpp +++ b/qmljs_objects.cpp @@ -450,7 +450,7 @@ Value FunctionObject::construct(ExecutionContext *context, Value *args, int argc { ExecutionContext k; ExecutionContext *ctx = needsActivation ? context->engine->newContext() : &k; - ctx->initCallContext(context, Value::nullValue(), this, args, argc); + ctx->initCallContext(context, Value::undefinedValue(), this, args, argc); Value result = construct(ctx); ctx->wireUpPrototype(); ctx->leaveCallContext(); @@ -464,12 +464,6 @@ Value FunctionObject::call(ExecutionContext *context, Value thisObject, Value *a ExecutionContext k; ExecutionContext *ctx = needsActivation ? context->engine->newContext() : &k; - if (!strictMode && !thisObject.isObject()) { - if (thisObject.isUndefined() || thisObject.isNull()) - thisObject = context->engine->globalObject; - else - thisObject = __qmljs_to_object(thisObject, context); - } ctx->initCallContext(context, thisObject, this, args, argc); Value result = call(ctx); ctx->leaveCallContext(); |