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/qv4typedarray.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/qv4typedarray.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 7606af80cb..7492f8872d 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -467,6 +467,13 @@ ReturnedValue TypedArray::virtualGet(const Managed *m, PropertyKey id, const Val return a->d()->type->read(a->d()->buffer->data->data() + byteOffset); } +bool TypedArray::virtualHasProperty(const Managed *m, PropertyKey id) +{ + bool hasProperty = false; + virtualGet(m, id, nullptr, &hasProperty); + return hasProperty; +} + bool TypedArray::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) { if (!id.isArrayIndex()) |