diff options
author | Robin Burchell <[email protected]> | 2017-02-09 00:42:30 +0100 |
---|---|---|
committer | Robin Burchell <[email protected]> | 2017-02-09 14:53:18 +0000 |
commit | bdb20c74eb452fcd63d88bfc520ec3e1b0cf5788 (patch) | |
tree | 0eab1f591e54a77fa43c90740684eff12673e473 /src/qml/jsruntime/qv4context.cpp | |
parent | 62268fb2a025fee49d0ac8bcf965cc989b583cae (diff) |
As crazy as it is, redefinition of global properties should work
Furthermore, some of the ES6 tests do check for this behavior (this
fixes at least 9 of the tests in /test/built-ins/Object/, maybe more
elsewhere).
createMutableBinding used hasProperty(String*) to determine whether or
not it needs to actually define a property, which checks the prototype
chain.
This would be fine, but when writing values to properties, we used find() on
the InternalClass (which is equivilent to Object::hasOwnProperty), which
would fail as the property doesn't "really" exist on the object, it's somewhere
in the prototype chain. Thus, we'd incorrectly throw an exception in strict mode.
I see no regressions in ES5 from this change.
Change-Id: I3b097306f220a891955ec11eea860264746bc0ee
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 60b90e4bf0..740ebbe359 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -155,7 +155,7 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable) ctx = ctx->d()->outer; } - if (activation->hasProperty(name)) + if (activation->hasOwnProperty(name)) return; ScopedProperty desc(scope); PropertyAttributes attrs(Attr_Data); |