aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4object_p.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp
index d4d6201c01..025f98351f 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -95,7 +95,9 @@ ReturnedValue BooleanPrototype::method_toString(SimpleCallContext *ctx)
ReturnedValue BooleanPrototype::method_valueOf(SimpleCallContext *ctx)
{
- // ### Shouldn't this work for a boolean thisObject?
+ if (ctx->callData->thisObject.isBoolean())
+ return ctx->callData->thisObject.asReturnedValue();
+
Scope scope(ctx);
Scoped<BooleanObject> thisObject(scope, ctx->callData->thisObject);
if (!thisObject)
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 032aadd5a6..27ecf8bc58 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -340,6 +340,7 @@ struct BooleanObject: Object {
protected:
BooleanObject(InternalClass *ic)
: Object(ic) {
+ vtbl = &static_vtbl;
type = Type_BooleanObject;
value = Encode(false);
}
@@ -357,6 +358,7 @@ struct NumberObject: Object {
protected:
NumberObject(InternalClass *ic)
: Object(ic) {
+ vtbl = &static_vtbl;
type = Type_NumberObject;
value = Encode((int)0);
}