diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-08 09:59:24 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-08 16:50:51 +0000 |
commit | 26dc00747e1e2632435d01b7562443dff4f2e7d3 (patch) | |
tree | 2eb62cf4fa67992b1f17001420e60a5fb200f973 /src/qml/jsruntime/qv4proxy.cpp | |
parent | 321d1d3f9d6338d2f536d58492bb3e4a5dfb808e (diff) |
Implement IsCompatiblePropertyDescriptor and use it in Proxy
Change-Id: I40bc5ce2858ebfe1afb04a7957a53114b37ef50f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4proxy.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4proxy.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp index d4f342c50e..19e46304af 100644 --- a/src/qml/jsruntime/qv4proxy.cpp +++ b/src/qml/jsruntime/qv4proxy.cpp @@ -277,9 +277,10 @@ PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id ObjectPrototype::toPropertyDescriptor(scope.engine, trapResult, resultDesc, &resultAttributes); resultDesc->fullyPopulated(&resultAttributes); - // ### - //Let valid be IsCompatiblePropertyDescriptor(extensibleTarget, resultDesc, targetDesc). - //If valid is false, throw a TypeError exception. + if (!targetDesc->isCompatible(targetAttributes, resultDesc, resultAttributes)) { + scope.engine->throwTypeError(); + return Attr_Invalid; + } if (!resultAttributes.isConfigurable()) { if (targetAttributes == Attr_Invalid || !targetAttributes.isConfigurable()) { @@ -336,8 +337,10 @@ bool ProxyObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Pro return false; } } else { - // ### - // if IsCompatiblePropertyDescriptor(extensibleTarget, Desc, targetDesc) is false throw a type error. + if (!targetDesc->isCompatible(targetAttributes, p, attrs)) { + scope.engine->throwTypeError(); + return false; + } if (settingConfigFalse && targetAttributes.isConfigurable()) { scope.engine->throwTypeError(); return false; |