From d1885b403196af17e931c24f3c98fc8afd03f005 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 8 Sep 2018 23:14:32 +0200 Subject: Fix a small bug in virtualHasProperty It should call hasProperty() on the proto if the property wasn't found locally, instead of looping and calling getOwnProperty, as this leads to subtly differences with Proxy objects. Change-Id: I088b0522c621999b7991f9194f46eaa9f6e15206 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4object.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/qml/jsruntime/qv4object.cpp') diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index cd9ea66297..c1f6642c9d 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -717,12 +717,13 @@ bool Object::virtualHasProperty(const Managed *m, PropertyKey id) Scope scope(m->engine()); ScopedObject o(scope, m); ScopedProperty p(scope); - while (o) { - if (o->getOwnProperty(id, p) != Attr_Invalid) - return true; - o = o->getPrototypeOf(); - } + if (o->getOwnProperty(id, p) != Attr_Invalid) + return true; + + o = o->getPrototypeOf(); + if (o) + return o->hasProperty(id); return false; } -- cgit v1.2.3