aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-29 16:30:10 +0200
committerLars Knoll <lars.knoll@qt.io>2018-06-04 13:02:15 +0000
commitab5485ccfcb44042be8b1280f4b0e57fae52893a (patch)
treebdec2a40add9c2ffd8ed372401d51356dba9f767
parentadb58fe81e2f79d5ba10eda3ed6187349fda40de (diff)
TypedArray.prototype[Symbol.iterator] and .values are the same function
Those two properties are supposed to point to the same function object according to ES7 spec. Change-Id: Ic0917aa28836ad8d665d2177f2f5c2a8d8ad3f6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp9
-rw-r--r--tests/auto/qml/ecmascripttests/TestExpectations1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 2fa4a9ecaf..3eadfe04a6 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -655,9 +655,14 @@ void IntrinsicTypedArrayPrototype::init(ExecutionEngine *engine, IntrinsicTypedA
defineDefaultProperty(QStringLiteral("entries"), method_entries, 0);
defineDefaultProperty(QStringLiteral("keys"), method_keys, 0);
- defineDefaultProperty(QStringLiteral("values"), method_values, 0);
defineDefaultProperty(QStringLiteral("set"), method_set, 1);
defineDefaultProperty(QStringLiteral("subarray"), method_subarray, 0);
- defineDefaultProperty(engine->symbol_iterator(), method_values, 0);
+
+ Scope scope(engine);
+ ScopedString valuesString(scope, engine->newIdentifier(QStringLiteral("values")));
+ ScopedObject values(scope, FunctionObject::createBuiltinFunction(engine, valuesString, method_values, 0));
+ defineDefaultProperty(QStringLiteral("values"), values);
+ defineDefaultProperty(engine->symbol_iterator(), values);
+
defineAccessorProperty(engine->symbol_toStringTag(), method_get_toStringTag, nullptr);
}
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations
index 6001062dfe..4f499824f7 100644
--- a/tests/auto/qml/ecmascripttests/TestExpectations
+++ b/tests/auto/qml/ecmascripttests/TestExpectations
@@ -1647,7 +1647,6 @@ built-ins/TypedArray/name.js fails
built-ins/TypedArray/of/length.js fails
built-ins/TypedArray/of/name.js fails
built-ins/TypedArray/of/prop-desc.js fails
-built-ins/TypedArray/prototype/Symbol.iterator.js fails
built-ins/TypedArray/prototype/Symbol.toStringTag/detached-buffer.js fails
built-ins/TypedArray/prototype/buffer/detached-buffer.js fails
built-ins/TypedArray/prototype/byteLength/detached-buffer.js fails