aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-29 14:25:09 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-29 18:10:52 +0000
commitb6018a8167b23988542100312b4f2cd126c41700 (patch)
tree2e55d759b2996f96c1fae84d2abc42ff83030f8c /src/qml/jsruntime/qv4functionobject.cpp
parent123f01df338972e2253ae2ab993027755695ceea (diff)
Initialize this to empty for derived constructors
As per spec, this should be uninitialized in derived constructors, and the base constructor needs to get called exactly once. Change-Id: If31804e58d7ba62efde8fbf6cd852674f8da4495 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index a5dc0ba567..f7bea9a5f0 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -556,7 +556,7 @@ ReturnedValue ConstructorFunction::virtualCallAsConstructor(const FunctionObject
CppStackFrame frame;
frame.init(v4, f->function(), argv, argc);
frame.setupJSFrame(v4->jsStackTop, *f, f->scope(),
- Primitive::undefinedValue(),
+ Primitive::emptyValue(),
newTarget ? *newTarget : Primitive::undefinedValue());
frame.push();
@@ -570,7 +570,7 @@ ReturnedValue ConstructorFunction::virtualCallAsConstructor(const FunctionObject
return Encode::undefined();
else if (Value::fromReturnedValue(result).isObject())
return result;
- else if (!Value::fromReturnedValue(result).isUndefined())
+ else if (!Value::fromReturnedValue(result).isUndefined() || frame.jsFrame->thisObject.isEmpty())
return v4->throwTypeError();
return frame.jsFrame->thisObject.asReturnedValue();
}