diff options
-rw-r--r-- | src/qml/jsruntime/jsruntime.pri | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayiterator.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayiterator_p.h | 12 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4iterator_p.h | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4managed.cpp | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4setiterator.cpp | 100 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4setiterator_p.h | 103 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4setobject.cpp | 297 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4setobject_p.h | 113 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qml/ecmascripttests/TestExpectations | 183 | ||||
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 1 |
17 files changed, 663 insertions, 200 deletions
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index 96956e2613..91b68f6d79 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -41,6 +41,8 @@ SOURCES += \ $$PWD/qv4serialize.cpp \ $$PWD/qv4script.cpp \ $$PWD/qv4symbol.cpp \ + $$PWD/qv4setobject.cpp \ + $$PWD/qv4setiterator.cpp \ $$PWD/qv4include.cpp \ $$PWD/qv4qobjectwrapper.cpp \ $$PWD/qv4arraybuffer.cpp \ @@ -96,6 +98,8 @@ HEADERS += \ $$PWD/qv4serialize_p.h \ $$PWD/qv4script_p.h \ $$PWD/qv4symbol_p.h \ + $$PWD/qv4setobject_p.h \ + $$PWD/qv4setiterator_p.h \ $$PWD/qv4scopedvalue_p.h \ $$PWD/qv4executableallocator_p.h \ $$PWD/qv4include_p.h \ diff --git a/src/qml/jsruntime/qv4arrayiterator.cpp b/src/qml/jsruntime/qv4arrayiterator.cpp index fb8c3295bd..d6f787c01d 100644 --- a/src/qml/jsruntime/qv4arrayiterator.cpp +++ b/src/qml/jsruntime/qv4arrayiterator.cpp @@ -70,7 +70,7 @@ ReturnedValue ArrayIteratorPrototype::method_next(const FunctionObject *b, const } quint32 index = thisObject->d()->nextIndex; - ArrayIteratorKind itemKind = thisObject->d()->iterationKind; + IteratorKind itemKind = thisObject->d()->iterationKind; Scoped<TypedArray> ta(scope, a->as<TypedArray>()); quint32 len = a->getLength(); diff --git a/src/qml/jsruntime/qv4arrayiterator_p.h b/src/qml/jsruntime/qv4arrayiterator_p.h index 2951c9a763..6d6bb466f1 100644 --- a/src/qml/jsruntime/qv4arrayiterator_p.h +++ b/src/qml/jsruntime/qv4arrayiterator_p.h @@ -53,6 +53,7 @@ // #include "qv4object_p.h" +#include "qv4iterator_p.h" #include "qv4arraydata_p.h" QT_BEGIN_NAMESPACE @@ -60,20 +61,11 @@ QT_BEGIN_NAMESPACE namespace QV4 { -// ### spec says that this is a string, but I don't see it exposed anywhere, so -// does that matter? -// ### maybe we should share this with other iterator types in the future. -enum ArrayIteratorKind { - KeyIteratorKind, - ValueIteratorKind, - KeyValueIteratorKind -}; - namespace Heap { #define ArrayIteratorObjectMembers(class, Member) \ Member(class, Pointer, Object *, iteratedObject) \ - Member(class, NoMark, ArrayIteratorKind, iterationKind) \ + Member(class, NoMark, IteratorKind, iterationKind) \ Member(class, NoMark, quint32, nextIndex) DECLARE_HEAP_OBJECT(ArrayIteratorObject, Object) { diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index c106d5531f..434f6781a8 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -473,7 +473,7 @@ ReturnedValue ArrayPrototype::method_entries(const FunctionObject *b, const Valu RETURN_UNDEFINED(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::KeyValueIteratorKind; + ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind; return ao->asReturnedValue(); } @@ -1083,7 +1083,7 @@ ReturnedValue ArrayPrototype::method_keys(const FunctionObject *f, const Value * RETURN_UNDEFINED(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::KeyIteratorKind; + ao->d()->iterationKind = IteratorKind::KeyIteratorKind; return ao->asReturnedValue(); } @@ -1446,7 +1446,7 @@ ReturnedValue ArrayPrototype::method_values(const FunctionObject *b, const Value RETURN_UNDEFINED(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::ValueIteratorKind; + ao->d()->iterationKind = IteratorKind::ValueIteratorKind; return ao->asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 87132f64bb..1f326d3ead 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -42,6 +42,7 @@ #include <qv4object_p.h> #include <qv4objectproto_p.h> #include <qv4objectiterator_p.h> +#include <qv4setiterator_p.h> #include <qv4arrayiterator_p.h> #include <qv4arrayobject_p.h> #include <qv4booleanobject_p.h> @@ -54,6 +55,7 @@ #include <qv4regexpobject_p.h> #include <qv4regexp_p.h> #include "qv4symbol_p.h" +#include "qv4setobject_p.h" #include <qv4variantobject_p.h> #include <qv4runtime_p.h> #include <private/qv4mm_p.h> @@ -421,6 +423,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) jsObjects[URIError_Ctor] = memoryManager->allocate<URIErrorCtor>(global); jsObjects[IteratorProto] = memoryManager->allocate<IteratorPrototype>(); jsObjects[ForInIteratorProto] = memoryManager->allocObject<ForInIteratorPrototype>(newInternalClass(ForInIteratorPrototype::staticVTable(), iteratorPrototype())); + jsObjects[SetIteratorProto] = memoryManager->allocObject<SetIteratorPrototype>(newInternalClass(SetIteratorPrototype::staticVTable(), iteratorPrototype())); jsObjects[ArrayIteratorProto] = memoryManager->allocObject<ArrayIteratorPrototype>(newInternalClass(ArrayIteratorPrototype::staticVTable(), iteratorPrototype())); jsObjects[StringIteratorProto] = memoryManager->allocObject<StringIteratorPrototype>(newInternalClass(StringIteratorPrototype::staticVTable(), iteratorPrototype())); @@ -448,6 +451,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) static_cast<IteratorPrototype *>(iteratorPrototype())->init(this); static_cast<ForInIteratorPrototype *>(forInIteratorPrototype())->init(this); + static_cast<SetIteratorPrototype *>(setIteratorPrototype())->init(this); static_cast<ArrayIteratorPrototype *>(arrayIteratorPrototype())->init(this); static_cast<StringIteratorPrototype *>(stringIteratorPrototype())->init(this); @@ -457,6 +461,10 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) sequencePrototype()->cast<SequencePrototype>()->init(); #endif + jsObjects[Set_Ctor] = memoryManager->allocate<SetCtor>(global); + jsObjects[SetProto] = memoryManager->allocate<SetPrototype>(); + static_cast<SetPrototype *>(setPrototype())->init(this, setCtor()); + // typed arrays jsObjects[ArrayBuffer_Ctor] = memoryManager->allocate<ArrayBufferCtor>(global); @@ -506,6 +514,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) globalObject->defineDefaultProperty(QStringLiteral("ArrayBuffer"), *arrayBufferCtor()); globalObject->defineDefaultProperty(QStringLiteral("DataView"), *dataViewCtor()); + globalObject->defineDefaultProperty(QStringLiteral("Set"), *setCtor()); for (int i = 0; i < Heap::TypedArray::NTypes; ++i) globalObject->defineDefaultProperty((str = typedArrayCtors[i].as<FunctionObject>()->name())->toQString(), typedArrayCtors[i]); ScopedObject o(scope); @@ -815,6 +824,11 @@ Heap::Object *ExecutionEngine::newForInIteratorObject(Object *o) return obj->d(); } +Heap::Object *ExecutionEngine::newSetIteratorObject(Object *o) +{ + return memoryManager->allocate<SetIteratorObject>(o->d(), this); +} + Heap::Object *ExecutionEngine::newArrayIteratorObject(Object *o) { return memoryManager->allocate<ArrayIteratorObject>(o->d(), this); diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index aa38189cdf..9e5f3fa162 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -186,11 +186,13 @@ public: #endif ArrayBufferProto, DataViewProto, + SetProto, IntrinsicTypedArrayProto, ValueTypeProto, SignalHandlerProto, IteratorProto, ForInIteratorProto, + SetIteratorProto, ArrayIteratorProto, StringIteratorProto, @@ -213,6 +215,7 @@ public: URIError_Ctor, ArrayBuffer_Ctor, DataView_Ctor, + Set_Ctor, IntrinsicTypedArray_Ctor, GetSymbolSpecies, @@ -247,6 +250,7 @@ public: FunctionObject *uRIErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + URIError_Ctor); } FunctionObject *arrayBufferCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + ArrayBuffer_Ctor); } FunctionObject *dataViewCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + DataView_Ctor); } + FunctionObject *setCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Set_Ctor); } FunctionObject *intrinsicTypedArrayCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + IntrinsicTypedArray_Ctor); } FunctionObject *typedArrayCtors; @@ -278,6 +282,7 @@ public: Object *arrayBufferPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayBufferProto); } Object *dataViewPrototype() const { return reinterpret_cast<Object *>(jsObjects + DataViewProto); } + Object *setPrototype() const { return reinterpret_cast<Object *>(jsObjects + SetProto); } Object *intrinsicTypedArrayPrototype() const { return reinterpret_cast<Object *>(jsObjects + IntrinsicTypedArrayProto); } Object *typedArrayPrototype; @@ -285,6 +290,7 @@ public: Object *signalHandlerPrototype() const { return reinterpret_cast<Object *>(jsObjects + SignalHandlerProto); } Object *iteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + IteratorProto); } Object *forInIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ForInIteratorProto); } + Object *setIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + SetIteratorProto); } Object *arrayIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayIteratorProto); } Object *stringIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + StringIteratorProto); } @@ -510,6 +516,7 @@ public: Heap::Object *newVariantObject(const QVariant &v); Heap::Object *newForInIteratorObject(Object *o); + Heap::Object *newSetIteratorObject(Object *o); Heap::Object *newArrayIteratorObject(Object *o); Heap::QmlContext *qmlContext() const; diff --git a/src/qml/jsruntime/qv4iterator_p.h b/src/qml/jsruntime/qv4iterator_p.h index d4617166ad..28e337d21b 100644 --- a/src/qml/jsruntime/qv4iterator_p.h +++ b/src/qml/jsruntime/qv4iterator_p.h @@ -59,6 +59,12 @@ QT_BEGIN_NAMESPACE namespace QV4 { +enum IteratorKind { + KeyIteratorKind, + ValueIteratorKind, + KeyValueIteratorKind +}; + struct IteratorPrototype : Object { void init(ExecutionEngine *engine); diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp index bd22e2bc04..304aded44d 100644 --- a/src/qml/jsruntime/qv4managed.cpp +++ b/src/qml/jsruntime/qv4managed.cpp @@ -125,6 +125,9 @@ QString Managed::className() const case Type_ExecutionContext: s = "__ExecutionContext"; break; + case Type_SetIteratorObject: + s = "Set Iterator"; + break; case Type_ArrayIteratorObject: s = "Array Iterator"; break; diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 020e61f014..949b4cdcb4 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -199,6 +199,7 @@ public: Type_ExecutionContext, Type_InternalClass, + Type_SetIteratorObject, Type_ArrayIteratorObject, Type_StringIteratorObject, Type_ForInIterator, diff --git a/src/qml/jsruntime/qv4setiterator.cpp b/src/qml/jsruntime/qv4setiterator.cpp new file mode 100644 index 0000000000..715a4e30d5 --- /dev/null +++ b/src/qml/jsruntime/qv4setiterator.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Crimson AS <info@crimson.no> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <private/qv4iterator_p.h> +#include <private/qv4setiterator_p.h> +#include <private/qv4setobject_p.h> +#include <private/qv4symbol_p.h> + +using namespace QV4; + +DEFINE_OBJECT_VTABLE(SetIteratorObject); + +void SetIteratorPrototype::init(ExecutionEngine *e) +{ + defineDefaultProperty(QStringLiteral("next"), method_next, 0); + + Scope scope(e); + ScopedString val(scope, e->newString(QLatin1String("Set Iterator"))); + defineReadonlyConfigurableProperty(e->symbol_toStringTag(), val); +} + +ReturnedValue SetIteratorPrototype::method_next(const FunctionObject *b, const Value *that, const Value *, int) +{ + Scope scope(b); + const SetIteratorObject *thisObject = that->as<SetIteratorObject>(); + if (!thisObject) + return scope.engine->throwTypeError(QLatin1String("Not a Set Iterator instance")); + + Scoped<SetObject> s(scope, thisObject->d()->iteratedSet); + quint32 index = thisObject->d()->setNextIndex; + IteratorKind itemKind = thisObject->d()->iterationKind; + + + if (!s) { + QV4::Value undefined = Primitive::undefinedValue(); + return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); + } + + Scoped<ArrayObject> arr(scope, s->d()->setArray); + + while (index < arr->getLength()) { + ScopedValue e(scope, arr->getIndexed(index)); + index += 1; + thisObject->d()->setNextIndex = index; + + if (itemKind == KeyValueIteratorKind) { + // Return CreateIterResultObject(CreateArrayFromList(« e, e »), false). + ScopedArrayObject resultArray(scope, scope.engine->newArrayObject()); + resultArray->arrayReserve(2); + resultArray->arrayPut(0, e); + resultArray->arrayPut(1, e); + resultArray->setArrayLengthUnchecked(2); + + return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false); + } + + return IteratorPrototype::createIterResultObject(scope.engine, e, false); + } + + thisObject->d()->iteratedSet.set(scope.engine, nullptr); + QV4::Value undefined = Primitive::undefinedValue(); + return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); +} + diff --git a/src/qml/jsruntime/qv4setiterator_p.h b/src/qml/jsruntime/qv4setiterator_p.h new file mode 100644 index 0000000000..78eda6d57b --- /dev/null +++ b/src/qml/jsruntime/qv4setiterator_p.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Crimson AS <info@crimson.no> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QV4SETITERATOR_P_H +#define QV4SETITERATOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qv4object_p.h" +#include "qv4iterator_p.h" + +QT_BEGIN_NAMESPACE + +namespace QV4 { + +namespace Heap { + +#define SetIteratorObjectMembers(class, Member) \ + Member(class, Pointer, Object *, iteratedSet) \ + Member(class, NoMark, IteratorKind, iterationKind) \ + Member(class, NoMark, quint32, setNextIndex) + +DECLARE_HEAP_OBJECT(SetIteratorObject, Object) { + DECLARE_MARKOBJECTS(SetIteratorObject); + void init(Object *obj, QV4::ExecutionEngine *engine) + { + Object::init(); + this->iteratedSet.set(engine, obj); + this->setNextIndex = 0; + } +}; + +} + +struct SetIteratorPrototype : Object +{ + V4_PROTOTYPE(iteratorPrototype) + void init(ExecutionEngine *engine); + + static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); +}; + +struct SetIteratorObject : Object +{ + V4_OBJECT2(SetIteratorObject, Object) + Q_MANAGED_TYPE(SetIteratorObject) + V4_PROTOTYPE(setIteratorPrototype) + + void init(ExecutionEngine *engine); +}; + + +} + +QT_END_NAMESPACE + +#endif // QV4SETITERATOR_P_H + diff --git a/src/qml/jsruntime/qv4setobject.cpp b/src/qml/jsruntime/qv4setobject.cpp new file mode 100644 index 0000000000..4245cd2ea3 --- /dev/null +++ b/src/qml/jsruntime/qv4setobject.cpp @@ -0,0 +1,297 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Crimson AS <info@crimson.no> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qv4setobject_p.h" +#include "qv4setiterator_p.h" +#include "qv4symbol_p.h" + +using namespace QV4; + +DEFINE_OBJECT_VTABLE(SetCtor); +DEFINE_OBJECT_VTABLE(SetObject); + +void Heap::SetCtor::init(QV4::ExecutionContext *scope) +{ + Heap::FunctionObject::init(scope, QStringLiteral("Set")); +} + +ReturnedValue SetCtor::callAsConstructor(const FunctionObject *f, const Value *argv, int argc) +{ + Scope scope(f); + Scoped<SetObject> a(scope, scope.engine->memoryManager->allocate<SetObject>()); + Scoped<ArrayObject> arr(scope, scope.engine->newArrayObject()); + a->d()->setArray.set(scope.engine, arr->d()); + + if (argc > 0) { + ScopedValue iterable(scope, argv[0]); + if (!iterable->isUndefined() && !iterable->isNull()) { + ScopedFunctionObject adder(scope, a->get(ScopedString(scope, scope.engine->newString(QString::fromLatin1("add"))))); + if (!adder) { + return scope.engine->throwTypeError(); + } + ScopedObject iter(scope, Runtime::method_getIterator(scope.engine, iterable, true)); + CHECK_EXCEPTION(); + if (!iter) { + return a.asReturnedValue(); + } + + Value *nextValue = scope.alloc(1); + ScopedValue done(scope); + forever { + done = Runtime::method_iteratorNext(scope.engine, iter, nextValue); + CHECK_EXCEPTION(); + if (done->toBoolean()) { + return a.asReturnedValue(); + } + + adder->call(a, nextValue, 1); + if (scope.engine->hasException) { + ScopedValue falsey(scope, Encode(false)); + return Runtime::method_iteratorClose(scope.engine, iter, falsey); + } + } + } + } + + return a.asReturnedValue(); +} + +ReturnedValue SetCtor::call(const FunctionObject *f, const Value *, const Value *, int) +{ + Scope scope(f); + return scope.engine->throwTypeError(QString::fromLatin1("Set requires new")); +} + +void SetPrototype::init(ExecutionEngine *engine, Object *ctor) +{ + Scope scope(engine); + ScopedObject o(scope); + ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0)); + ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); + ctor->addSymbolSpecies(); + defineDefaultProperty(engine->id_constructor(), (o = ctor)); + + defineDefaultProperty(QStringLiteral("add"), method_add, 1); + defineDefaultProperty(QStringLiteral("clear"), method_clear, 0); + defineDefaultProperty(QStringLiteral("delete"), method_delete, 1); + defineDefaultProperty(QStringLiteral("entries"), method_entries, 0); + defineDefaultProperty(QStringLiteral("forEach"), method_forEach, 1); + defineDefaultProperty(QStringLiteral("has"), method_has, 1); + defineAccessorProperty(QStringLiteral("size"), method_get_size, nullptr); + + // Per the spec, the value for 'keys' is the same as 'values'. + ScopedString valString(scope, scope.engine->newIdentifier(QStringLiteral("values"))); + ScopedFunctionObject valuesFn(scope, FunctionObject::createBuiltinFunction(engine, valString, SetPrototype::method_values, 0)); + defineDefaultProperty(QStringLiteral("keys"), valuesFn); + defineDefaultProperty(QStringLiteral("values"), valuesFn); + + defineDefaultProperty(engine->symbol_iterator(), valuesFn); + + ScopedString val(scope, engine->newString(QLatin1String("Set"))); + defineReadonlyConfigurableProperty(engine->symbol_toStringTag(), val); +} + +ReturnedValue SetPrototype::method_add(const FunctionObject *b, const Value *thisObject, const Value *argv, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<ArrayObject> arr(scope, that->d()->setArray); + ScopedValue sk(scope); + qint64 len = arr->getLength(); + + for (int i = 0; i < len; ++i) { + sk = arr->getIndexed(i); + if (sk->sameValueZero(argv[0])) + return that.asReturnedValue(); + } + + sk = argv[0]; + if (sk->isDouble()) { + if (sk->doubleValue() == 0 && std::signbit(sk->doubleValue())) + sk = Primitive::fromDouble(+0); + } + + arr->putIndexed(len, sk); + return that.asReturnedValue(); +} + +ReturnedValue SetPrototype::method_clear(const FunctionObject *b, const Value *thisObject, const Value *, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<ArrayObject> arr(scope, scope.engine->newArrayObject()); + that->d()->setArray.set(scope.engine, arr->d()); + return Encode::undefined(); +} + +// delete value +ReturnedValue SetPrototype::method_delete(const FunctionObject *b, const Value *thisObject, const Value *argv, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<ArrayObject> arr(scope, that->d()->setArray); + ScopedValue sk(scope); + qint64 len = arr->getLength(); + + bool found = false; + int idx = 0; + + for (; idx < len; ++idx) { + sk = arr->getIndexed(idx); + if (sk->sameValueZero(argv[0])) { + found = true; + break; + } + } + + if (found == true) { + Scoped<ArrayObject> newArr(scope, scope.engine->newArrayObject()); + for (int j = 0, newIdx = 0; j < len; ++j, newIdx++) { + if (j == idx) { + newIdx--; // skip the entry + continue; + } + newArr->putIndexed(newIdx, ScopedValue(scope, arr->getIndexed(j))); + } + + that->d()->setArray.set(scope.engine, newArr->d()); + return Encode(true); + } else { + return Encode(false); + } +} + +ReturnedValue SetPrototype::method_entries(const FunctionObject *b, const Value *thisObject, const Value *, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<SetIteratorObject> ao(scope, scope.engine->newSetIteratorObject(that)); + ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind; + return ao->asReturnedValue(); +} + +ReturnedValue SetPrototype::method_forEach(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + ScopedFunctionObject callbackfn(scope, argv[0]); + if (!callbackfn) + return scope.engine->throwTypeError(); + + ScopedValue thisArg(scope, Primitive::undefinedValue()); + if (argc > 1) + thisArg = ScopedValue(scope, argv[1]); + + Scoped<ArrayObject> arr(scope, that->d()->setArray); + ScopedValue sk(scope); + qint64 len = arr->getLength(); + + Value *arguments = scope.alloc(3); + for (int i = 0; i < len; ++i) { + sk = arr->getIndexed(i); + + arguments[0] = sk; + arguments[1] = sk; + arguments[2] = that; + callbackfn->call(thisArg, arguments, 3); + CHECK_EXCEPTION(); + } + return Encode::undefined(); +} + +ReturnedValue SetPrototype::method_has(const FunctionObject *b, const Value *thisObject, const Value *argv, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<ArrayObject> arr(scope, that->d()->setArray); + ScopedValue sk(scope); + qint64 len = arr->getLength(); + + for (int i = 0; i < len; ++i) { + sk = arr->getIndexed(i); + if (sk->sameValueZero(argv[0])) + return Encode(true); + } + + return Encode(false); +} + +ReturnedValue SetPrototype::method_get_size(const FunctionObject *b, const Value *thisObject, const Value *, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<ArrayObject> arr(scope, that->d()->setArray); + qint64 len = arr->getLength(); + return Encode((uint)len); +} + +ReturnedValue SetPrototype::method_values(const FunctionObject *b, const Value *thisObject, const Value *, int) +{ + Scope scope(b); + Scoped<SetObject> that(scope, thisObject); + if (!that) + return scope.engine->throwTypeError(); + + Scoped<SetIteratorObject> ao(scope, scope.engine->newSetIteratorObject(that)); + ao->d()->iterationKind = IteratorKind::ValueIteratorKind; + return ao->asReturnedValue(); +} + diff --git a/src/qml/jsruntime/qv4setobject_p.h b/src/qml/jsruntime/qv4setobject_p.h new file mode 100644 index 0000000000..ba0ed6bfe7 --- /dev/null +++ b/src/qml/jsruntime/qv4setobject_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Crimson AS <info@crimson.no> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QV4SETOBJECT_P_H +#define QV4SETOBJECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qv4object_p.h" +#include "qv4objectproto_p.h" +#include "qv4functionobject_p.h" +#include "qv4string_p.h" + +QT_BEGIN_NAMESPACE + +namespace QV4 { + +namespace Heap { + +struct SetCtor : FunctionObject { + void init(QV4::ExecutionContext *scope); +}; + +#define SetObjectMembers(class, Member) \ + Member(class, Pointer, ArrayObject *, setArray) + +DECLARE_HEAP_OBJECT(SetObject, Object) { + DECLARE_MARKOBJECTS(SetObject); + void init() { Object::init(); } +}; + +} + +struct SetCtor: FunctionObject +{ + V4_OBJECT2(SetCtor, FunctionObject) + + static ReturnedValue callAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); +}; + +struct SetObject : Object +{ + V4_OBJECT2(SetObject, Object) + V4_PROTOTYPE(setPrototype) +}; + +struct SetPrototype : Object +{ + void init(ExecutionEngine *engine, Object *ctor); + + static ReturnedValue method_add(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_clear(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_delete(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_entries(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_forEach(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_has(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_size(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_values(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); +}; + + +} // namespace QV4 + + +QT_END_NAMESPACE + +#endif // QV4SETOBJECT_P_H diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index c62c114e53..b3c6f0e094 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -465,7 +465,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_entries(const FunctionObject THROW_TYPE_ERROR(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::KeyValueIteratorKind; + ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind; return ao->asReturnedValue(); } @@ -477,7 +477,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_keys(const FunctionObject *b, THROW_TYPE_ERROR(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::KeyIteratorKind; + ao->d()->iterationKind = IteratorKind::KeyIteratorKind; return ao->asReturnedValue(); } @@ -489,7 +489,7 @@ ReturnedValue IntrinsicTypedArrayPrototype::method_values(const FunctionObject * THROW_TYPE_ERROR(); Scoped<ArrayIteratorObject> ao(scope, scope.engine->newArrayIteratorObject(O)); - ao->d()->iterationKind = ArrayIteratorKind::ValueIteratorKind; + ao->d()->iterationKind = IteratorKind::ValueIteratorKind; return ao->asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index 85b4297dd6..be406db325 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -257,6 +257,11 @@ bool Value::sameValueZero(Value other) const { return double(int_32()) == other.doubleValue(); if (isDouble() && other.isInteger()) return other.int_32() == doubleValue(); + if (isDouble() && other.isDouble()) { + if (doubleValue() == 0 && other.doubleValue() == 0) { + return true; + } + } return false; } diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations index 966e30e08e..6db3a0571f 100644 --- a/tests/auto/qml/ecmascripttests/TestExpectations +++ b/tests/auto/qml/ecmascripttests/TestExpectations @@ -1642,205 +1642,27 @@ built-ins/RegExp/prototype/unicode/this-val-regexp.js fails built-ins/RegExp/u180e.js fails built-ins/RegExp/unicode_identity_escape.js fails built-ins/RegExp/valid-flags-y.js fails -built-ins/Set/Symbol.species/length.js fails -built-ins/Set/Symbol.species/return-value.js fails -built-ins/Set/Symbol.species/symbol-species-name.js fails -built-ins/Set/Symbol.species/symbol-species.js fails -built-ins/Set/constructor.js fails -built-ins/Set/length.js fails -built-ins/Set/name.js fails -built-ins/Set/properties-of-the-set-prototype-object.js fails built-ins/Set/proto-from-ctor-realm.js fails -built-ins/Set/prototype-of-set.js fails -built-ins/Set/prototype/Symbol.iterator.js fails -built-ins/Set/prototype/Symbol.toStringTag.js fails -built-ins/Set/prototype/Symbol.toStringTag/property-descriptor.js fails -built-ins/Set/prototype/add/add.js fails -built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/add/length.js fails -built-ins/Set/prototype/add/name.js fails -built-ins/Set/prototype/add/preserves-insertion-order.js fails -built-ins/Set/prototype/add/returns-this-when-ignoring-duplicate.js fails -built-ins/Set/prototype/add/returns-this.js fails -built-ins/Set/prototype/add/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/add/this-not-object-throw-null.js fails -built-ins/Set/prototype/add/this-not-object-throw-number.js fails -built-ins/Set/prototype/add/this-not-object-throw-string.js fails -built-ins/Set/prototype/add/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/add/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/add/will-not-add-duplicate-entry-initial-iterable.js fails -built-ins/Set/prototype/add/will-not-add-duplicate-entry-normalizes-zero.js fails -built-ins/Set/prototype/add/will-not-add-duplicate-entry.js fails -built-ins/Set/prototype/clear/clear.js fails -built-ins/Set/prototype/clear/clears-all-contents-from-iterable.js fails -built-ins/Set/prototype/clear/clears-all-contents.js fails -built-ins/Set/prototype/clear/clears-an-empty-set.js fails -built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-set.prototype.js fails built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/clear/length.js fails -built-ins/Set/prototype/clear/name.js fails -built-ins/Set/prototype/clear/returns-undefined.js fails -built-ins/Set/prototype/clear/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/clear/this-not-object-throw-null.js fails -built-ins/Set/prototype/clear/this-not-object-throw-number.js fails -built-ins/Set/prototype/clear/this-not-object-throw-string.js fails -built-ins/Set/prototype/clear/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/clear/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/constructor/set-prototype-constructor-intrinsic.js fails -built-ins/Set/prototype/constructor/set-prototype-constructor.js fails -built-ins/Set/prototype/delete/delete-entry-initial-iterable.js fails -built-ins/Set/prototype/delete/delete-entry-normalizes-zero.js fails -built-ins/Set/prototype/delete/delete-entry.js fails -built-ins/Set/prototype/delete/delete.js fails -built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/delete/length.js fails -built-ins/Set/prototype/delete/name.js fails -built-ins/Set/prototype/delete/returns-false-when-delete-is-noop.js fails -built-ins/Set/prototype/delete/returns-true-when-delete-operation-occurs.js fails -built-ins/Set/prototype/delete/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/delete/this-not-object-throw-null.js fails -built-ins/Set/prototype/delete/this-not-object-throw-number.js fails -built-ins/Set/prototype/delete/this-not-object-throw-string.js fails -built-ins/Set/prototype/delete/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/delete/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/entries/entries.js fails -built-ins/Set/prototype/entries/length.js fails -built-ins/Set/prototype/entries/name.js fails -built-ins/Set/prototype/entries/returns-iterator-empty.js fails -built-ins/Set/prototype/entries/returns-iterator.js fails -built-ins/Set/prototype/entries/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/entries/this-not-object-throw-null.js fails -built-ins/Set/prototype/entries/this-not-object-throw-number.js fails -built-ins/Set/prototype/entries/this-not-object-throw-string.js fails -built-ins/Set/prototype/entries/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/entries/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/forEach/callback-not-callable-boolean.js fails -built-ins/Set/prototype/forEach/callback-not-callable-null.js fails -built-ins/Set/prototype/forEach/callback-not-callable-number.js fails -built-ins/Set/prototype/forEach/callback-not-callable-string.js fails -built-ins/Set/prototype/forEach/callback-not-callable-symbol.js fails -built-ins/Set/prototype/forEach/callback-not-callable-undefined.js fails -built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/forEach/forEach.js fails -built-ins/Set/prototype/forEach/iterates-in-insertion-order.js fails -built-ins/Set/prototype/forEach/iterates-in-iterable-entry-order.js fails built-ins/Set/prototype/forEach/iterates-values-added-after-foreach-begins.js fails built-ins/Set/prototype/forEach/iterates-values-deleted-then-readded.js fails -built-ins/Set/prototype/forEach/iterates-values-not-deleted.js fails built-ins/Set/prototype/forEach/iterates-values-revisits-after-delete-re-add.js fails -built-ins/Set/prototype/forEach/length.js fails -built-ins/Set/prototype/forEach/name.js fails -built-ins/Set/prototype/forEach/returns-undefined.js fails built-ins/Set/prototype/forEach/this-arg-explicit-cannot-override-lexical-this-arrow.js fails -built-ins/Set/prototype/forEach/this-arg-explicit.js fails -built-ins/Set/prototype/forEach/this-non-strict.js sloppyFails -built-ins/Set/prototype/forEach/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/forEach/this-not-object-throw-null.js fails -built-ins/Set/prototype/forEach/this-not-object-throw-number.js fails -built-ins/Set/prototype/forEach/this-not-object-throw-string.js fails -built-ins/Set/prototype/forEach/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/forEach/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/forEach/this-strict.js strictFails -built-ins/Set/prototype/forEach/throws-when-callback-throws.js fails -built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/has/has.js fails -built-ins/Set/prototype/has/length.js fails -built-ins/Set/prototype/has/name.js fails -built-ins/Set/prototype/has/returns-false-when-undefined-added-deleted-not-present-undefined.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-boolean.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-nan.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-null.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-number.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-string.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-symbol.js fails -built-ins/Set/prototype/has/returns-false-when-value-not-present-undefined.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-boolean.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-nan.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-null.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-number.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-string.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-symbol.js fails -built-ins/Set/prototype/has/returns-true-when-value-present-undefined.js fails -built-ins/Set/prototype/has/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/has/this-not-object-throw-null.js fails -built-ins/Set/prototype/has/this-not-object-throw-number.js fails -built-ins/Set/prototype/has/this-not-object-throw-string.js fails -built-ins/Set/prototype/has/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/has/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/keys/keys.js fails -built-ins/Set/prototype/set-prototype.js fails -built-ins/Set/prototype/size/length.js fails built-ins/Set/prototype/size/name.js fails -built-ins/Set/prototype/size/returns-count-of-present-values-before-after-add-delete.js fails -built-ins/Set/prototype/size/returns-count-of-present-values-by-insertion.js fails -built-ins/Set/prototype/size/returns-count-of-present-values-by-iterable.js fails built-ins/Set/prototype/size/size.js fails -built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-array.js fails built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-map.js fails -built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-object.js fails -built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-set-prototype.js fails built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js fails -built-ins/Set/prototype/values/length.js fails -built-ins/Set/prototype/values/name.js fails -built-ins/Set/prototype/values/returns-iterator-empty.js fails -built-ins/Set/prototype/values/returns-iterator.js fails -built-ins/Set/prototype/values/this-not-object-throw-boolean.js fails -built-ins/Set/prototype/values/this-not-object-throw-null.js fails -built-ins/Set/prototype/values/this-not-object-throw-number.js fails -built-ins/Set/prototype/values/this-not-object-throw-string.js fails -built-ins/Set/prototype/values/this-not-object-throw-symbol.js fails -built-ins/Set/prototype/values/this-not-object-throw-undefined.js fails -built-ins/Set/prototype/values/values-iteration-mutable.js fails -built-ins/Set/prototype/values/values.js fails -built-ins/Set/set-does-not-throw-when-add-is-not-callable.js fails -built-ins/Set/set-get-add-method-failure.js fails -built-ins/Set/set-iterable-calls-add.js fails -built-ins/Set/set-iterable-empty-does-not-call-add.js fails -built-ins/Set/set-iterable-throws-when-add-is-not-callable.js fails -built-ins/Set/set-iterable.js fails -built-ins/Set/set-iterator-close-after-add-failure.js fails -built-ins/Set/set-iterator-next-failure.js fails -built-ins/Set/set-iterator-value-failure.js fails -built-ins/Set/set-newtarget.js fails -built-ins/Set/set-no-iterable.js fails -built-ins/Set/set-undefined-newtarget.js fails -built-ins/Set/set.js fails -built-ins/Set/symbol-as-entry.js fails -built-ins/SetIteratorPrototype/Symbol.toStringTag.js fails -built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js fails -built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js fails -built-ins/SetIteratorPrototype/next/iteration-mutable.js fails -built-ins/SetIteratorPrototype/next/iteration.js fails -built-ins/SetIteratorPrototype/next/length.js fails -built-ins/SetIteratorPrototype/next/name.js fails -built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js fails -built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js fails -built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js fails -built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js fails built-ins/SharedArrayBuffer/allocation-limit.js fails built-ins/SharedArrayBuffer/data-allocation-after-object-creation.js fails built-ins/SharedArrayBuffer/init-zero.js fails @@ -5585,11 +5407,6 @@ language/statements/for-of/map.js fails language/statements/for-of/scope-body-lex-open.js fails language/statements/for-of/scope-head-lex-close.js fails language/statements/for-of/scope-head-lex-open.js fails -language/statements/for-of/set-contract-expand.js fails -language/statements/for-of/set-contract.js fails -language/statements/for-of/set-expand-contract.js fails -language/statements/for-of/set-expand.js fails -language/statements/for-of/set.js fails language/statements/for-of/yield-star-from-catch.js fails language/statements/for-of/yield-star-from-finally.js fails language/statements/for-of/yield-star-from-try.js fails diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index b9050fad73..dc3db2958c 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -969,6 +969,7 @@ void tst_QJSEngine::globalObjectProperties_enumerate() << "Uint32Array" << "Float32Array" << "Float64Array" + << "Set" ; QSet<QString> actualNames; { |