aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-08-21 19:06:10 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-02 17:27:36 +0200
commit819b4ef8b1e196596b4f56cb0d729f6b5fa93b0b (patch)
tree9ce89f7a1a278a1dbfd03b2226f6e905150bf377 /src
parent6f472680ebecb3a4d700eedcf62cb423b05c4fd1 (diff)
Fix incorrect implementation of Array.toString()
The spec says we need to call join with empty arguments if it's callable, otherwise fall back to Object.toString() Change-Id: I36aed164b60fad89b7d23b8a6993964c344a9ed3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index c316a3196e..60e7afdaec 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -41,6 +41,7 @@
#include "qv4arrayobject_p.h"
#include "qv4sparsearray_p.h"
+#include "qv4objectproto_p.h"
using namespace QV4;
@@ -133,7 +134,14 @@ Value ArrayPrototype::method_isArray(SimpleCallContext *ctx)
Value ArrayPrototype::method_toString(SimpleCallContext *ctx)
{
- return method_join(ctx);
+ QV4::Object *o = ctx->thisObject.toObject(ctx);
+ FunctionObject *f = o->get(ctx->engine->newString("join")).asFunctionObject();
+ if (f) {
+ CALLDATA(0);
+ d.thisObject = ctx->thisObject;
+ return f->call(d);
+ }
+ return ObjectPrototype::method_toString(ctx);
}
Value ArrayPrototype::method_toLocaleString(SimpleCallContext *ctx)