aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-08 12:27:15 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-08 16:51:16 +0000
commit5d470f51214b273951cc7612ee018fc347716836 (patch)
treee6ae9e7f93b3dca3d307fe55de3c348223f816bc
parentf726c56ce8ca5cfae510d8b81b44ad816f6ad245 (diff)
Fix some bugs in Proxy::virtualGetOwnProperty
Change-Id: I28c32f2bfdac8848baf82905fb04790f29451805 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/jsruntime/qv4property_p.h18
-rw-r--r--src/qml/jsruntime/qv4proxy.cpp4
-rw-r--r--tests/auto/qml/ecmascripttests/TestExpectations3
3 files changed, 20 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index bad8eeb078..4e38bac470 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -78,6 +78,24 @@ struct Property {
attrs->resolve();
}
+ // ES8: 6.2.5.6
+ void completed(PropertyAttributes *attrs) {
+ if (value.isEmpty())
+ value = Encode::undefined();
+ if (attrs->isGeneric() || attrs->isData()) {
+ attrs->setType(PropertyAttributes::Data);
+ if (!attrs->hasWritable())
+ attrs->setWritable(false);
+ } else {
+ if (set.isEmpty())
+ set = Encode::undefined();
+ }
+ if (!attrs->hasEnumerable())
+ attrs->setEnumerable(false);
+ if (!attrs->hasConfigurable())
+ attrs->setConfigurable(false);
+ }
+
inline bool isSubset(const PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs) const;
inline void merge(PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs);
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp
index 19e46304af..895763d40e 100644
--- a/src/qml/jsruntime/qv4proxy.cpp
+++ b/src/qml/jsruntime/qv4proxy.cpp
@@ -275,7 +275,7 @@ PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id
ScopedProperty resultDesc(scope);
PropertyAttributes resultAttributes;
ObjectPrototype::toPropertyDescriptor(scope.engine, trapResult, resultDesc, &resultAttributes);
- resultDesc->fullyPopulated(&resultAttributes);
+ resultDesc->completed(&resultAttributes);
if (!targetDesc->isCompatible(targetAttributes, resultDesc, resultAttributes)) {
scope.engine->throwTypeError();
@@ -283,7 +283,7 @@ PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id
}
if (!resultAttributes.isConfigurable()) {
- if (targetAttributes == Attr_Invalid || !targetAttributes.isConfigurable()) {
+ if (targetAttributes == Attr_Invalid || targetAttributes.isConfigurable()) {
scope.engine->throwTypeError();
return Attr_Invalid;
}
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations
index 2a7b6d4551..e72fd0637c 100644
--- a/tests/auto/qml/ecmascripttests/TestExpectations
+++ b/tests/auto/qml/ecmascripttests/TestExpectations
@@ -330,9 +330,6 @@ built-ins/Promise/resolve/prop-desc.js fails
built-ins/Promise/resolve/resolve-from-promise-capability.js fails
built-ins/Promise/resolve/resolve-prms-cstm-then.js fails
built-ins/Proxy/enumerate/removed-does-not-trigger.js fails
-built-ins/Proxy/getOwnPropertyDescriptor/result-type-is-not-object-nor-undefined.js fails
-built-ins/Proxy/getOwnPropertyDescriptor/resultdesc-is-not-configurable-targetdesc-is-configurable.js fails
-built-ins/Proxy/getOwnPropertyDescriptor/resultdesc-return-not-configurable.js fails
built-ins/Proxy/getOwnPropertyDescriptor/trap-is-undefined.js fails
built-ins/Proxy/has/call-object-create.js fails
built-ins/Proxy/ownKeys/call-parameters-object-getownpropertysymbols.js fails