diff options
Diffstat (limited to 'src/qml/jsruntime/qv4objectproto.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 926d246373..a4f960a3b6 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -188,7 +188,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyDescriptors(const FunctionOb ScopedObject descriptors(scope, scope.engine->newObject()); - ObjectIterator it(scope, o, ObjectIterator::NoFlags); + ObjectIterator it(scope, o, ObjectIterator::WithSymbols); ScopedProperty pd(scope); PropertyAttributes attrs; ScopedPropertyKey key(scope); @@ -227,15 +227,19 @@ ReturnedValue ObjectPrototype::method_getOwnPropertySymbols(const FunctionObject ScopedObject O(scope, argv[0].toObject(scope.engine)); if (!O) return Encode::undefined(); - Heap::InternalClass *ic = O->d()->internalClass; - ScopedValue n(scope); + ScopedArrayObject array(scope, scope.engine->newArrayObject()); - for (uint i = 0; i < ic->size; ++i) { - PropertyKey id = ic->nameMap.at(i); - n = id.asStringOrSymbol(); - if (!n || !n->isSymbol()) - continue; - array->push_back(n); + if (O) { + ObjectIterator it(scope, O, ObjectIterator::WithSymbols); + ScopedValue name(scope); + while (1) { + name = it.nextPropertyNameAsString(); + if (name->isNull()) + break; + if (!name->isSymbol()) + continue; + array->push_back(name); + } } return array->asReturnedValue(); } @@ -916,6 +920,8 @@ Heap::ArrayObject *ObjectPrototype::getOwnPropertyNames(ExecutionEngine *v4, con name = it.nextPropertyNameAsString(); if (name->isNull()) break; + if (name->isSymbol()) + continue; array->push_back(name); } } |