aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-01-18 09:37:30 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-02 08:10:18 +0100
commited84a6ee63ac7a53f37efad3eb4a7e4eaa047242 (patch)
tree30fccf1b66a465a73594e74f4bda54f07e9cce5d /src/declarative/qml/v8
parent4587be8097d23efe51ff46100bafad59640c10d8 (diff)
Remove invalid QJSValue type
Rationale: It's confusing to have an invalid type (which doesn't exist in JavaScript), and it creates lots of extra cases that have to be handled e.g. in value conversion and comparison. The Undefined type should be sufficient. Also, the invalid value type was being (ab)used to 1) make setProperty() act as a property deleter, and 2) signify that a property queried by property() doesn't exist. The recently introduced functions has(Own)Property() and deleteProperty() now provide that functionality. Default-constructed QJSValues now have the Undefined type. Task-number: QTBUG-23604 Change-Id: I1847492724d31e03ee1212c09ec87a2010920dc5 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8')
-rw-r--r--src/declarative/qml/v8/qjsvalue.cpp43
-rw-r--r--src/declarative/qml/v8/qjsvalue.h4
-rw-r--r--src/declarative/qml/v8/qjsvalue_impl_p.h148
-rw-r--r--src/declarative/qml/v8/qjsvalue_p.h7
-rw-r--r--src/declarative/qml/v8/qjsvalueiterator_impl_p.h4
-rw-r--r--src/declarative/qml/v8/qv8engine.cpp4
-rw-r--r--src/declarative/qml/v8/qv8typewrapper.cpp4
7 files changed, 33 insertions, 181 deletions
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp
index a34031d555..73b7e4f9c7 100644
--- a/src/declarative/qml/v8/qjsvalue.cpp
+++ b/src/declarative/qml/v8/qjsvalue.cpp
@@ -111,14 +111,6 @@
QT_BEGIN_NAMESPACE
/*!
- Constructs an invalid value.
-*/
-QJSValue::QJSValue()
- : d_ptr(InvalidValue())
-{
-}
-
-/*!
Constructs a new QJSValue with a boolean \a value.
*/
QJSValue::QJSValue(bool value)
@@ -347,23 +339,6 @@ QJSValue::~QJSValue()
{
}
-#ifdef QT_DEPRECATED
-
-/*!
- \obsolete
-
- Returns true if this QJSValue is valid; otherwise returns
- false.
-*/
-bool QJSValue::isValid() const
-{
- Q_D(const QJSValue);
- QScriptIsolate api(d->engine());
- return d->isValid();
-}
-
-#endif // QT_DEPRECATED
-
/*!
Returns true if this QJSValue is of the primitive type Boolean;
otherwise returns false.
@@ -693,7 +668,7 @@ QJSValue QJSValue::call(const QJSValueList &args)
the function.
If this QJSValue is not a function, call() does nothing
- and returns an invalid QJSValue.
+ and returns an undefined QJSValue.
Note that if \a instance is not an object, the global object
(see \l{QJSEngine::globalObject()}) will be used as the
@@ -787,7 +762,7 @@ QJSEngine* QJSValue::engine() const
/*!
If this QJSValue is an object, returns the internal prototype
(\c{__proto__} property) of this object; otherwise returns an
- invalid QJSValue.
+ undefined QJSValue.
\sa setPrototype(), isObject()
*/
@@ -893,7 +868,7 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
/*!
Returns the value of this QJSValue's property with the given \a name.
- If no such property exists, an invalid QJSValue is returned.
+ If no such property exists, an undefined QJSValue is returned.
If the property is implemented using a getter function (i.e. has the
PropertyGetter flag set), calling property() has side-effects on the
@@ -939,18 +914,6 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
If this QJSValue does not already have a property with name \a name,
a new property is created.
- If \a value is invalid, the property is removed.
-
- If the property is implemented using a setter function (i.e. has the
- PropertySetter flag set), calling setProperty() has side-effects on
- the script engine, since the setter function will be called with the
- given \a value as argument (possibly resulting in an uncaught script
- exception).
-
- Note that you cannot specify custom getter or setter functions for
- built-in properties, such as the \c{length} property of Array objects
- or meta properties of QObject objects.
-
\sa property(), deleteProperty()
*/
void QJSValue::setProperty(const QString& name, const QJSValue& value)
diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h
index f0be07e725..8ec2932dc3 100644
--- a/src/declarative/qml/v8/qjsvalue.h
+++ b/src/declarative/qml/v8/qjsvalue.h
@@ -66,11 +66,10 @@ public:
};
public:
- QJSValue();
+ QJSValue(SpecialValue value = UndefinedValue);
~QJSValue();
QJSValue(const QJSValue &other);
- QJSValue(SpecialValue value);
QJSValue(bool value);
QJSValue(int value);
QJSValue(uint value);
@@ -137,7 +136,6 @@ public:
QT_DEPRECATED QJSEngine *engine() const;
- QT_DEPRECATED bool isValid() const;
QT_DEPRECATED bool isFunction() const;
QT_DEPRECATED qint32 toInt32() const;
QT_DEPRECATED quint32 toUInt32() const;
diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h
index 386b203a41..b4e66ed093 100644
--- a/src/declarative/qml/v8/qjsvalue_impl_p.h
+++ b/src/declarative/qml/v8/qjsvalue_impl_p.h
@@ -42,30 +42,6 @@
QT_BEGIN_NAMESPACE
-// This template is used indirectly by the Q_GLOBAL_STATIC macro below
-template<>
-class QGlobalStaticDeleter<QJSValuePrivate>
-{
-public:
- QGlobalStatic<QJSValuePrivate> &globalStatic;
- QGlobalStaticDeleter(QGlobalStatic<QJSValuePrivate> &_globalStatic)
- : globalStatic(_globalStatic)
- {
- globalStatic.pointer.load()->ref.ref();
- }
-
- inline ~QGlobalStaticDeleter()
- {
- if (!globalStatic.pointer.load()->ref.deref()) { // Logic copy & paste from SharedDataPointer
- delete globalStatic.pointer.load();
- }
- globalStatic.pointer.store(0);
- globalStatic.destroyed = true;
- }
-};
-
-Q_GLOBAL_STATIC(QJSValuePrivate, InvalidValue)
-
QJSValuePrivate* QJSValuePrivate::get(const QJSValue& q) { Q_ASSERT(q.d_ptr.data()); return q.d_ptr.data(); }
QJSValue QJSValuePrivate::get(const QJSValuePrivate* d)
@@ -86,11 +62,6 @@ QJSValue QJSValuePrivate::get(QJSValuePrivate* d)
return QJSValue(d);
}
-QJSValuePrivate::QJSValuePrivate()
- : m_engine(0), m_state(Invalid)
-{
-}
-
QJSValuePrivate::QJSValuePrivate(bool value)
: m_engine(0), m_state(CBool), u(value)
{
@@ -208,7 +179,6 @@ bool QJSValuePrivate::toBool() const
return !(qIsNaN(u.m_number) || !u.m_number);
case CBool:
return u.m_bool;
- case Invalid:
case CNull:
case CUndefined:
return false;
@@ -233,8 +203,6 @@ double QJSValuePrivate::toNumber() const
case CBool:
return u.m_bool ? 1 : 0;
case CNull:
- case Invalid:
- return 0;
case CUndefined:
return qQNaN();
case CString:
@@ -259,8 +227,6 @@ double QJSValuePrivate::toNumber() const
QString QJSValuePrivate::toString() const
{
switch (m_state) {
- case Invalid:
- return QString();
case CBool:
return u.m_bool ? QString::fromLatin1("true") : QString::fromLatin1("false");
case CString:
@@ -290,8 +256,6 @@ QString QJSValuePrivate::toString() const
QVariant QJSValuePrivate::toVariant() const
{
switch (m_state) {
- case Invalid:
- return QVariant();
case CBool:
return QVariant(u.m_bool);
case CString:
@@ -427,11 +391,6 @@ inline bool QJSValuePrivate::isUndefined() const
return m_state == CUndefined || (isJSBased() && m_value->IsUndefined());
}
-inline bool QJSValuePrivate::isValid() const
-{
- return m_state != Invalid;
-}
-
inline bool QJSValuePrivate::isVariant() const
{
return isJSBased() && m_engine->isVariant(m_value);
@@ -454,12 +413,6 @@ bool QJSValuePrivate::isQObject() const
inline bool QJSValuePrivate::equals(QJSValuePrivate* other)
{
- if (!isValid())
- return !other->isValid();
-
- if (!other->isValid())
- return false;
-
if (!isJSBased() && !other->isJSBased()) {
switch (m_state) {
case CNull:
@@ -559,10 +512,8 @@ inline bool QJSValuePrivate::strictlyEquals(QJSValuePrivate* other)
return u.m_bool == other->u.m_bool;
}
- if (!isValid() && !other->isValid())
- return true;
-
- return false;
+ return (isUndefined() && other->isUndefined())
+ || (isNull() && other->isNull());
}
inline bool QJSValuePrivate::lessThan(QJSValuePrivate *other) const
@@ -572,9 +523,6 @@ inline bool QJSValuePrivate::lessThan(QJSValuePrivate *other) const
return false;
}
- if (!isValid() || !other->isValid())
- return false;
-
if (isString() && other->isString())
return toString() < other->toString();
@@ -609,7 +557,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::prototype() const
v8::HandleScope handleScope;
return new QJSValuePrivate(engine(), v8::Handle<v8::Object>::Cast(m_value)->GetPrototype());
}
- return InvalidValue();
+ return new QJSValuePrivate();
}
inline void QJSValuePrivate::setPrototype(QJSValuePrivate* prototype)
@@ -644,42 +592,6 @@ inline void QJSValuePrivate::setProperty(v8::Handle<v8::String> name, QJSValuePr
if (!value->isJSBased())
value->assignEngine(engine());
- if (!value->isValid()) {
- // Remove the property.
- v8::HandleScope handleScope;
- v8::TryCatch tryCatch;
- v8::Handle<v8::Object> recv(v8::Object::Cast(*m_value));
-// if (attribs & QJSValue::PropertyGetter && !(attribs & QJSValue::PropertySetter)) {
-// v8::Local<v8::Object> descriptor = engine()->originalGlobalObject()->getOwnPropertyDescriptor(recv, name);
-// if (!descriptor.IsEmpty()) {
-// v8::Local<v8::Value> setter = descriptor->Get(v8::String::New("set"));
-// if (!setter.IsEmpty() && !setter->IsUndefined()) {
-// recv->Delete(name);
-// engine()->originalGlobalObject()->defineGetterOrSetter(recv, name, setter, QJSValue::PropertySetter);
-// if (tryCatch.HasCaught())
-// engine()->setException(tryCatch.Exception(), tryCatch.Message());
-// return;
-// }
-// }
-// } else if (attribs & QJSValue::PropertySetter && !(attribs & QJSValue::PropertyGetter)) {
-// v8::Local<v8::Object> descriptor = engine()->originalGlobalObject()->getOwnPropertyDescriptor(recv, name);
-// if (!descriptor.IsEmpty()) {
-// v8::Local<v8::Value> getter = descriptor->Get(v8::String::New("get"));
-// if (!getter.IsEmpty() && !getter->IsUndefined()) {
-// recv->Delete(name);
-// engine()->originalGlobalObject()->defineGetterOrSetter(recv, name, getter, QJSValue::PropertyGetter);
-// if (tryCatch.HasCaught())
-// engine()->setException(tryCatch.Exception(), tryCatch.Message());
-// return;
-// }
-// }
-// }
- recv->Delete(name);
- if (tryCatch.HasCaught())
- engine()->setException(tryCatch.Exception(), tryCatch.Message());
- return;
- }
-
if (engine() != value->engine()) {
qWarning("QJSValue::setProperty(%s) failed: "
"cannot set value created in a different engine",
@@ -715,16 +627,6 @@ inline void QJSValuePrivate::setProperty(quint32 index, QJSValuePrivate* value,
if (!value->isJSBased())
value->assignEngine(engine());
- if (!value->isValid()) {
- // Remove the property.
- v8::HandleScope handleScope;
- v8::TryCatch tryCatch;
- v8::Object::Cast(*m_value)->Delete(index);
- if (tryCatch.HasCaught())
- engine()->setException(tryCatch.Exception(), tryCatch.Message());
- return;
- }
-
if (engine() != value->engine()) {
qWarning("QJSValue::setProperty() failed: cannot set value created in a different engine");
return;
@@ -739,10 +641,10 @@ inline void QJSValuePrivate::setProperty(quint32 index, QJSValuePrivate* value,
inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::property(const QString& name) const
{
- if (!name.length())
- return InvalidValue();
if (!isObject())
- return InvalidValue();
+ return new QJSValuePrivate();
+ if (!name.length())
+ return new QJSValuePrivate(engine());
v8::HandleScope handleScope;
return property(QJSConverter::toString(name));
@@ -752,14 +654,14 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::property(v8::Handle<
{
Q_ASSERT(!name.IsEmpty());
if (!isObject())
- return InvalidValue();
+ return new QJSValuePrivate();
return property<>(name);
}
inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::property(quint32 index) const
{
if (!isObject())
- return InvalidValue();
+ return new QJSValuePrivate();
return property<>(index);
}
@@ -777,11 +679,8 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::property(T name) con
engine()->setException(result, tryCatch.Message());
return new QJSValuePrivate(engine(), result);
}
- if (result.IsEmpty() || (result->IsUndefined() && !self->Has(name))) {
- // In QtScript we make a distinction between a property that exists and has value undefined,
- // and a property that doesn't exist; in the latter case, we should return an invalid value.
- return InvalidValue();
- }
+ if (result.IsEmpty())
+ return new QJSValuePrivate(engine());
return new QJSValuePrivate(engine(), result);
}
@@ -836,7 +735,7 @@ inline QJSValue::PropertyFlags QJSValuePrivate::propertyFlags(v8::Handle<v8::Str
inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::call(QJSValuePrivate* thisObject, const QJSValueList& args)
{
if (!isCallable())
- return InvalidValue();
+ return new QJSValuePrivate();
v8::HandleScope handleScope;
@@ -845,7 +744,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::call(QJSValuePrivate
QVarLengthArray<v8::Handle<v8::Value>, 8> argv(argc);
if (!prepareArgumentsForCall(argv.data(), args)) {
qWarning("QJSValue::call() failed: cannot call function with argument created in a different engine");
- return InvalidValue();
+ return new QJSValuePrivate(engine());
}
return call(thisObject, argc, argv.data());
@@ -862,7 +761,7 @@ QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::call(QJSValuePrivate* thisO
} else {
if (!thisObject->assignEngine(e)) {
qWarning("QJSValue::call() failed: cannot call function with thisObject created in a different engine");
- return InvalidValue();
+ return new QJSValuePrivate(engine());
}
recv = v8::Handle<v8::Object>(v8::Object::Cast(*thisObject->m_value));
@@ -913,7 +812,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(in
inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(const QJSValueList& args)
{
if (!isCallable())
- return InvalidValue();
+ return new QJSValuePrivate();
v8::HandleScope handleScope;
@@ -922,23 +821,21 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(co
QVarLengthArray<v8::Handle<v8::Value>, 8> argv(argc);
if (!prepareArgumentsForCall(argv.data(), args)) {
qWarning("QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
- return InvalidValue();
+ return new QJSValuePrivate(engine());
}
return callAsConstructor(argc, argv.data());
}
/*! \internal
- * Make sure this value is associated with a v8 value belogning to this engine.
- * If the value was invalid, or belogning to another engine, return false.
+ * Make sure this value is associated with a v8 value belonging to this engine.
+ * If the value belongs to another engine, returns false.
*/
bool QJSValuePrivate::assignEngine(QV8Engine* engine)
{
Q_ASSERT(engine);
v8::HandleScope handleScope;
switch (m_state) {
- case Invalid:
- return false;
case CBool:
m_value = v8::Persistent<v8::Value>::New(engine->makeJSValue(u.m_bool));
break;
@@ -973,7 +870,7 @@ bool QJSValuePrivate::assignEngine(QV8Engine* engine)
/*!
\internal
- Invalidates this value.
+ Invalidates this value (makes it undefined).
Does not remove the value from the engine's list of
registered values; that's the responsibility of the caller.
@@ -987,7 +884,7 @@ void QJSValuePrivate::invalidate()
delete u.m_string;
}
m_engine = 0;
- m_state = Invalid;
+ m_state = CUndefined;
}
QV8Engine* QJSValuePrivate::engine() const
@@ -1059,13 +956,10 @@ inline bool QJSValuePrivate::prepareArgumentsForCall(v8::Handle<v8::Value> argv[
for (int j = 0; i != args.constEnd(); j++, i++) {
QJSValuePrivate* value = QJSValuePrivate::get(*i);
if ((value->isJSBased() && engine() != value->engine())
- || (!value->isJSBased() && value->isValid() && !value->assignEngine(engine())))
+ || (!value->isJSBased() && !value->assignEngine(engine())))
// Different engines are not allowed!
return false;
- if (value->isValid())
- argv[j] = *value;
- else
- argv[j] = engine()->makeJSValue(QJSValue::UndefinedValue);
+ argv[j] = *value;
}
return true;
}
diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h
index fd32a14bb8..02ffc8108e 100644
--- a/src/declarative/qml/v8/qjsvalue_p.h
+++ b/src/declarative/qml/v8/qjsvalue_p.h
@@ -59,7 +59,6 @@ class QJSValuePrivate
: public QSharedData
{
public:
- inline QJSValuePrivate();
inline static QJSValuePrivate* get(const QJSValue& q);
inline static QJSValue get(const QJSValuePrivate* d);
inline static QJSValue get(QJSValuePrivate* d);
@@ -71,14 +70,14 @@ public:
inline QJSValuePrivate(uint value);
inline QJSValuePrivate(double value);
inline QJSValuePrivate(const QString& value);
- inline QJSValuePrivate(QJSValue::SpecialValue value);
+ inline QJSValuePrivate(QJSValue::SpecialValue value = QJSValue::UndefinedValue);
inline QJSValuePrivate(QV8Engine *engine, bool value);
inline QJSValuePrivate(QV8Engine *engine, int value);
inline QJSValuePrivate(QV8Engine *engine, uint value);
inline QJSValuePrivate(QV8Engine *engine, double value);
inline QJSValuePrivate(QV8Engine *engine, const QString& value);
- inline QJSValuePrivate(QV8Engine *engine, QJSValue::SpecialValue value);
+ inline QJSValuePrivate(QV8Engine *engine, QJSValue::SpecialValue value = QJSValue::UndefinedValue);
inline QJSValuePrivate(QV8Engine *engine, v8::Handle<v8::Value>);
inline void invalidate();
@@ -103,7 +102,6 @@ public:
inline bool isObject() const;
inline bool isString() const;
inline bool isUndefined() const;
- inline bool isValid() const;
inline bool isVariant() const;
inline bool isDate() const;
inline bool isRegExp() const;
@@ -149,7 +147,6 @@ private:
// Please, update class documentation when you change the enum.
enum State {
- Invalid = 0,
CString = 0x1000,
CNumber,
CBool,
diff --git a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h
index e287bc175c..40814b1969 100644
--- a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h
+++ b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h
@@ -97,7 +97,7 @@ inline QString QJSValueIteratorPrivate::name() const
inline QScriptPassPointer<QJSValuePrivate> QJSValueIteratorPrivate::value() const
{
if (!isValid())
- return InvalidValue();
+ return new QJSValuePrivate();
v8::HandleScope handleScope;
return m_object->property(m_names->Get(m_index - 1)->ToString());
@@ -105,7 +105,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValueIteratorPrivate::value() cons
inline bool QJSValueIteratorPrivate::isValid() const
{
- bool result = m_object ? m_object->isValid() : false;
+ bool result = m_object ? !m_object->isUndefined() : false;
// We know that if this object is still valid then it is an object
// if this assumption is not correct then some other logic in this class
// have to be changed too.
diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp
index 50250ffc8f..2f266a010e 100644
--- a/src/declarative/qml/v8/qv8engine.cpp
+++ b/src/declarative/qml/v8/qv8engine.cpp
@@ -1435,7 +1435,7 @@ QScriptPassPointer<QJSValuePrivate> QV8Engine::evaluate(v8::Handle<v8::Script> s
v8::Handle<v8::Value> exception = tryCatch.Exception();
if (exception.IsEmpty()) {
// This is possible on syntax errors like { a:12, b:21 } <- missing "(", ")" around expression.
- return InvalidValue();
+ return new QJSValuePrivate(this);
}
setException(exception, tryCatch.Message());
return new QJSValuePrivate(this, exception);
@@ -1457,7 +1457,7 @@ QScriptPassPointer<QJSValuePrivate> QV8Engine::evaluate(v8::Handle<v8::Script> s
QJSValue QV8Engine::scriptValueFromInternal(v8::Handle<v8::Value> value) const
{
if (value.IsEmpty())
- return QJSValuePrivate::get(InvalidValue());
+ return QJSValuePrivate::get(new QJSValuePrivate(const_cast<QV8Engine*>(this)));
return QJSValuePrivate::get(new QJSValuePrivate(const_cast<QV8Engine*>(this), value));
}
diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp
index 9c362dbea9..0a4c390814 100644
--- a/src/declarative/qml/v8/qv8typewrapper.cpp
+++ b/src/declarative/qml/v8/qv8typewrapper.cpp
@@ -240,7 +240,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
// check for property.
v8::Handle<v8::Value> rv = v8engine->qobjectWrapper()->getProperty(moduleApi->qobjectApi, propertystring, QV8QObjectWrapper::IgnoreRevision);
return rv;
- } else if (moduleApi->scriptApi.isValid()) {
+ } else if (!moduleApi->scriptApi.isUndefined()) {
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
QJSValuePrivate *apiprivate = QJSValuePrivate::get(moduleApi->scriptApi);
QScopedPointer<QJSValuePrivate> propertyValue(apiprivate->property(property).give());
@@ -294,7 +294,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property,
if (moduleApi->qobjectApi) {
v8engine->qobjectWrapper()->setProperty(moduleApi->qobjectApi, propertystring, value,
QV8QObjectWrapper::IgnoreRevision);
- } else if (moduleApi->scriptApi.isValid()) {
+ } else if (!moduleApi->scriptApi.isUndefined()) {
QScopedPointer<QJSValuePrivate> setvalp(new QJSValuePrivate(v8engine, value));
QJSValuePrivate *apiprivate = QJSValuePrivate::get(moduleApi->scriptApi);
if (apiprivate->propertyFlags(property) & QJSValue::ReadOnly) {