diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-22 12:45:51 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-29 06:54:13 +0000 |
commit | 697564810f94ba32792ae714ca861e330bb4c657 (patch) | |
tree | 8f7f443edfe2662bf58177bef9d4dfe2bda58131 /src/qml/jsruntime/qv4reflect.cpp | |
parent | 16f18f68e37661f45047c913b9e6f9068dbc88a9 (diff) |
Fix dead temporal zone checking in module namespaces
Accessing uninitialized imports through the module namespace object
should throw a reference error. Unfortunately we can't do this check on
the caller side of the namespace object get, as we have no idea that
we're talking to one. Therefore we must throw in the vtable methods.
When checking via Reflect.has(), the properties should be reported as
existing. This means providing a virtual hasProperty() in the module as
well as changing Reflect::method_has to use the vtable method instead of
doing a get (which would throw).
Change-Id: Ic0ec51de3832c6a67044fc8f689ac534f349c1b6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4reflect.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4reflect.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4reflect.cpp b/src/qml/jsruntime/qv4reflect.cpp index 3dc0956e0c..766a0c4592 100644 --- a/src/qml/jsruntime/qv4reflect.cpp +++ b/src/qml/jsruntime/qv4reflect.cpp @@ -200,9 +200,7 @@ ReturnedValue Reflect::method_has(const FunctionObject *f, const Value *, const if (scope.engine->hasException) return false; - bool hasProperty = false; - (void) o->get(name, nullptr, &hasProperty); - return Encode(hasProperty); + return Encode(o->hasProperty(name)); } ReturnedValue Reflect::method_isExtensible(const FunctionObject *f, const Value *, const Value *argv, int argc) |