From 3035632ba1516a5704013279305ea37ba6f3d664 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 8 Jan 2014 14:57:07 +0100 Subject: Fix a small bug in queryIndexed() for StringObjects The string is immutable, thus queries indexing into the string data need to return Attr_NotWritable|Attr_NotConfigurable (see 15.5.5.2 of the ecma spec). Change-Id: I180d983b04a209c29fcd37b11682999b57bc42fe Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4object.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 0208c85c69..3b2fb091dd 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -454,9 +454,9 @@ PropertyAttributes Object::queryIndexed(const Managed *m, uint index) return o->arrayData->attributes(index); if (o->isStringObject()) { - Property *p = static_cast(o)->getIndex(index); - if (p) - return Attr_Data; + String *s = static_cast(o)->value.asString(); + if (index < (uint)s->length()) + return (Attr_NotWritable|Attr_NotConfigurable); } return Attr_Invalid; } -- cgit v1.2.3