aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-01-08 14:57:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-20 21:13:54 +0100
commit3035632ba1516a5704013279305ea37ba6f3d664 (patch)
tree55bce7ef6138c9d89cd81a591deb2debb2573d06
parent375ebc57ac6401d09818e6aa4ea7d6324dbe93a6 (diff)
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 <simon.hausmann@digia.com>
-rw-r--r--src/qml/jsruntime/qv4object.cpp6
1 files 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<const StringObject *>(o)->getIndex(index);
- if (p)
- return Attr_Data;
+ String *s = static_cast<const StringObject *>(o)->value.asString();
+ if (index < (uint)s->length())
+ return (Attr_NotWritable|Attr_NotConfigurable);
}
return Attr_Invalid;
}