aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/v8/qjsconverter_impl_p.h8
-rw-r--r--src/declarative/qml/v8/qjsconverter_p.h4
-rw-r--r--src/declarative/qml/v8/qjsvalue.cpp33
-rw-r--r--src/declarative/qml/v8/qjsvalue.h15
-rw-r--r--src/declarative/qml/v8/qjsvalue_impl_p.h8
-rw-r--r--src/declarative/qml/v8/qjsvalue_p.h13
-rw-r--r--src/declarative/qml/v8/qscriptoriginalglobalobject_p.h14
-rw-r--r--src/declarative/qml/v8/qv8engine_impl_p.h4
-rw-r--r--src/declarative/qml/v8/qv8engine_p.h2
-rw-r--r--src/declarative/qml/v8/qv8typewrapper.cpp2
-rw-r--r--tests/auto/declarative/qjsengine/tst_qjsengine.cpp56
-rw-r--r--tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp28
-rw-r--r--tests/auto/declarative/qjsvalue/tst_qjsvalue.h2
13 files changed, 32 insertions, 157 deletions
diff --git a/src/declarative/qml/v8/qjsconverter_impl_p.h b/src/declarative/qml/v8/qjsconverter_impl_p.h
index 0e2b6ba519..018c0441a2 100644
--- a/src/declarative/qml/v8/qjsconverter_impl_p.h
+++ b/src/declarative/qml/v8/qjsconverter_impl_p.h
@@ -143,14 +143,14 @@ QString QJSConverter::toString(double value)
}
// return a mask of v8::PropertyAttribute that may also contains QScriptValue::PropertyGetter or QScriptValue::PropertySetter
-uint QJSConverter::toPropertyAttributes(const QFlags<QJSValue::PropertyFlag>& flags)
+uint QJSConverter::toPropertyAttributes(const QFlags<QJSValuePrivate::PropertyFlag>& flags)
{
uint attr = 0;
- if (flags.testFlag(QJSValue::ReadOnly))
+ if (flags.testFlag(QJSValuePrivate::ReadOnly))
attr |= v8::ReadOnly;
- if (flags.testFlag(QJSValue::Undeletable))
+ if (flags.testFlag(QJSValuePrivate::Undeletable))
attr |= v8::DontDelete;
- if (flags.testFlag(QJSValue::SkipInEnumeration))
+ if (flags.testFlag(QJSValuePrivate::SkipInEnumeration))
attr |= v8::DontEnum;
// if (flags.testFlag(QScriptValue::PropertyGetter))
// attr |= QScriptValue::PropertyGetter;
diff --git a/src/declarative/qml/v8/qjsconverter_p.h b/src/declarative/qml/v8/qjsconverter_p.h
index 1e35928609..29fef3c700 100644
--- a/src/declarative/qml/v8/qjsconverter_p.h
+++ b/src/declarative/qml/v8/qjsconverter_p.h
@@ -24,7 +24,7 @@
#ifndef QJSCONVERTER_P_H
#define QJSCONVERTER_P_H
-#include "qjsvalue.h"
+#include "qjsvalue_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qstring.h>
@@ -57,7 +57,7 @@ public:
PropertyAttributeMask = v8::ReadOnly | v8::DontDelete | v8::DontEnum,
};
// return a mask of v8::PropertyAttribute that may also contains QScriptValue::PropertyGetter or QScriptValue::PropertySetter
- static inline uint toPropertyAttributes(const QFlags<QJSValue::PropertyFlag>& flags);
+ static inline uint toPropertyAttributes(const QFlags<QJSValuePrivate::PropertyFlag>& flags);
// Converts a JS RegExp to a QRegExp.
// The conversion is not 100% exact since ECMA regexp and QRegExp
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp
index 73b7e4f9c7..5387f843f0 100644
--- a/src/declarative/qml/v8/qjsvalue.cpp
+++ b/src/declarative/qml/v8/qjsvalue.cpp
@@ -61,9 +61,6 @@
\snippet doc/src/snippets/code/src_script_qjsvalue.cpp 0
- The attributes of a property can be queried by calling the
- propertyFlags() function.
-
If you want to iterate over the properties of a script object, use
the QJSValueIterator class.
@@ -96,18 +93,6 @@
\value NullValue A null value.
*/
-/*!
- \enum QJSValue::PropertyFlag
-
- This enum describes the attributes of a property.
-
- \value ReadOnly The property is read-only. Attempts by Qt Script code to write to the property will be ignored.
-
- \value Undeletable Attempts by Qt Script code to \c{delete} the property will be ignored.
-
- \value SkipInEnumeration The property is not to be enumerated by a \c{for-in} enumeration.
-*/
-
QT_BEGIN_NAMESPACE
/*!
@@ -995,24 +980,6 @@ bool QJSValue::hasOwnProperty(const QString &name) const
return d->hasOwnProperty(name);
}
-#ifdef QT_DEPRECATED
-
-/*!
- \obsolete
-
- Returns the flags of the property with the given \a name.
-
- \sa property()
-*/
-QJSValue::PropertyFlags QJSValue::propertyFlags(const QString& name) const
-{
- Q_D(const QJSValue);
- QScriptIsolate api(d->engine());
- return d->propertyFlags(name);
-}
-
-#endif // QT_DEPRECATED
-
/*!
* If this QJSValue is a QObject, returns the QObject pointer
* that the QJSValue represents; otherwise, returns 0.
diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h
index 8ec2932dc3..897ccb1e39 100644
--- a/src/declarative/qml/v8/qjsvalue.h
+++ b/src/declarative/qml/v8/qjsvalue.h
@@ -51,15 +51,6 @@ template <class T> class QScriptPassPointer;
class Q_DECLARATIVE_EXPORT QJSValue
{
public:
-#ifdef QT_DEPRECATED
- enum PropertyFlag {
- ReadOnly = 0x00000001,
- Undeletable = 0x00000002,
- SkipInEnumeration = 0x00000004
- };
- Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
-#endif
-
enum SpecialValue {
NullValue,
UndefinedValue
@@ -140,8 +131,6 @@ public:
QT_DEPRECATED qint32 toInt32() const;
QT_DEPRECATED quint32 toUInt32() const;
- QT_DEPRECATED QJSValue::PropertyFlags propertyFlags(const QString &name) const;
-
QT_DEPRECATED QJSValue call(const QJSValue &thisObject = QJSValue(),
const QJSValueList &args = QJSValueList());
QT_DEPRECATED QJSValue construct(const QJSValueList &args = QJSValueList());
@@ -165,10 +154,6 @@ private:
Q_DECLARE_PRIVATE(QJSValue)
};
-#ifdef QT_DEPRECATED
-Q_DECLARE_OPERATORS_FOR_FLAGS(QJSValue::PropertyFlags)
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h
index b4e66ed093..69ec70beed 100644
--- a/src/declarative/qml/v8/qjsvalue_impl_p.h
+++ b/src/declarative/qml/v8/qjsvalue_impl_p.h
@@ -714,19 +714,19 @@ inline bool QJSValuePrivate::hasOwnProperty(const QString &name) const
return self->HasOwnProperty(QJSConverter::toString(name));
}
-inline QJSValue::PropertyFlags QJSValuePrivate::propertyFlags(const QString& name) const
+inline QJSValuePrivate::PropertyFlags QJSValuePrivate::propertyFlags(const QString& name) const
{
if (!isObject())
- return QJSValue::PropertyFlags(0);
+ return QJSValuePrivate::PropertyFlags(0);
v8::HandleScope handleScope;
return engine()->getPropertyFlags(v8::Handle<v8::Object>::Cast(m_value), QJSConverter::toString(name));
}
-inline QJSValue::PropertyFlags QJSValuePrivate::propertyFlags(v8::Handle<v8::String> name) const
+inline QJSValuePrivate::PropertyFlags QJSValuePrivate::propertyFlags(v8::Handle<v8::String> name) const
{
if (!isObject())
- return QJSValue::PropertyFlags(0);
+ return QJSValuePrivate::PropertyFlags(0);
v8::HandleScope handleScope;
return engine()->getPropertyFlags(v8::Handle<v8::Object>::Cast(m_value), name);
diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h
index 02ffc8108e..3eccba64bd 100644
--- a/src/declarative/qml/v8/qjsvalue_p.h
+++ b/src/declarative/qml/v8/qjsvalue_p.h
@@ -59,6 +59,13 @@ class QJSValuePrivate
: public QSharedData
{
public:
+ enum PropertyFlag {
+ ReadOnly = 0x00000001,
+ Undeletable = 0x00000002,
+ SkipInEnumeration = 0x00000004
+ };
+ Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
+
inline static QJSValuePrivate* get(const QJSValue& q);
inline static QJSValue get(const QJSValuePrivate* d);
inline static QJSValue get(QJSValuePrivate* d);
@@ -125,8 +132,8 @@ public:
inline bool deleteProperty(const QString& name);
inline bool hasProperty(const QString &name) const;
inline bool hasOwnProperty(const QString &name) const;
- inline QJSValue::PropertyFlags propertyFlags(const QString& name) const;
- inline QJSValue::PropertyFlags propertyFlags(v8::Handle<v8::String> name) const;
+ inline PropertyFlags propertyFlags(const QString& name) const;
+ inline PropertyFlags propertyFlags(v8::Handle<v8::String> name) const;
inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValueList& args);
inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValue& arguments);
@@ -181,6 +188,8 @@ private:
friend class QV8Engine;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QJSValuePrivate::PropertyFlags)
+
QT_END_NAMESPACE
#endif
diff --git a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
index 4fd47fbde0..12321cc71a 100644
--- a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
+++ b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h
@@ -25,7 +25,7 @@
#define QSCRIPTORIGINALGLOBALOBJECT_P_H
#include "QtCore/qglobal.h"
-#include "qjsvalue.h"
+#include "qjsvalue_p.h"
#include <private/qv8_p.h>
@@ -53,7 +53,7 @@ public:
inline void init(v8::Handle<v8::Context> context);
inline void destroy();
- inline QJSValue::PropertyFlags getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property);
+ inline QJSValuePrivate::PropertyFlags getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property);
inline v8::Local<v8::Object> getOwnPropertyDescriptor(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property) const;
inline bool strictlyEquals(v8::Handle<v8::Object> object);
private:
@@ -96,7 +96,7 @@ inline void QScriptOriginalGlobalObject::destroy()
// After this line this instance is unusable.
}
-inline QJSValue::PropertyFlags QScriptOriginalGlobalObject::getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property)
+inline QJSValuePrivate::PropertyFlags QScriptOriginalGlobalObject::getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property)
{
Q_ASSERT(object->IsObject());
Q_ASSERT(!property.IsEmpty());
@@ -119,14 +119,14 @@ inline QJSValue::PropertyFlags QScriptOriginalGlobalObject::getPropertyFlags(v8:
unsigned flags = 0;
if (!descriptor->Get(configurableName)->BooleanValue())
- flags |= QJSValue::Undeletable;
+ flags |= QJSValuePrivate::Undeletable;
if (!descriptor->Get(enumerableName)->BooleanValue())
- flags |= QJSValue::SkipInEnumeration;
+ flags |= QJSValuePrivate::SkipInEnumeration;
//"writable" is only a property of the descriptor if it is not an accessor
if (descriptor->Has(writableName)) {
if (!descriptor->Get(writableName)->BooleanValue())
- flags |= QJSValue::ReadOnly;
+ flags |= QJSValuePrivate::ReadOnly;
} else {
// if (descriptor->Get(getName)->IsObject())
// flags |= QScriptValue::PropertyGetter;
@@ -134,7 +134,7 @@ inline QJSValue::PropertyFlags QScriptOriginalGlobalObject::getPropertyFlags(v8:
// flags |= QScriptValue::PropertySetter;
}
- return QJSValue::PropertyFlag(flags);
+ return QJSValuePrivate::PropertyFlag(flags);
}
inline v8::Local<v8::Object> QScriptOriginalGlobalObject::getOwnPropertyDescriptor(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property) const
diff --git a/src/declarative/qml/v8/qv8engine_impl_p.h b/src/declarative/qml/v8/qv8engine_impl_p.h
index 30ca3a029a..349589680a 100644
--- a/src/declarative/qml/v8/qv8engine_impl_p.h
+++ b/src/declarative/qml/v8/qv8engine_impl_p.h
@@ -128,9 +128,9 @@ inline void QV8Engine::invalidateAllIterators()
\note property can be index (v8::Integer) or a property (v8::String) name, according to ECMA script
property would be converted to a string.
*/
-inline QJSValue::PropertyFlags QV8Engine::getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property)
+inline QJSValuePrivate::PropertyFlags QV8Engine::getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property)
{
- QJSValue::PropertyFlags flags = m_originalGlobalObject.getPropertyFlags(object, property);
+ QJSValuePrivate::PropertyFlags flags = m_originalGlobalObject.getPropertyFlags(object, property);
return flags;
}
diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h
index d9cc9fc6f4..ecfc33d85a 100644
--- a/src/declarative/qml/v8/qv8engine_p.h
+++ b/src/declarative/qml/v8/qv8engine_p.h
@@ -315,7 +315,7 @@ public:
QDeclarativeContextData *callingContext();
v8::Local<v8::Array> getOwnPropertyNames(v8::Handle<v8::Object>);
- inline QJSValue::PropertyFlags getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property);
+ inline QJSValuePrivate::PropertyFlags getPropertyFlags(v8::Handle<v8::Object> object, v8::Handle<v8::Value> property);
void freezeObject(v8::Handle<v8::Value>);
inline QString toString(v8::Handle<v8::Value> string);
diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp
index 0a4c390814..d9060be309 100644
--- a/src/declarative/qml/v8/qv8typewrapper.cpp
+++ b/src/declarative/qml/v8/qv8typewrapper.cpp
@@ -297,7 +297,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property,
} else if (!moduleApi->scriptApi.isUndefined()) {
QScopedPointer<QJSValuePrivate> setvalp(new QJSValuePrivate(v8engine, value));
QJSValuePrivate *apiprivate = QJSValuePrivate::get(moduleApi->scriptApi);
- if (apiprivate->propertyFlags(property) & QJSValue::ReadOnly) {
+ if (apiprivate->propertyFlags(property) & QJSValuePrivate::ReadOnly) {
QString error = QLatin1String("Cannot assign to read-only property \"") +
v8engine->toString(property) + QLatin1Char('\"');
v8::ThrowException(v8::Exception::Error(v8engine->toString(error)));
diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
index ca45d7e1c3..ed827ac991 100644
--- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
@@ -443,8 +443,6 @@ void tst_QJSEngine::newFunction()
QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
QVERIFY(prot.isObject());
QVERIFY(prot.property("constructor").strictlyEquals(fun));
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
- QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
}
// prototype should be Function.prototype
QVERIFY(!fun.prototype().isUndefined());
@@ -468,8 +466,6 @@ void tst_QJSEngine::newFunctionWithArg()
QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
QVERIFY(prot.isObject());
QVERIFY(prot.property("constructor").strictlyEquals(fun));
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
- QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
}
// prototype should be Function.prototype
QVERIFY(!fun.prototype().isUndefined());
@@ -496,9 +492,7 @@ void tst_QJSEngine::newFunctionWithProto()
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
// public prototype should be the one we passed
QCOMPARE(fun.property("prototype").strictlyEquals(proto), true);
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
QCOMPARE(proto.property("constructor").strictlyEquals(fun), true);
- QCOMPARE(proto.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
QCOMPARE(fun.call().isNull(), true);
QCOMPARE(fun.callAsConstructor().isObject(), true);
@@ -1436,75 +1430,47 @@ void tst_QJSEngine::globalObjectProperties()
QVERIFY(global.property("NaN").isNumber());
QVERIFY(qIsNaN(global.property("NaN").toNumber()));
- QCOMPARE(global.propertyFlags("NaN"), QJSValue::SkipInEnumeration | QJSValue::Undeletable);
QVERIFY(global.property("Infinity").isNumber());
QVERIFY(qIsInf(global.property("Infinity").toNumber()));
- QCOMPARE(global.propertyFlags("NaN"), QJSValue::SkipInEnumeration | QJSValue::Undeletable);
QVERIFY(global.property("undefined").isUndefined());
- QCOMPARE(global.propertyFlags("undefined"), QJSValue::SkipInEnumeration | QJSValue::Undeletable);
QVERIFY(global.property("eval").isCallable());
- QCOMPARE(global.propertyFlags("eval"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("parseInt").isCallable());
- QCOMPARE(global.propertyFlags("parseInt"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("parseFloat").isCallable());
- QCOMPARE(global.propertyFlags("parseFloat"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("isNaN").isCallable());
- QCOMPARE(global.propertyFlags("isNaN"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("isFinite").isCallable());
- QCOMPARE(global.propertyFlags("isFinite"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("decodeURI").isCallable());
- QCOMPARE(global.propertyFlags("decodeURI"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("decodeURIComponent").isCallable());
- QCOMPARE(global.propertyFlags("decodeURIComponent"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("encodeURI").isCallable());
- QCOMPARE(global.propertyFlags("encodeURI"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("encodeURIComponent").isCallable());
- QCOMPARE(global.propertyFlags("encodeURIComponent"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Object").isCallable());
- QCOMPARE(global.propertyFlags("Object"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Function").isCallable());
- QCOMPARE(global.propertyFlags("Function"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Array").isCallable());
- QCOMPARE(global.propertyFlags("Array"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("String").isCallable());
- QCOMPARE(global.propertyFlags("String"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Boolean").isCallable());
- QCOMPARE(global.propertyFlags("Boolean"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Number").isCallable());
- QCOMPARE(global.propertyFlags("Number"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Date").isCallable());
- QCOMPARE(global.propertyFlags("Date"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("RegExp").isCallable());
- QCOMPARE(global.propertyFlags("RegExp"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Error").isCallable());
- QCOMPARE(global.propertyFlags("Error"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("EvalError").isCallable());
- QCOMPARE(global.propertyFlags("EvalError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("RangeError").isCallable());
- QCOMPARE(global.propertyFlags("RangeError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("ReferenceError").isCallable());
- QCOMPARE(global.propertyFlags("ReferenceError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("SyntaxError").isCallable());
- QCOMPARE(global.propertyFlags("SyntaxError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("TypeError").isCallable());
- QCOMPARE(global.propertyFlags("TypeError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("URIError").isCallable());
- QCOMPARE(global.propertyFlags("URIError"), QJSValue::SkipInEnumeration);
QVERIFY(global.property("Math").isObject());
QVERIFY(!global.property("Math").isCallable());
- QCOMPARE(global.propertyFlags("Math"), QJSValue::SkipInEnumeration);
}
void tst_QJSEngine::globalObjectEquals()
@@ -1590,7 +1556,6 @@ void tst_QJSEngine::createGlobalObjectProperty()
QJSValue val(123);
global.setProperty(name, val);
QVERIFY(global.property(name).equals(val));
- QVERIFY(global.propertyFlags(name) == 0);
global.deleteProperty(name);
QVERIFY(global.property(name).isUndefined());
}
@@ -1604,7 +1569,6 @@ void tst_QJSEngine::createGlobalObjectProperty()
global.setProperty(name, val, flags);
QVERIFY(global.property(name).equals(val));
//QEXPECT_FAIL("", "QTBUG-6134: custom Global Object properties don't retain attributes", Continue);
- QCOMPARE(global.propertyFlags(name), flags);
global.setProperty(name, QScriptValue());
QVERIFY(global.property(name).isUndefined());
}
@@ -4047,20 +4011,11 @@ void tst_QJSEngine::jsNumberClass()
QJSValue proto = ctor.property("prototype");
QVERIFY(proto.isObject());
{
- QJSValue::PropertyFlags flags = QJSValue::SkipInEnumeration
- | QJSValue::Undeletable
- | QJSValue::ReadOnly;
- QCOMPARE(ctor.propertyFlags("prototype"), flags);
QVERIFY(ctor.property("MAX_VALUE").isNumber());
- QCOMPARE(ctor.propertyFlags("MAX_VALUE"), flags);
QVERIFY(ctor.property("MIN_VALUE").isNumber());
- QCOMPARE(ctor.propertyFlags("MIN_VALUE"), flags);
QVERIFY(ctor.property("NaN").isNumber());
- QCOMPARE(ctor.propertyFlags("NaN"), flags);
QVERIFY(ctor.property("NEGATIVE_INFINITY").isNumber());
- QCOMPARE(ctor.propertyFlags("NEGATIVE_INFINITY"), flags);
QVERIFY(ctor.property("POSITIVE_INFINITY").isNumber());
- QCOMPARE(ctor.propertyFlags("POSITIVE_INFINITY"), flags);
}
QCOMPARE(proto.toNumber(), qreal(0));
QVERIFY(proto.property("constructor").strictlyEquals(ctor));
@@ -4332,14 +4287,11 @@ void tst_QJSEngine::stringObjects()
{
QJSValue obj = eng.evaluate(QString::fromLatin1("new String('%0')").arg(str));
QCOMPARE(obj.property("length").toInt(), str.length());
- QCOMPARE(obj.propertyFlags("length"), QJSValue::PropertyFlags(QJSValue::Undeletable | QJSValue::SkipInEnumeration | QJSValue::ReadOnly));
for (int i = 0; i < str.length(); ++i) {
QString pname = QString::number(i);
QVERIFY(obj.property(pname).isString());
QCOMPARE(obj.property(pname).toString(), QString(str.at(i)));
QEXPECT_FAIL("", "FIXME: This is V8 issue 862. ECMA script standard 15.5.5.2 compliance.", Continue);
- QCOMPARE(obj.propertyFlags(pname), QJSValue::PropertyFlags(QJSValue::Undeletable | QJSValue::ReadOnly));
- QEXPECT_FAIL("", "FIXME: This is V8 issue 862. ECMA script standard 15.5.5.2 compliance.", Continue);
QVERIFY(!obj.deleteProperty(pname));
obj.setProperty(pname, QJSValue(&eng, 123));
QVERIFY(obj.property(pname).isString());
@@ -5602,13 +5554,11 @@ void tst_QJSEngine::functionScopes()
QScriptValue ret = scope.property("foo");
QVERIFY(ret.isNumber());
QCOMPARE(ret.toInt(), 123);
- QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable);
}
{
QScriptValue ret = scope.property("arg");
QVERIFY(ret.isNumber());
QCOMPARE(ret.toInt(), 123);
- QCOMPARE(scope.propertyFlags("arg"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
}
scope.setProperty("foo", 456);
@@ -6101,13 +6051,11 @@ void tst_QJSEngine::newFixedStaticScopeObject()
scope.setProperty(names[i], QScriptValue());
}
QVERIFY(scope.property(names[i]).equals(values[i]));
- QCOMPARE(scope.propertyFlags(names[i]), flags[i]);
}
}
// Property that doesn't exist.
QVERIFY(scope.property("noSuchProperty").isUndefined());
- QCOMPARE(scope.propertyFlags("noSuchProperty"), QScriptValue::PropertyFlags());
// Write to writable property.
{
@@ -6240,7 +6188,6 @@ void tst_QJSEngine::newGrowingStaticScopeObject()
scope.setProperty("foo", 123);
QVERIFY(scope.property("foo").equals(123));
QEXPECT_FAIL("", "FIXME: newStaticScopeObject not properly implemented", Abort);
- QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable);
// Modify existing property.
scope.setProperty("foo", 456);
@@ -6249,7 +6196,6 @@ void tst_QJSEngine::newGrowingStaticScopeObject()
// Add a read-only property.
scope.setProperty("bar", "ciao", QScriptValue::ReadOnly);
QVERIFY(scope.property("bar").equals("ciao"));
- QCOMPARE(scope.propertyFlags("bar"), QScriptValue::ReadOnly | QScriptValue::Undeletable);
// Attempt to modify read-only property.
scope.setProperty("bar", "hello");
@@ -6363,9 +6309,7 @@ void tst_QJSEngine::functionPrototypeExtensions()
QJSValue funProto = eng.globalObject().property("Function").property("prototype");
QVERIFY(funProto.isCallable());
QVERIFY(funProto.property("connect").isCallable());
- QCOMPARE(funProto.propertyFlags("connect"), QJSValue::SkipInEnumeration);
QVERIFY(funProto.property("disconnect").isCallable());
- QCOMPARE(funProto.propertyFlags("disconnect"), QJSValue::SkipInEnumeration);
// No properties should appear in for-in statements.
QJSValue props = eng.evaluate("props = []; for (var p in Function.prototype) props.push(p); props");
diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
index e478dc3fd3..1d7ae1ff47 100644
--- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.cpp
@@ -3665,32 +3665,4 @@ void tst_QJSValue::nestedObjectToVariant()
QCOMPARE(o.toVariant(), expected);
}
-void tst_QJSValue::propertyFlags_data()
-{
- QTest::addColumn<QString>("program");
- QTest::addColumn<uint>("expected");
-
- QTest::newRow("nothing") << "" << 0u;
-#if 0 // FIXME: No getter/setter API
- QTest::newRow("getter") << "o.__defineGetter__('prop', function() { return 'blah' } );\n" << uint(QJSValue::PropertyGetter);
- QTest::newRow("setter") << "o.__defineSetter__('prop', function(a) { this.setted_prop2 = a; } );\n" << uint(QJSValue::PropertySetter);
- QTest::newRow("getterSetter") << "o.__defineGetter__('prop', function() { return 'ploup' } );\n"
- "o.__defineSetter__('prop', function(a) { this.setted_prop3 = a; } );\n" << uint(QJSValue::PropertySetter|QJSValue::PropertyGetter);
-#endif
- QTest::newRow("nothing2") << "o.prop = 'nothing'" << 0u;
-}
-
-void tst_QJSValue::propertyFlags()
-{
- QFETCH(QString, program);
- QFETCH(uint, expected);
- QJSEngine eng;
- eng.evaluate("o = new Object;");
- eng.evaluate(program);
- QJSValue o = eng.evaluate("o");
-
- QCOMPARE(uint(o.propertyFlags("prop")), expected);
-}
-
-
QTEST_MAIN(tst_QJSValue)
diff --git a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
index 5fcd768e96..81fe6c000c 100644
--- a/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
+++ b/tests/auto/declarative/qjsvalue/tst_qjsvalue.h
@@ -191,8 +191,6 @@ private slots:
#endif
void nestedObjectToVariant_data();
void nestedObjectToVariant();
- void propertyFlags_data();
- void propertyFlags();
private:
void newEngine()