aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-05-07 11:22:52 +0200
committerLars Knoll <lars.knoll@digia.com>2013-05-07 12:28:58 +0200
commit5963aead75991ea8b0fded251e18ef75f099ab8f (patch)
tree17d6fdcb52fc1d59fa2ab3037121c679b9dd20aa
parent40d2e435cfa29ba7465adc0486e6dabcdfc49773 (diff)
More steps towards eliminating the v8 layer
* Changed the return type of the InvocationCallback from a v8 handle to a QV4::Value * Removed v4 auto tests and fixed build of other tests Change-Id: Ic927b925923ca8785170689a5c260969fd1cb794 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/imports/localstorage/plugin.cpp71
-rw-r--r--src/particles/qquickv8particledata.cpp17
-rw-r--r--src/qml/qml/qqmlcomponent.cpp6
-rw-r--r--src/qml/qml/qqmllocale.cpp96
-rw-r--r--src/qml/qml/qqmllocale_p.h24
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp64
-rw-r--r--src/qml/qml/v4/qv4context_p.h2
-rw-r--r--src/qml/qml/v4/qv4v8.cpp9
-rw-r--r--src/qml/qml/v4/qv4v8_p.h3
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp240
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h98
-rw-r--r--src/qml/qml/v8/qv4domerrors_p.h8
-rw-r--r--src/qml/qml/v8/qv8engine_p.h7
-rw-r--r--src/qml/qml/v8/qv8include.cpp6
-rw-r--r--src/qml/qml/v8/qv8include_p.h2
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp91
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper_p.h6
-rw-r--r--src/qml/qml/v8/qv8sequencewrapper.cpp14
-rw-r--r--src/qml/qml/v8/qv8sequencewrapper_p.h6
-rw-r--r--src/qml/qml/v8/qv8sequencewrapper_p_p.h4
-rw-r--r--src/qml/qml/v8/qv8valuetypewrapper.cpp2
-rw-r--r--src/qml/qml/v8/qv8valuetypewrapper_p.h2
-rw-r--r--src/qml/qml/v8/qv8variantwrapper.cpp14
-rw-r--r--src/qml/qml/v8/qv8variantwrapper_p.h8
-rw-r--r--src/qml/types/qquickworkerscript.cpp4
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp259
-rw-r--r--tests/auto/qml/qml.pro1
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp31
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp58
-rw-r--r--tests/auto/qml/v4/data/colorType.qml18
-rw-r--r--tests/auto/qml/v4/data/conditionalExpr.qml8
-rw-r--r--tests/auto/qml/v4/data/conversions.1.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.2.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.3.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.4.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.5.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.6.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.7.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.8.qml13
-rw-r--r--tests/auto/qml/v4/data/doubleBoolJump.qml18
-rw-r--r--tests/auto/qml/v4/data/equals.qml51
-rw-r--r--tests/auto/qml/v4/data/fetchException.qml6
-rw-r--r--tests/auto/qml/v4/data/integerOperations.qml59
-rw-r--r--tests/auto/qml/v4/data/jsvalueHandling.qml69
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.2.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.3.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.4.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.5.qml7
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.6.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.7.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalOr.2.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalOr.qml6
-rw-r--r--tests/auto/qml/v4/data/mathAbs.qml42
-rw-r--r--tests/auto/qml/v4/data/mathCeil.qml41
-rw-r--r--tests/auto/qml/v4/data/mathCos.qml41
-rw-r--r--tests/auto/qml/v4/data/mathFloor.qml37
-rw-r--r--tests/auto/qml/v4/data/mathMax.qml45
-rw-r--r--tests/auto/qml/v4/data/mathMin.qml45
-rw-r--r--tests/auto/qml/v4/data/mathSin.qml41
-rw-r--r--tests/auto/qml/v4/data/nestedLogicalAnd.qml14
-rw-r--r--tests/auto/qml/v4/data/nestedLogicalOr.qml14
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess.qml5
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess2.qml5
-rw-r--r--tests/auto/qml/v4/data/nullQObject.qml7
-rw-r--r--tests/auto/qml/v4/data/objectToBool.qml16
-rw-r--r--tests/auto/qml/v4/data/qrealToIntRounding.qml10
-rw-r--r--tests/auto/qml/v4/data/qtbug_21883.qml5
-rw-r--r--tests/auto/qml/v4/data/qtbug_22816.qml18
-rw-r--r--tests/auto/qml/v4/data/singletonType.qml12
-rw-r--r--tests/auto/qml/v4/data/strictEquals.qml53
-rw-r--r--tests/auto/qml/v4/data/stringComparison.qml41
-rw-r--r--tests/auto/qml/v4/data/subscriptions.1.qml16
-rw-r--r--tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml11
-rw-r--r--tests/auto/qml/v4/data/unaryMinus.qml24
-rw-r--r--tests/auto/qml/v4/data/unaryPlus.qml24
-rw-r--r--tests/auto/qml/v4/data/unnecessaryReeval.qml7
-rw-r--r--tests/auto/qml/v4/data/varHandling.qml67
-rw-r--r--tests/auto/qml/v4/data/variantHandling.qml67
-rw-r--r--tests/auto/qml/v4/testtypes.cpp51
-rw-r--r--tests/auto/qml/v4/testtypes.h216
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp1125
-rw-r--r--tests/auto/qml/v4/v4.pro16
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp1
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp1
85 files changed, 585 insertions, 3084 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 7e4b805ad6..498e541a25 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -55,7 +55,7 @@
#include <QtCore/qsettings.h>
#include <QtCore/qdir.h>
#include <private/qv4sqlerrors_p.h>
-
+#include <private/qv4engine_p.h>
#define V8THROW_SQL(error, desc) \
{ \
@@ -65,6 +65,14 @@
return v8::Handle<v8::Value>(); \
}
+#define V4THROW_SQL(error, desc) { \
+ QV4::ExecutionContext *ctx = v8::Isolate::GetEngine()->current; \
+ QV4::Value v = QV4::Value::fromString(ctx, desc); \
+ QV4::Object *ex = ctx->engine->newErrorObject(v); \
+ ex->put(ctx, ctx->engine->newIdentifier(QStringLiteral("code")), QV4::Value::fromInt32(error)); \
+ ctx->throwError(QV4::Value::fromObject(ex)); \
+}
+
#define V8THROW_SQL_VOID(error, desc) \
{ \
v8::Handle<v8::Value> v = v8::Exception::Error(engine->toString(desc)); \
@@ -78,6 +86,9 @@
return v8::Handle<v8::Value>(); \
}
+#define V4THROW_REFERENCE(string) \
+ v8::Isolate::GetEngine()->current->throwError(QV4::Value::fromObject(v8::Isolate::GetEngine()->newReferenceErrorObject(QStringLiteral(string))))
+
#define V8THROW_REFERENCE_VOID(string) { \
v8::ThrowException(v8::Exception::ReferenceError(v8::String::New(string))); \
return; \
@@ -190,23 +201,23 @@ static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV8Eng
return qmlsqldatabase_databasesPath(engine) + QDir::separator() + connectionName;
}
-static v8::Handle<v8::Value> qmlsqldatabase_rows_index(QV8SqlDatabaseResource *r, uint32_t index)
+static QV4::Value qmlsqldatabase_rows_index(QV8SqlDatabaseResource *r, uint32_t index)
{
if (r->query.at() == (int)index || r->query.seek(index)) {
QSqlRecord record = r->query.record();
// XXX optimize
- v8::Handle<v8::Object> row = v8::Object::New();
+ QV4::Object *row = QV8Engine::getV4(r->engine)->newObject();
for (int ii = 0; ii < record.count(); ++ii) {
QVariant v = record.value(ii);
if (v.isNull()) {
- row->Set(r->engine->toString(record.fieldName(ii)), QV4::Value::nullValue());
+ row->put(QV8Engine::getV4(r->engine)->current, QV8Engine::getV4(r->engine)->newIdentifier(record.fieldName(ii)), QV4::Value::nullValue());
} else {
- row->Set(r->engine->toString(record.fieldName(ii)),
+ row->put(QV8Engine::getV4(r->engine)->current, QV8Engine::getV4(r->engine)->newIdentifier(record.fieldName(ii)),
r->engine->fromVariant(v));
}
}
- return row;
+ return QV4::Value::fromObject(row);
} else {
return QV4::Value::undefinedValue();
}
@@ -221,38 +232,38 @@ static v8::Handle<v8::Value> qmlsqldatabase_rows_index(uint32_t index, const v8:
return qmlsqldatabase_rows_index(r, index);
}
-static v8::Handle<v8::Value> qmlsqldatabase_rows_item(const v8::Arguments& args)
+static QV4::Value qmlsqldatabase_rows_item(const v8::Arguments& args)
{
QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(args.This());
if (!r || r->type != QV8SqlDatabaseResource::Rows)
- V8THROW_REFERENCE("Not a SQLDatabase::Rows object");
+ V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
return qmlsqldatabase_rows_index(r, args.Length()?args[0]->Uint32Value():0);
}
-static v8::Handle<v8::Value> qmlsqldatabase_executeSql(const v8::Arguments& args)
+static QV4::Value qmlsqldatabase_executeSql(const v8::Arguments& args)
{
QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(args.This());
if (!r || r->type != QV8SqlDatabaseResource::Query)
- V8THROW_REFERENCE("Not a SQLDatabase::Query object");
+ V4THROW_REFERENCE("Not a SQLDatabase::Query object");
QV8Engine *engine = r->engine;
if (!r->inTransaction)
- V8THROW_SQL(SQLEXCEPTION_DATABASE_ERR,QQmlEngine::tr("executeSql called outside transaction()"));
+ V4THROW_SQL(SQLEXCEPTION_DATABASE_ERR,QQmlEngine::tr("executeSql called outside transaction()"));
QSqlDatabase db = r->database;
QString sql = args[0]->v4Value().toQString();
if (r->readonly && !sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) {
- V8THROW_SQL(SQLEXCEPTION_SYNTAX_ERR, QQmlEngine::tr("Read-only Transaction"));
+ V4THROW_SQL(SQLEXCEPTION_SYNTAX_ERR, QQmlEngine::tr("Read-only Transaction"));
}
QSqlQuery query(db);
bool err = false;
- v8::Handle<v8::Value> result = QV4::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
if (query.prepare(sql)) {
if (args.Length() > 1) {
@@ -281,12 +292,12 @@ static v8::Handle<v8::Value> qmlsqldatabase_executeSql(const v8::Arguments& args
r->query = query;
rows->SetExternalResource(r);
- v8::Handle<v8::Object> resultObject = v8::Object::New();
- result = resultObject;
+ QV4::Object *resultObject = QV8Engine::getV4(engine)->newObject();
+ result = QV4::Value::fromObject(resultObject);
// XXX optimize
- resultObject->Set(v8::String::New("rowsAffected"), v8::Integer::New(query.numRowsAffected()));
- resultObject->Set(v8::String::New("insertId"), engine->toString(query.lastInsertId().toString()));
- resultObject->Set(v8::String::New("rows"), rows);
+ resultObject->put(QV8Engine::getV4(engine)->current, QV8Engine::getV4(engine)->newIdentifier("rowsAffected"), QV4::Value::fromInt32(query.numRowsAffected()));
+ resultObject->put(QV8Engine::getV4(engine)->current, QV8Engine::getV4(engine)->newIdentifier("insertId"), engine->toString(query.lastInsertId().toString()));
+ resultObject->put(QV8Engine::getV4(engine)->current, QV8Engine::getV4(engine)->newIdentifier("rows"), rows->v4Value());
} else {
err = true;
}
@@ -294,19 +305,19 @@ static v8::Handle<v8::Value> qmlsqldatabase_executeSql(const v8::Arguments& args
err = true;
}
if (err)
- V8THROW_SQL(SQLEXCEPTION_DATABASE_ERR,query.lastError().text());
+ V4THROW_SQL(SQLEXCEPTION_DATABASE_ERR,query.lastError().text());
return result;
}
-static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& args)
+static QV4::Value qmlsqldatabase_changeVersion(const v8::Arguments& args)
{
if (args.Length() < 2)
return QV4::Value::undefinedValue();
QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(args.This());
if (!r || r->type != QV8SqlDatabaseResource::Database)
- V8THROW_REFERENCE("Not a SQLDatabase object");
+ V4THROW_REFERENCE("Not a SQLDatabase object");
QV8Engine *engine = r->engine;
@@ -316,7 +327,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& a
v8::Handle<v8::Value> callback = args[2];
if (from_version != r->version)
- V8THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->version));
+ V4THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->version));
v8::Handle<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance();
QV8SqlDatabaseResource *r2 = new QV8SqlDatabaseResource(engine);
@@ -338,10 +349,10 @@ static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& a
if (tc.HasCaught()) {
db.rollback();
tc.ReThrow();
- return v8::Handle<v8::Value>();
+ return QV4::Value::undefinedValue();
} else if (!db.commit()) {
db.rollback();
- V8THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR,QQmlEngine::tr("SQL transaction failed"));
+ V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR,QQmlEngine::tr("SQL transaction failed"));
} else {
ok = true;
}
@@ -360,16 +371,16 @@ static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& a
return QV4::Value::undefinedValue();
}
-static v8::Handle<v8::Value> qmlsqldatabase_transaction_shared(const v8::Arguments& args, bool readOnly)
+static QV4::Value qmlsqldatabase_transaction_shared(const v8::Arguments& args, bool readOnly)
{
QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(args.This());
if (!r || r->type != QV8SqlDatabaseResource::Database)
- V8THROW_REFERENCE("Not a SQLDatabase object");
+ V4THROW_REFERENCE("Not a SQLDatabase object");
QV8Engine *engine = r->engine;
if (args.Length() == 0 || !args[0]->IsFunction())
- V8THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR,QQmlEngine::tr("transaction: missing callback"));
+ V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR,QQmlEngine::tr("transaction: missing callback"));
QSqlDatabase db = r->database;
v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(args[0]);
@@ -392,7 +403,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_transaction_shared(const v8::Argumen
if (tc.HasCaught()) {
db.rollback();
tc.ReThrow();
- return v8::Handle<v8::Value>();
+ return QV4::Value::undefinedValue();
} else if (!db.commit()) {
db.rollback();
}
@@ -400,12 +411,12 @@ static v8::Handle<v8::Value> qmlsqldatabase_transaction_shared(const v8::Argumen
return QV4::Value::undefinedValue();
}
-static v8::Handle<v8::Value> qmlsqldatabase_transaction(const v8::Arguments& args)
+static QV4::Value qmlsqldatabase_transaction(const v8::Arguments& args)
{
return qmlsqldatabase_transaction_shared(args, false);
}
-static v8::Handle<v8::Value> qmlsqldatabase_read_transaction(const v8::Arguments& args)
+static QV4::Value qmlsqldatabase_read_transaction(const v8::Arguments& args)
{
return qmlsqldatabase_transaction_shared(args, true);
}
diff --git a/src/particles/qquickv8particledata.cpp b/src/particles/qquickv8particledata.cpp
index 3ca88208d5..08fc1415ec 100644
--- a/src/particles/qquickv8particledata.cpp
+++ b/src/particles/qquickv8particledata.cpp
@@ -43,6 +43,7 @@
#include "qquickv8particledata_p.h"
#include "qquickparticlesystem_p.h"//for QQuickParticleData
#include <QDebug>
+#include <private/qv4engine_p.h>
QT_BEGIN_NAMESPACE
@@ -286,33 +287,33 @@ public:
v8::Persistent<v8::Function> constructor;
};
-static v8::Handle<v8::Value> particleData_discard(const v8::Arguments &args)
+static QV4::Value particleData_discard(const v8::Arguments &args)
{
QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(args.This());
if (!r || !r->datum)
- V8THROW_ERROR("Not a valid ParticleData object");
+ V4THROW_ERROR("Not a valid ParticleData object");
r->datum->lifeSpan = 0; //Don't kill(), because it could still be in the middle of being created
return QV4::Value::undefinedValue();
}
-static v8::Handle<v8::Value> particleData_lifeLeft(const v8::Arguments &args)
+static QV4::Value particleData_lifeLeft(const v8::Arguments &args)
{
QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(args.This());
if (!r || !r->datum)
- V8THROW_ERROR("Not a valid ParticleData object");
+ V4THROW_ERROR("Not a valid ParticleData object");
- return v8::Number::New(r->datum->lifeLeft());
+ return QV4::Value::fromDouble(r->datum->lifeLeft());
}
-static v8::Handle<v8::Value> particleData_curSize(const v8::Arguments &args)
+static QV4::Value particleData_curSize(const v8::Arguments &args)
{
QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(args.This());
if (!r || !r->datum)
- V8THROW_ERROR("Not a valid ParticleData object");
+ V4THROW_ERROR("Not a valid ParticleData object");
- return v8::Number::New(r->datum->curSize());
+ return QV4::Value::fromDouble(r->datum->curSize());
}
#define COLOR_GETTER_AND_SETTER(VAR, NAME) static v8::Handle<v8::Value> particleData_get_ ## NAME (v8::Handle<v8::String>, const v8::AccessorInfo &info) \
{ \
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 2747cc72fc..0c020b76a3 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1094,7 +1094,7 @@ public:
const v8::AccessorInfo& info);
static v8::Handle<v8::Value> ForceCompletionGetter(v8::Handle<v8::String>,
const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ForceCompletion(const v8::Arguments &args);
+ static QV4::Value ForceCompletion(const v8::Arguments &args);
static void StatusChangedSetter(v8::Handle<v8::String>, v8::Handle<v8::Value> value,
const v8::AccessorInfo& info);
@@ -1408,11 +1408,11 @@ v8::Handle<v8::Value> QV8IncubatorResource::ForceCompletionGetter(v8::Handle<v8:
return componentExtension(r->engine)->forceCompletion;
}
-v8::Handle<v8::Value> QV8IncubatorResource::ForceCompletion(const v8::Arguments &args)
+QV4::Value QV8IncubatorResource::ForceCompletion(const v8::Arguments &args)
{
QV8IncubatorResource *r = v8_resource_cast<QV8IncubatorResource>(args.This());
if (!r)
- V8THROW_TYPE("Not an incubator object");
+ V4THROW_TYPE("Not an incubator object");
r->forceCompletion();
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index cd3b40b02d..3bb91a3079 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -63,7 +63,7 @@ public:
#define GET_LOCALE_DATA_RESOURCE(OBJECT) \
QV8LocaleDataResource *r = v8_resource_cast<QV8LocaleDataResource>(OBJECT); \
if (!r) \
- V8THROW_ERROR("Not a valid Locale object")
+ V4THROW_ERROR("Not a valid Locale object")
static bool isLocaleObject(v8::Handle<v8::Value> val)
{
@@ -161,7 +161,7 @@ void QQmlDateExtension::registerExtension(QV8Engine *engine)
registerFunction(engine, dateTimeZoneUpdatedFunction, timeZoneUpdated);
}
-v8::Handle<v8::Value> QQmlDateExtension::toLocaleString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::toLocaleString(const v8::Arguments& args)
{
if (args.Length() > 2)
return QV4::Value::undefinedValue();
@@ -193,7 +193,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleString(const v8::Arguments& arg
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDt = r->locale.toString(dt, format);
} else {
- V8THROW_ERROR("Locale: Date.toLocaleString(): Invalid datetime format");
+ V4THROW_ERROR("Locale: Date.toLocaleString(): Invalid datetime format");
}
} else {
formattedDt = r->locale.toString(dt, enumFormat);
@@ -202,7 +202,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleString(const v8::Arguments& arg
return r->engine->toString(formattedDt);
}
-v8::Handle<v8::Value> QQmlDateExtension::toLocaleTimeString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::toLocaleTimeString(const v8::Arguments& args)
{
if (args.Length() > 2)
return QV4::Value::undefinedValue();
@@ -235,7 +235,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleTimeString(const v8::Arguments&
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedTime = r->locale.toString(time, format);
} else {
- V8THROW_ERROR("Locale: Date.toLocaleTimeString(): Invalid time format");
+ V4THROW_ERROR("Locale: Date.toLocaleTimeString(): Invalid time format");
}
} else {
formattedTime = r->locale.toString(time, enumFormat);
@@ -244,7 +244,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleTimeString(const v8::Arguments&
return r->engine->toString(formattedTime);
}
-v8::Handle<v8::Value> QQmlDateExtension::toLocaleDateString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::toLocaleDateString(const v8::Arguments& args)
{
if (args.Length() > 2)
return QV4::Value::undefinedValue();
@@ -277,7 +277,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleDateString(const v8::Arguments&
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDate = r->locale.toString(date, format);
} else {
- V8THROW_ERROR("Locale: Date.loLocaleDateString(): Invalid date format");
+ V4THROW_ERROR("Locale: Date.loLocaleDateString(): Invalid date format");
}
} else {
formattedDate = r->locale.toString(date, enumFormat);
@@ -286,7 +286,7 @@ v8::Handle<v8::Value> QQmlDateExtension::toLocaleDateString(const v8::Arguments&
return r->engine->toString(formattedDate);
}
-v8::Handle<v8::Value> QQmlDateExtension::fromLocaleString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::fromLocaleString(const v8::Arguments& args)
{
QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
if (args.Length() == 1 && args[0]->IsString()) {
@@ -297,7 +297,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleString(const v8::Arguments& a
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
- V8THROW_ERROR("Locale: Date.fromLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Date.fromLocaleString(): Invalid arguments");
GET_LOCALE_DATA_RESOURCE(args[0]->ToObject());
@@ -313,7 +313,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleString(const v8::Arguments& a
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->locale.toDateTime(dateString, format);
} else {
- V8THROW_ERROR("Locale: Date.fromLocaleString(): Invalid datetime format");
+ V4THROW_ERROR("Locale: Date.fromLocaleString(): Invalid datetime format");
}
} else {
dt = r->locale.toDateTime(dateString, enumFormat);
@@ -322,7 +322,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleString(const v8::Arguments& a
return QV4::Value::fromObject(engine->newDateObject(dt));
}
-v8::Handle<v8::Value> QQmlDateExtension::fromLocaleTimeString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::fromLocaleTimeString(const v8::Arguments& args)
{
QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
@@ -336,7 +336,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleTimeString(const v8::Argument
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
- V8THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid arguments");
GET_LOCALE_DATA_RESOURCE(args[0]->ToObject());
@@ -352,7 +352,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleTimeString(const v8::Argument
QLocale::FormatType format = QLocale::FormatType(intFormat);
tm = r->locale.toTime(dateString, format);
} else {
- V8THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid datetime format");
+ V4THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid datetime format");
}
} else {
tm = r->locale.toTime(dateString, enumFormat);
@@ -364,7 +364,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleTimeString(const v8::Argument
return QV4::Value::fromObject(engine->newDateObject(dt));
}
-v8::Handle<v8::Value> QQmlDateExtension::fromLocaleDateString(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::fromLocaleDateString(const v8::Arguments& args)
{
QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
@@ -376,7 +376,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleDateString(const v8::Argument
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
- V8THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid arguments");
GET_LOCALE_DATA_RESOURCE(args[0]->ToObject());
@@ -392,7 +392,7 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleDateString(const v8::Argument
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->locale.toDate(dateString, format);
} else {
- V8THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid datetime format");
+ V4THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid datetime format");
}
} else {
dt = r->locale.toDate(dateString, enumFormat);
@@ -401,10 +401,10 @@ v8::Handle<v8::Value> QQmlDateExtension::fromLocaleDateString(const v8::Argument
return QV4::Value::fromObject(engine->newDateObject(QDateTime(dt)));
}
-v8::Handle<v8::Value> QQmlDateExtension::timeZoneUpdated(const v8::Arguments& args)
+QV4::Value QQmlDateExtension::timeZoneUpdated(const v8::Arguments& args)
{
if (args.Length() != 0)
- V8THROW_ERROR("Locale: Date.timeZoneUpdated(): Invalid arguments");
+ V4THROW_ERROR("Locale: Date.timeZoneUpdated(): Invalid arguments");
v8::Date::DateTimeConfigurationChangeNotification();
@@ -447,10 +447,10 @@ void QQmlNumberExtension::registerExtension(QV8Engine *engine)
registerFunction(engine, numberFromLocaleStringFunction, fromLocaleString);
}
-v8::Handle<v8::Value> QQmlNumberExtension::toLocaleString(const v8::Arguments& args)
+QV4::Value QQmlNumberExtension::toLocaleString(const v8::Arguments& args)
{
if (args.Length() > 3)
- V8THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
double number = args.This()->ToNumber()->Value();
@@ -468,7 +468,7 @@ v8::Handle<v8::Value> QQmlNumberExtension::toLocaleString(const v8::Arguments& a
uint16_t format = 'f';
if (args.Length() > 1) {
if (!args[1]->IsString())
- V8THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
v8::Handle<v8::String> fs = args[1]->ToString();
if (!fs.IsEmpty() && fs->Length()) {
v8::String::Value value(fs);
@@ -479,17 +479,17 @@ v8::Handle<v8::Value> QQmlNumberExtension::toLocaleString(const v8::Arguments& a
int prec = 2;
if (args.Length() > 2) {
if (!args[2]->IsNumber())
- V8THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
prec = args[2]->IntegerValue();
}
return r->engine->toString(r->locale.toString(number, (char)format, prec));
}
-v8::Handle<v8::Value> QQmlNumberExtension::toLocaleCurrencyString(const v8::Arguments& args)
+QV4::Value QQmlNumberExtension::toLocaleCurrencyString(const v8::Arguments& args)
{
if (args.Length() > 2)
- V8THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
double number = args.This()->ToNumber()->Value();
@@ -500,31 +500,31 @@ v8::Handle<v8::Value> QQmlNumberExtension::toLocaleCurrencyString(const v8::Argu
}
if (!isLocaleObject(args[0]))
- V8THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
GET_LOCALE_DATA_RESOURCE(args[0]->ToObject());
QString symbol;
if (args.Length() > 1) {
if (!args[1]->IsString())
- V8THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
symbol = args[1]->v4Value().toQString();
}
return r->engine->toString(r->locale.toCurrencyString(number, symbol));
}
-v8::Handle<v8::Value> QQmlNumberExtension::fromLocaleString(const v8::Arguments& args)
+QV4::Value QQmlNumberExtension::fromLocaleString(const v8::Arguments& args)
{
if (args.Length() < 1 || args.Length() > 2)
- V8THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
int numberIdx = 0;
QLocale locale;
if (args.Length() == 2) {
if (!isLocaleObject(args[0]))
- V8THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
+ V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
GET_LOCALE_DATA_RESOURCE(args[0]->ToObject());
locale = r->locale;
@@ -534,15 +534,15 @@ v8::Handle<v8::Value> QQmlNumberExtension::fromLocaleString(const v8::Arguments&
v8::Handle<v8::String> ns = args[numberIdx]->ToString();
if (ns.IsEmpty() || ns->Length() == 0)
- return v8::Number::New(Q_QNAN);
+ return QV4::Value::fromDouble(Q_QNAN);
bool ok = false;
double val = locale.toDouble(ns->v4Value().asString()->toQString(), &ok);
if (!ok)
- V8THROW_ERROR("Locale: Number.fromLocaleString(): Invalid format")
+ V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid format")
- return v8::Number::New(val);
+ return QV4::Value::fromDouble(val);
}
//--------------
@@ -599,12 +599,12 @@ static v8::Handle<v8::Value> locale_get_uiLanguages(v8::Handle<v8::String>, cons
return result;
}
-static v8::Handle<v8::Value> locale_currencySymbol(const v8::Arguments &args)
+static QV4::Value locale_currencySymbol(const v8::Arguments &args)
{
GET_LOCALE_DATA_RESOURCE(args.This());
if (args.Length() > 1)
- V8THROW_ERROR("Locale: currencySymbol(): Invalid arguments");
+ V4THROW_ERROR("Locale: currencySymbol(): Invalid arguments");
QLocale::CurrencySymbolFormat format = QLocale::CurrencySymbol;
if (args.Length() == 1) {
@@ -616,10 +616,10 @@ static v8::Handle<v8::Value> locale_currencySymbol(const v8::Arguments &args)
}
#define LOCALE_FORMAT(FUNC) \
-static v8::Handle<v8::Value> locale_ ##FUNC (const v8::Arguments &args) { \
+static QV4::Value locale_ ##FUNC (const v8::Arguments &args) { \
GET_LOCALE_DATA_RESOURCE(args.This());\
if (args.Length() > 1) \
- V8THROW_ERROR("Locale: " #FUNC "(): Invalid arguments"); \
+ V4THROW_ERROR("Locale: " #FUNC "(): Invalid arguments"); \
QLocale::FormatType format = QLocale::LongFormat;\
if (args.Length() == 1) { \
quint32 intFormat = args[0]->Uint32Value(); \
@@ -634,14 +634,14 @@ LOCALE_FORMAT(dateFormat)
// +1 added to idx because JS is 0-based, whereas QLocale months begin at 1.
#define LOCALE_FORMATTED_MONTHNAME(VARIABLE) \
-static v8::Handle<v8::Value> locale_ ## VARIABLE (const v8::Arguments &args) {\
+static QV4::Value locale_ ## VARIABLE (const v8::Arguments &args) {\
GET_LOCALE_DATA_RESOURCE(args.This()); \
if (args.Length() < 1 || args.Length() > 2) \
- V8THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
+ V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
int idx = args[0]->IntegerValue() + 1; \
if (idx < 1 || idx > 12) \
- V8THROW_ERROR("Locale: Invalid month"); \
+ V4THROW_ERROR("Locale: Invalid month"); \
QString name; \
if (args.Length() == 2) { \
if (args[1]->IsNumber()) { \
@@ -649,7 +649,7 @@ static v8::Handle<v8::Value> locale_ ## VARIABLE (const v8::Arguments &args) {\
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = r->locale. VARIABLE(idx, format); \
} else { \
- V8THROW_ERROR("Locale: Invalid datetime format"); \
+ V4THROW_ERROR("Locale: Invalid datetime format"); \
} \
} else { \
name = r->locale. VARIABLE(idx, enumFormat); \
@@ -659,14 +659,14 @@ static v8::Handle<v8::Value> locale_ ## VARIABLE (const v8::Arguments &args) {\
// 0 -> 7 as Qt::Sunday is 7, but Sunday is 0 in JS Date
#define LOCALE_FORMATTED_DAYNAME(VARIABLE) \
-static v8::Handle<v8::Value> locale_ ## VARIABLE (const v8::Arguments &args) {\
+static QV4::Value locale_ ## VARIABLE (const v8::Arguments &args) {\
GET_LOCALE_DATA_RESOURCE(args.This()); \
if (args.Length() < 1 || args.Length() > 2) \
- V8THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
+ V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
int idx = args[0]->IntegerValue(); \
if (idx < 0 || idx > 7) \
- V8THROW_ERROR("Locale: Invalid day"); \
+ V4THROW_ERROR("Locale: Invalid day"); \
if (idx == 0) idx = 7; \
QString name; \
if (args.Length() == 2) { \
@@ -675,7 +675,7 @@ static v8::Handle<v8::Value> locale_ ## VARIABLE (const v8::Arguments &args) {\
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = r->locale. VARIABLE(idx, format); \
} else { \
- V8THROW_ERROR("Locale: Invalid datetime format"); \
+ V4THROW_ERROR("Locale: Invalid datetime format"); \
} \
} else { \
name = r->locale. VARIABLE(idx, enumFormat); \
@@ -871,7 +871,7 @@ QQmlLocale::~QQmlLocale()
{
}
-v8::Handle<v8::Value> QQmlLocale::locale(QV8Engine *v8engine, const QString &locale)
+QV4::Value QQmlLocale::locale(QV8Engine *v8engine, const QString &locale)
{
QV8LocaleDataDeletable *d = localeV8Data(v8engine);
v8::Handle<v8::Object> v8Value = d->constructor->NewInstance();
@@ -882,7 +882,7 @@ v8::Handle<v8::Value> QQmlLocale::locale(QV8Engine *v8engine, const QString &loc
r->locale = QLocale(locale);
v8Value->SetExternalResource(r);
- return v8Value;
+ return v8Value->v4Value();
}
static const char localeCompareFunction[] =
@@ -901,7 +901,7 @@ void QQmlLocale::registerStringLocaleCompare(QV8Engine *engine)
registerFunction(engine, localeCompareFunction, localeCompare);
}
-v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
+QV4::Value QQmlLocale::localeCompare(const v8::Arguments &args)
{
if (args.Length() != 1 || (!args[0]->IsString() && !args[0]->IsStringObject()))
return QV4::Value::undefinedValue();
@@ -912,7 +912,7 @@ v8::Handle<v8::Value> QQmlLocale::localeCompare(const v8::Arguments &args)
QString thisString = args.This()->v4Value().toString(args.GetIsolate()->GetEngine()->current)->toQString();
QString thatString = args[0]->v4Value().toString(args.GetIsolate()->GetEngine()->current)->toQString();
- return v8::Integer::New(QString::localeAwareCompare(thisString, thatString));
+ return QV4::Value::fromInt32(QString::localeAwareCompare(thisString, thatString));
}
/*!
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 25f98d9168..dcc9746cc8 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -58,13 +58,13 @@ public:
static void registerExtension(QV8Engine *engine);
private:
- static v8::Handle<v8::Value> toLocaleString(const v8::Arguments& args);
- static v8::Handle<v8::Value> toLocaleTimeString(const v8::Arguments& args);
- static v8::Handle<v8::Value> toLocaleDateString(const v8::Arguments& args);
- static v8::Handle<v8::Value> fromLocaleString(const v8::Arguments& args);
- static v8::Handle<v8::Value> fromLocaleTimeString(const v8::Arguments& args);
- static v8::Handle<v8::Value> fromLocaleDateString(const v8::Arguments& args);
- static v8::Handle<v8::Value> timeZoneUpdated(const v8::Arguments& args);
+ static QV4::Value toLocaleString(const v8::Arguments& args);
+ static QV4::Value toLocaleTimeString(const v8::Arguments& args);
+ static QV4::Value toLocaleDateString(const v8::Arguments& args);
+ static QV4::Value fromLocaleString(const v8::Arguments& args);
+ static QV4::Value fromLocaleTimeString(const v8::Arguments& args);
+ static QV4::Value fromLocaleDateString(const v8::Arguments& args);
+ static QV4::Value timeZoneUpdated(const v8::Arguments& args);
};
@@ -74,9 +74,9 @@ public:
static void registerExtension(QV8Engine *engine);
private:
- static v8::Handle<v8::Value> toLocaleString(const v8::Arguments& args);
- static v8::Handle<v8::Value> fromLocaleString(const v8::Arguments& args);
- static v8::Handle<v8::Value> toLocaleCurrencyString(const v8::Arguments& args);
+ static QV4::Value toLocaleString(const v8::Arguments& args);
+ static QV4::Value fromLocaleString(const v8::Arguments& args);
+ static QV4::Value toLocaleCurrencyString(const v8::Arguments& args);
};
@@ -118,14 +118,14 @@ public:
Saturday = Qt::Saturday
};
- static v8::Handle<v8::Value> locale(QV8Engine *v8engine, const QString &lang);
+ static QV4::Value locale(QV8Engine *v8engine, const QString &lang);
static void registerStringLocaleCompare(QV8Engine *engine);
private:
QQmlLocale();
- static v8::Handle<v8::Value> localeCompare(const v8::Arguments &args);
+ static QV4::Value localeCompare(const v8::Arguments &args);
};
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 46ffbb46f8..608ebad985 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -50,6 +50,7 @@
#include "qqmlexpression_p.h"
#include "qqmlglobal_p.h"
#include <private/qv4domerrors_p.h>
+#include <private/qv4engine_p.h>
#include <QtCore/qobject.h>
#include <QtQml/qjsvalue.h>
@@ -67,6 +68,9 @@
return v8::Handle<v8::Value>(); \
}
+#define V4THROW_REFERENCE(string) \
+ v8::Isolate::GetEngine()->current->throwError(QV4::Value::fromObject(v8::Isolate::GetEngine()->newReferenceErrorObject(QStringLiteral(string))))
+
#define D(arg) (arg)->release()
#define A(arg) (arg)->addref()
@@ -977,9 +981,9 @@ public:
int replyStatus() const;
QString replyStatusText() const;
- v8::Handle<v8::Value> open(v8::Handle<v8::Object> me, const QString &, const QUrl &);
- v8::Handle<v8::Value> send(v8::Handle<v8::Object> me, const QByteArray &);
- v8::Handle<v8::Value> abort(v8::Handle<v8::Object> me);
+ QV4::Value open(v8::Handle<v8::Object> me, const QString &, const QUrl &);
+ QV4::Value send(v8::Handle<v8::Object> me, const QByteArray &);
+ QV4::Value abort(v8::Handle<v8::Object> me);
void addHeader(const QString &, const QString &);
QString header(const QString &name);
@@ -1073,7 +1077,7 @@ QString QQmlXMLHttpRequest::replyStatusText() const
return m_statusText;
}
-v8::Handle<v8::Value> QQmlXMLHttpRequest::open(v8::Handle<v8::Object> me, const QString &method,
+QV4::Value QQmlXMLHttpRequest::open(v8::Handle<v8::Object> me, const QString &method,
const QUrl &url)
{
destroyNetwork();
@@ -1199,7 +1203,7 @@ void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url)
this, SLOT(finished()));
}
-v8::Handle<v8::Value> QQmlXMLHttpRequest::send(v8::Handle<v8::Object> me, const QByteArray &data)
+QV4::Value QQmlXMLHttpRequest::send(v8::Handle<v8::Object> me, const QByteArray &data)
{
m_errorFlag = false;
m_sendFlag = true;
@@ -1213,7 +1217,7 @@ v8::Handle<v8::Value> QQmlXMLHttpRequest::send(v8::Handle<v8::Object> me, const
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> QQmlXMLHttpRequest::abort(v8::Handle<v8::Object> me)
+QV4::Value QQmlXMLHttpRequest::abort(v8::Handle<v8::Object> me)
{
destroyNetwork();
m_responseEntityBody = QByteArray();
@@ -1511,14 +1515,14 @@ void QQmlXMLHttpRequest::destroyNetwork()
}
// XMLHttpRequest methods
-static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_open(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
if (args.Length() < 2 || args.Length() > 5)
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
QV8Engine *engine = r->engine;
@@ -1529,7 +1533,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
method != QLatin1String("HEAD") &&
method != QLatin1String("POST") &&
method != QLatin1String("DELETE"))
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
// Argument 1 - URL
QUrl url = QUrl(args[1]->v4Value().toQString());
@@ -1539,7 +1543,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
// Argument 2 - async (optional)
if (args.Length() > 2 && !args[2]->BooleanValue())
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Synchronous XMLHttpRequest calls are not supported");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Synchronous XMLHttpRequest calls are not supported");
// Argument 3/4 - user/pass (optional)
QString username, password;
@@ -1558,17 +1562,17 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_open(const v8::Arguments &args)
return r->open(constructMeObject(args.This(), engine), method, url);
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_setRequestHeader(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_setRequestHeader(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
if (args.Length() != 2)
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Opened || r->sendFlag())
- V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
+ V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QV8Engine *engine = r->engine;
@@ -1605,17 +1609,17 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_setRequestHeader(const v8::Argume
return QV4::Value::undefinedValue();
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_send(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_send(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
QV8Engine *engine = r->engine;
if (r->readyState() != QQmlXMLHttpRequest::Opened ||
r->sendFlag())
- V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
+ V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QByteArray data;
if (args.Length() > 0)
@@ -1624,49 +1628,49 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_send(const v8::Arguments &args)
return r->send(constructMeObject(args.This(), engine), data);
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_abort(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_abort(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
return r->abort(constructMeObject(args.This(), r->engine));
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_getResponseHeader(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_getResponseHeader(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
QV8Engine *engine = r->engine;
if (args.Length() != 1)
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
r->readyState() != QQmlXMLHttpRequest::Done &&
r->readyState() != QQmlXMLHttpRequest::HeadersReceived)
- V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
+ V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
return engine->toString(r->header(args[0]->v4Value().toQString()));
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_getAllResponseHeaders(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_getAllResponseHeaders(const v8::Arguments &args)
{
QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(args.This());
if (!r)
- V8THROW_REFERENCE("Not an XMLHttpRequest object");
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
QV8Engine *engine = r->engine;
if (args.Length() != 0)
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
r->readyState() != QQmlXMLHttpRequest::Done &&
r->readyState() != QQmlXMLHttpRequest::HeadersReceived)
- V8THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
+ V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
return engine->toString(r->headers());
}
@@ -1750,7 +1754,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_responseXML(v8::Handle<v8::String
}
}
-static v8::Handle<v8::Value> qmlxmlhttprequest_new(const v8::Arguments &args)
+static QV4::Value qmlxmlhttprequest_new(const v8::Arguments &args)
{
if (args.IsConstructCall()) {
QV8Engine *engine = V8ENGINE();
@@ -1759,7 +1763,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_new(const v8::Arguments &args)
QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(engine, engine->networkAccessManager());
args.This()->SetExternalResource(r);
- return args.This();
+ return args.This()->v4Value();
} else {
return QV4::Value::undefinedValue();
}
diff --git a/src/qml/qml/v4/qv4context_p.h b/src/qml/qml/v4/qv4context_p.h
index 1043965b46..5b694a22bf 100644
--- a/src/qml/qml/v4/qv4context_p.h
+++ b/src/qml/qml/v4/qv4context_p.h
@@ -74,7 +74,7 @@ struct Q_QML_EXPORT DiagnosticMessage
struct CallContext;
-struct ExecutionContext
+struct Q_QML_EXPORT ExecutionContext
{
enum Type {
Type_GlobalContext = 0x1,
diff --git a/src/qml/qml/v4/qv4v8.cpp b/src/qml/qml/v4/qv4v8.cpp
index 7b2345112b..f65ad0dab8 100644
--- a/src/qml/qml/v4/qv4v8.cpp
+++ b/src/qml/qml/v4/qv4v8.cpp
@@ -1354,6 +1354,11 @@ Handle<Object> Arguments::This() const
return m_thisObject;
}
+QV4::Value Arguments::ThisV4() const
+{
+ return m_thisObject->v4Value();
+}
+
Handle<Object> Arguments::Holder() const
{
// ### FIXME.
@@ -1641,7 +1646,7 @@ protected:
Arguments arguments(args, argc, thisObject, false, that->m_functionTemplate->m_data);
QV4::Value result = QV4::Value::undefinedValue();
if (that->m_functionTemplate->m_callback)
- result = that->m_functionTemplate->m_callback(arguments)->v4Value();
+ result = that->m_functionTemplate->m_callback(arguments);
return result;
}
@@ -1657,7 +1662,7 @@ protected:
QV4::Value result = QV4::Value::undefinedValue();
if (that->m_functionTemplate->m_callback)
- result = that->m_functionTemplate->m_callback(arguments)->v4Value();
+ result = that->m_functionTemplate->m_callback(arguments);
if (result.isObject())
return result;
return QV4::Value::fromObject(obj);
diff --git a/src/qml/qml/v4/qv4v8_p.h b/src/qml/qml/v4/qv4v8_p.h
index 113ac11615..ca68ae2638 100644
--- a/src/qml/qml/v4/qv4v8_p.h
+++ b/src/qml/qml/v4/qv4v8_p.h
@@ -1622,6 +1622,7 @@ class V8EXPORT Arguments {
int Length() const;
Handle<Value> operator[](int i) const;
Handle<Object> This() const;
+ QV4::Value ThisV4() const;
Handle<Object> Holder() const;
bool IsConstructCall() const;
Handle<Value> Data() const;
@@ -1652,7 +1653,7 @@ private:
};
-typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
+typedef QV4::Value (*InvocationCallback)(const Arguments& args);
/**
* NamedProperty[Getter|Setter] are used as interceptors on object.
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 81f013d364..a967407788 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -52,6 +52,8 @@
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmlglobal_p.h>
+#include <private/qv4engine_p.h>
+
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qcryptographichash.h>
@@ -107,7 +109,7 @@ static QString jsStack() {
return stackFrames.join(QLatin1String("\n"));
}
-v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args,
+QV4::Value console(ConsoleLogTypes logType, const v8::Arguments &args,
bool printStack = false)
{
QString result;
@@ -173,7 +175,7 @@ v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> gc(const v8::Arguments &args)
+QV4::Value gc(const v8::Arguments &args)
{
Q_UNUSED(args);
// ###
@@ -181,12 +183,12 @@ v8::Handle<v8::Value> gc(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleError(const v8::Arguments &args)
+QV4::Value consoleError(const v8::Arguments &args)
{
return console(Error, args);
}
-v8::Handle<v8::Value> consoleLog(const v8::Arguments &args)
+QV4::Value consoleLog(const v8::Arguments &args)
{
//console.log
//console.debug
@@ -195,7 +197,7 @@ v8::Handle<v8::Value> consoleLog(const v8::Arguments &args)
return console(Log, args);
}
-v8::Handle<v8::Value> consoleProfile(const v8::Arguments &args)
+QV4::Value consoleProfile(const v8::Arguments &args)
{
//DeclarativeDebugTrace cannot handle nested profiling
//although v8 can handle several profiling at once,
@@ -224,7 +226,7 @@ v8::Handle<v8::Value> consoleProfile(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleProfileEnd(const v8::Arguments &args)
+QV4::Value consoleProfileEnd(const v8::Arguments &args)
{
//DeclarativeDebugTrace cannot handle nested profiling
//although v8 can handle several profiling at once,
@@ -253,19 +255,19 @@ v8::Handle<v8::Value> consoleProfileEnd(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleTime(const v8::Arguments &args)
+QV4::Value consoleTime(const v8::Arguments &args)
{
if (args.Length() != 1)
- V8THROW_ERROR("console.time(): Invalid arguments");
+ V4THROW_ERROR("console.time(): Invalid arguments");
QString name = args[0]->v4Value().toQString();
V8ENGINE()->startTimer(name);
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args)
+QV4::Value consoleTimeEnd(const v8::Arguments &args)
{
if (args.Length() != 1)
- V8THROW_ERROR("console.time(): Invalid arguments");
+ V4THROW_ERROR("console.time(): Invalid arguments");
QString name = args[0]->v4Value().toQString();
bool wasRunning;
qint64 elapsed = V8ENGINE()->stopTimer(name, &wasRunning);
@@ -275,7 +277,7 @@ v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleCount(const v8::Arguments &args)
+QV4::Value consoleCount(const v8::Arguments &args)
{
// first argument: name to print. Ignore any additional arguments
QString name;
@@ -303,10 +305,10 @@ v8::Handle<v8::Value> consoleCount(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args)
+QV4::Value consoleTrace(const v8::Arguments &args)
{
if (args.Length() != 0)
- V8THROW_ERROR("console.trace(): Invalid arguments");
+ V4THROW_ERROR("console.trace(): Invalid arguments");
QString stack = jsStack();
@@ -320,15 +322,15 @@ v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleWarn(const v8::Arguments &args)
+QV4::Value consoleWarn(const v8::Arguments &args)
{
return console(Warn, args);
}
-v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args)
+QV4::Value consoleAssert(const v8::Arguments &args)
{
if (args.Length() == 0)
- V8THROW_ERROR("console.assert(): Missing argument");
+ V4THROW_ERROR("console.assert(): Missing argument");
if (!args[0]->ToBoolean()->Value()) {
QString message;
@@ -354,21 +356,21 @@ v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> consoleException(const v8::Arguments &args)
+QV4::Value consoleException(const v8::Arguments &args)
{
if (args.Length() == 0)
- V8THROW_ERROR("console.exception(): Missing argument");
+ V4THROW_ERROR("console.exception(): Missing argument");
console(Error, args, true);
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> stringArg(const v8::Arguments &args)
+QV4::Value stringArg(const v8::Arguments &args)
{
QString value = args.This()->v4Value().toQString();
if (args.Length() != 1)
- V8THROW_ERROR("String.arg(): Invalid arguments");
+ V4THROW_ERROR("String.arg(): Invalid arguments");
v8::Handle<v8::Value> arg = args[0];
if (arg->IsUint32())
@@ -387,12 +389,12 @@ v8::Handle<v8::Value> stringArg(const v8::Arguments &args)
\qmlmethod bool Qt::isQtObject(object)
Returns true if \c object is a valid reference to a Qt or QML object, otherwise false.
*/
-v8::Handle<v8::Value> isQtObject(const v8::Arguments &args)
+QV4::Value isQtObject(const v8::Arguments &args)
{
if (args.Length() == 0)
- return v8::Boolean::New(false);
+ return QV4::Value::fromBoolean(false);
- return v8::Boolean::New(0 != V8ENGINE()->toQObject(args[0]->v4Value()));
+ return QV4::Value::fromBoolean(0 != V8ENGINE()->toQObject(args[0]->v4Value()));
}
/*!
@@ -401,11 +403,11 @@ v8::Handle<v8::Value> isQtObject(const v8::Arguments &args)
Returns a color with the specified \c red, \c green, \c blue and \c alpha components.
All components should be in the range 0-1 inclusive.
*/
-v8::Handle<v8::Value> rgba(const v8::Arguments &args)
+QV4::Value rgba(const v8::Arguments &args)
{
int argCount = args.Length();
if (argCount < 3 || argCount > 4)
- V8THROW_ERROR("Qt.rgba(): Invalid arguments");
+ V4THROW_ERROR("Qt.rgba(): Invalid arguments");
double r = args[0]->NumberValue();
double g = args[1]->NumberValue();
@@ -430,11 +432,11 @@ v8::Handle<v8::Value> rgba(const v8::Arguments &args)
Returns a color with the specified \c hue, \c saturation, \c lightness and \c alpha components.
All components should be in the range 0-1 inclusive.
*/
-v8::Handle<v8::Value> hsla(const v8::Arguments &args)
+QV4::Value hsla(const v8::Arguments &args)
{
int argCount = args.Length();
if (argCount < 3 || argCount > 4)
- V8THROW_ERROR("Qt.hsla(): Invalid arguments");
+ V4THROW_ERROR("Qt.hsla(): Invalid arguments");
double h = args[0]->NumberValue();
double s = args[1]->NumberValue();
@@ -461,10 +463,10 @@ may be either color values or string values. If a string value is supplied it
must be convertible to a color, as described for the \l{colorbasictypedocs}{color}
basic type.
*/
-v8::Handle<v8::Value> colorEqual(const v8::Arguments &args)
+QV4::Value colorEqual(const v8::Arguments &args)
{
if (args.Length() != 2)
- V8THROW_ERROR("Qt.colorEqual(): Invalid arguments");
+ V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
bool ok = false;
@@ -472,20 +474,20 @@ v8::Handle<v8::Value> colorEqual(const v8::Arguments &args)
if (lhs.userType() == QVariant::String) {
lhs = QQmlStringConverters::colorFromString(lhs.toString(), &ok);
if (!ok) {
- V8THROW_ERROR("Qt.colorEqual(): Invalid color name");
+ V4THROW_ERROR("Qt.colorEqual(): Invalid color name");
}
} else if (lhs.userType() != QVariant::Color) {
- V8THROW_ERROR("Qt.colorEqual(): Invalid arguments");
+ V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
}
QVariant rhs = V8ENGINE()->toVariant(args[1]->v4Value(), -1);
if (rhs.userType() == QVariant::String) {
rhs = QQmlStringConverters::colorFromString(rhs.toString(), &ok);
if (!ok) {
- V8THROW_ERROR("Qt.colorEqual(): Invalid color name");
+ V4THROW_ERROR("Qt.colorEqual(): Invalid color name");
}
} else if (rhs.userType() != QVariant::Color) {
- V8THROW_ERROR("Qt.colorEqual(): Invalid arguments");
+ V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
}
bool equal = (lhs == rhs);
@@ -499,10 +501,10 @@ Returns a \c rect with the top-left corner at \c x, \c y and the specified \c wi
The returned object has \c x, \c y, \c width and \c height attributes with the given values.
*/
-v8::Handle<v8::Value> rect(const v8::Arguments &args)
+QV4::Value rect(const v8::Arguments &args)
{
if (args.Length() != 4)
- V8THROW_ERROR("Qt.rect(): Invalid arguments");
+ V4THROW_ERROR("Qt.rect(): Invalid arguments");
double x = args[0]->NumberValue();
double y = args[1]->NumberValue();
@@ -516,10 +518,10 @@ v8::Handle<v8::Value> rect(const v8::Arguments &args)
\qmlmethod point Qt::point(int x, int y)
Returns a Point with the specified \c x and \c y coordinates.
*/
-v8::Handle<v8::Value> point(const v8::Arguments &args)
+QV4::Value point(const v8::Arguments &args)
{
if (args.Length() != 2)
- V8THROW_ERROR("Qt.point(): Invalid arguments");
+ V4THROW_ERROR("Qt.point(): Invalid arguments");
double x = args[0]->ToNumber()->Value();
double y = args[1]->ToNumber()->Value();
@@ -531,10 +533,10 @@ v8::Handle<v8::Value> point(const v8::Arguments &args)
\qmlmethod Qt::size(int width, int height)
Returns a Size with the specified \c width and \c height.
*/
-v8::Handle<v8::Value> size(const v8::Arguments &args)
+QV4::Value size(const v8::Arguments &args)
{
if (args.Length() != 2)
- V8THROW_ERROR("Qt.size(): Invalid arguments");
+ V4THROW_ERROR("Qt.size(): Invalid arguments");
double w = args[0]->ToNumber()->Value();
double h = args[1]->ToNumber()->Value();
@@ -546,10 +548,10 @@ v8::Handle<v8::Value> size(const v8::Arguments &args)
\qmlmethod Qt::vector2d(real x, real y)
Returns a Vector2D with the specified \c x and \c y.
*/
-v8::Handle<v8::Value> vector2d(const v8::Arguments &args)
+QV4::Value vector2d(const v8::Arguments &args)
{
if (args.Length() != 2)
- V8THROW_ERROR("Qt.vector2d(): Invalid arguments");
+ V4THROW_ERROR("Qt.vector2d(): Invalid arguments");
float xy[3]; // qvector2d uses float internally
xy[0] = args[0]->ToNumber()->Value();
@@ -563,10 +565,10 @@ v8::Handle<v8::Value> vector2d(const v8::Arguments &args)
\qmlmethod Qt::vector3d(real x, real y, real z)
Returns a Vector3D with the specified \c x, \c y and \c z.
*/
-v8::Handle<v8::Value> vector3d(const v8::Arguments &args)
+QV4::Value vector3d(const v8::Arguments &args)
{
if (args.Length() != 3)
- V8THROW_ERROR("Qt.vector3d(): Invalid arguments");
+ V4THROW_ERROR("Qt.vector3d(): Invalid arguments");
float xyz[3]; // qvector3d uses float internally
xyz[0] = args[0]->ToNumber()->Value();
@@ -581,10 +583,10 @@ v8::Handle<v8::Value> vector3d(const v8::Arguments &args)
\qmlmethod Qt::vector4d(real x, real y, real z, real w)
Returns a Vector4D with the specified \c x, \c y, \c z and \c w.
*/
-v8::Handle<v8::Value> vector4d(const v8::Arguments &args)
+QV4::Value vector4d(const v8::Arguments &args)
{
if (args.Length() != 4)
- V8THROW_ERROR("Qt.vector4d(): Invalid arguments");
+ V4THROW_ERROR("Qt.vector4d(): Invalid arguments");
float xyzw[4]; // qvector4d uses float internally
xyzw[0] = args[0]->ToNumber()->Value();
@@ -600,10 +602,10 @@ v8::Handle<v8::Value> vector4d(const v8::Arguments &args)
\qmlmethod Qt::quaternion(real scalar, real x, real y, real z)
Returns a Quaternion with the specified \c scalar, \c x, \c y, and \c z.
*/
-v8::Handle<v8::Value> quaternion(const v8::Arguments &args)
+QV4::Value quaternion(const v8::Arguments &args)
{
if (args.Length() != 4)
- V8THROW_ERROR("Qt.quaternion(): Invalid arguments");
+ V4THROW_ERROR("Qt.quaternion(): Invalid arguments");
qreal sxyz[4]; // qquaternion uses qreal internally
sxyz[0] = args[0]->ToNumber()->Value();
@@ -623,16 +625,16 @@ key-value pairs where valid keys are the \l{fontbasictypedocs}{font} type's
subproperty names, and the values are valid values for each subproperty.
Invalid keys will be ignored.
*/
-v8::Handle<v8::Value> font(const v8::Arguments &args)
+QV4::Value font(const v8::Arguments &args)
{
if (args.Length() != 1 || !args[0]->IsObject())
- V8THROW_ERROR("Qt.font(): Invalid arguments");
+ V4THROW_ERROR("Qt.font(): Invalid arguments");
v8::Handle<v8::Object> obj = args[0]->ToObject();
bool ok = false;
QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle::fromV8Handle(obj), V8ENGINE(), &ok);
if (!ok)
- V8THROW_ERROR("Qt.font(): Invalid argument: no valid font subproperties specified");
+ V4THROW_ERROR("Qt.font(): Invalid argument: no valid font subproperties specified");
return V8ENGINE()->fromVariant(v);
}
@@ -643,19 +645,19 @@ Alternatively, the function may be called with a single argument
where that argument is a JavaScript array which contains the sixteen
matrix values.
*/
-v8::Handle<v8::Value> matrix4x4(const v8::Arguments &args)
+QV4::Value matrix4x4(const v8::Arguments &args)
{
if (args.Length() == 1 && args[0]->IsObject()) {
v8::Handle<v8::Object> obj = args[0]->ToObject();
bool ok = false;
QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle::fromV8Handle(obj), V8ENGINE(), &ok);
if (!ok)
- V8THROW_ERROR("Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array");
+ V4THROW_ERROR("Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array");
return V8ENGINE()->fromVariant(v);
}
if (args.Length() != 16)
- V8THROW_ERROR("Qt.matrix4x4(): Invalid arguments");
+ V4THROW_ERROR("Qt.matrix4x4(): Invalid arguments");
qreal vals[16]; // qmatrix4x4 uses qreal internally
vals[0] = args[0]->ToNumber()->Value();
@@ -693,10 +695,10 @@ by factor and converts the color back to RGB.
If \c factor is not supplied, returns a color 50% lighter than \c baseColor (factor 1.5).
*/
-v8::Handle<v8::Value> lighter(const v8::Arguments &args)
+QV4::Value lighter(const v8::Arguments &args)
{
if (args.Length() != 1 && args.Length() != 2)
- V8THROW_ERROR("Qt.lighter(): Invalid arguments");
+ V4THROW_ERROR("Qt.lighter(): Invalid arguments");
QVariant v = V8ENGINE()->toVariant(args[0]->v4Value(), -1);
if (v.userType() == QVariant::String) {
@@ -731,10 +733,10 @@ by factor and converts the color back to RGB.
If \c factor is not supplied, returns a color 50% darker than \c baseColor (factor 2.0).
*/
-v8::Handle<v8::Value> darker(const v8::Arguments &args)
+QV4::Value darker(const v8::Arguments &args)
{
if (args.Length() != 1 && args.Length() != 2)
- V8THROW_ERROR("Qt.darker(): Invalid arguments");
+ V4THROW_ERROR("Qt.darker(): Invalid arguments");
QVariant v = V8ENGINE()->toVariant(args[0]->v4Value(), -1);
if (v.userType() == QVariant::String) {
@@ -778,10 +780,10 @@ v8::Handle<v8::Value> darker(const v8::Arguments &args)
Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color.
*/
-v8::Handle<v8::Value> tint(const v8::Arguments &args)
+QV4::Value tint(const v8::Arguments &args)
{
if (args.Length() != 2)
- V8THROW_ERROR("Qt.tint(): Invalid arguments");
+ V4THROW_ERROR("Qt.tint(): Invalid arguments");
// base color
QVariant v1 = V8ENGINE()->toVariant(args[0]->v4Value(), -1);
@@ -826,10 +828,10 @@ If \a format is not specified, \a date is formatted using
\sa Locale
*/
-v8::Handle<v8::Value> formatDate(const v8::Arguments &args)
+QV4::Value formatDate(const v8::Arguments &args)
{
if (args.Length() < 1 || args.Length() > 2)
- V8THROW_ERROR("Qt.formatDate(): Invalid arguments");
+ V4THROW_ERROR("Qt.formatDate(): Invalid arguments");
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QDate date = V8ENGINE()->toVariant(args[0]->v4Value(), -1).toDateTime().date();
@@ -843,7 +845,7 @@ v8::Handle<v8::Value> formatDate(const v8::Arguments &args)
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDate = date.toString(format);
} else {
- V8THROW_ERROR("Qt.formatDate(): Invalid date format");
+ V4THROW_ERROR("Qt.formatDate(): Invalid date format");
}
} else {
formattedDate = date.toString(enumFormat);
@@ -867,10 +869,10 @@ If \a format is not specified, \a time is formatted using
\sa Locale
*/
-v8::Handle<v8::Value> formatTime(const v8::Arguments &args)
+QV4::Value formatTime(const v8::Arguments &args)
{
if (args.Length() < 1 || args.Length() > 2)
- V8THROW_ERROR("Qt.formatTime(): Invalid arguments");
+ V4THROW_ERROR("Qt.formatTime(): Invalid arguments");
QVariant argVariant = V8ENGINE()->toVariant(args[0]->v4Value(), -1);
QTime time;
@@ -890,7 +892,7 @@ v8::Handle<v8::Value> formatTime(const v8::Arguments &args)
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedTime = time.toString(format);
} else {
- V8THROW_ERROR("Qt.formatTime(): Invalid time format");
+ V4THROW_ERROR("Qt.formatTime(): Invalid time format");
}
} else {
formattedTime = time.toString(enumFormat);
@@ -989,10 +991,10 @@ with the \a format values below to produce the following results:
\sa Locale
*/
-v8::Handle<v8::Value> formatDateTime(const v8::Arguments &args)
+QV4::Value formatDateTime(const v8::Arguments &args)
{
if (args.Length() < 1 || args.Length() > 2)
- V8THROW_ERROR("Qt.formatDateTime(): Invalid arguments");
+ V4THROW_ERROR("Qt.formatDateTime(): Invalid arguments");
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QDateTime dt = V8ENGINE()->toVariant(args[0]->v4Value(), -1).toDateTime();
@@ -1006,7 +1008,7 @@ v8::Handle<v8::Value> formatDateTime(const v8::Arguments &args)
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDt = dt.toString(format);
} else {
- V8THROW_ERROR("Qt.formatDateTime(): Invalid datetime format");
+ V4THROW_ERROR("Qt.formatDateTime(): Invalid datetime format");
}
} else {
formattedDt = dt.toString(enumFormat);
@@ -1019,12 +1021,12 @@ v8::Handle<v8::Value> formatDateTime(const v8::Arguments &args)
\qmlmethod bool Qt::openUrlExternally(url target)
Attempts to open the specified \c target url in an external application, based on the user's desktop preferences. Returns true if it succeeds, and false otherwise.
*/
-v8::Handle<v8::Value> openUrlExternally(const v8::Arguments &args)
+QV4::Value openUrlExternally(const v8::Arguments &args)
{
if (args.Length() != 1)
return V8ENGINE()->fromVariant(false);
- QUrl url(V8ENGINE()->toVariant(resolvedUrl(args)->v4Value(), -1).toUrl());
+ QUrl url(V8ENGINE()->toVariant(resolvedUrl(args), -1).toUrl());
return V8ENGINE()->fromVariant(QQml_guiProvider()->openUrlExternally(url));
}
@@ -1032,7 +1034,7 @@ v8::Handle<v8::Value> openUrlExternally(const v8::Arguments &args)
\qmlmethod url Qt::resolvedUrl(url url)
Returns \a url resolved relative to the URL of the caller.
*/
-v8::Handle<v8::Value> resolvedUrl(const v8::Arguments &args)
+QV4::Value resolvedUrl(const v8::Arguments &args)
{
QUrl url = V8ENGINE()->toVariant(args[0]->v4Value(), -1).toUrl();
QQmlEngine *e = V8ENGINE()->engine();
@@ -1053,10 +1055,10 @@ v8::Handle<v8::Value> resolvedUrl(const v8::Arguments &args)
\qmlmethod list<string> Qt::fontFamilies()
Returns a list of the font families available to the application.
*/
-v8::Handle<v8::Value> fontFamilies(const v8::Arguments &args)
+QV4::Value fontFamilies(const v8::Arguments &args)
{
if (args.Length() != 0)
- V8THROW_ERROR("Qt.fontFamilies(): Invalid arguments");
+ V4THROW_ERROR("Qt.fontFamilies(): Invalid arguments");
return V8ENGINE()->fromVariant(QVariant(QQml_guiProvider()->fontFamilies()));
}
@@ -1065,10 +1067,10 @@ v8::Handle<v8::Value> fontFamilies(const v8::Arguments &args)
\qmlmethod string Qt::md5(data)
Returns a hex string of the md5 hash of \c data.
*/
-v8::Handle<v8::Value> md5(const v8::Arguments &args)
+QV4::Value md5(const v8::Arguments &args)
{
if (args.Length() != 1)
- V8THROW_ERROR("Qt.md5(): Invalid arguments");
+ V4THROW_ERROR("Qt.md5(): Invalid arguments");
QByteArray data = args[0]->v4Value().toQString().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
@@ -1079,10 +1081,10 @@ v8::Handle<v8::Value> md5(const v8::Arguments &args)
\qmlmethod string Qt::btoa(data)
Binary to ASCII - this function returns a base64 encoding of \c data.
*/
-v8::Handle<v8::Value> btoa(const v8::Arguments &args)
+QV4::Value btoa(const v8::Arguments &args)
{
if (args.Length() != 1)
- V8THROW_ERROR("Qt.btoa(): Invalid arguments");
+ V4THROW_ERROR("Qt.btoa(): Invalid arguments");
QByteArray data = args[0]->v4Value().toQString().toUtf8();
@@ -1093,10 +1095,10 @@ v8::Handle<v8::Value> btoa(const v8::Arguments &args)
\qmlmethod string Qt::atob(data)
ASCII to binary - this function returns a base64 decoding of \c data.
*/
-v8::Handle<v8::Value> atob(const v8::Arguments &args)
+QV4::Value atob(const v8::Arguments &args)
{
if (args.Length() != 1)
- V8THROW_ERROR("Qt.atob(): Invalid arguments");
+ V4THROW_ERROR("Qt.atob(): Invalid arguments");
QByteArray data = args[0]->v4Value().toQString().toUtf8();
@@ -1110,7 +1112,7 @@ Within the \l {Prototyping with qmlscene}, this causes the launcher application
to quit a C++ application when this method is called, connect the
QQmlEngine::quit() signal to the QCoreApplication::quit() slot.
*/
-v8::Handle<v8::Value> quit(const v8::Arguments &args)
+QV4::Value quit(const v8::Arguments &args)
{
QQmlEnginePrivate::get(V8ENGINE()->engine())->sendQuit();
return QV4::Value::undefinedValue();
@@ -1140,10 +1142,10 @@ If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createCompo
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
*/
-v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args)
+QV4::Value createQmlObject(const v8::Arguments &args)
{
if (args.Length() < 2 || args.Length() > 3)
- V8THROW_ERROR("Qt.createQmlObject(): Invalid arguments");
+ V4THROW_ERROR("Qt.createQmlObject(): Invalid arguments");
struct Error {
static v8::Handle<v8::Value> create(QV8Engine *engine, const QList<QQmlError> &errors) {
@@ -1194,7 +1196,7 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args)
QObject *parentArg = v8engine->toQObject(args[1]->v4Value());
if (!parentArg)
- V8THROW_ERROR("Qt.createQmlObject(): Missing parent object");
+ V4THROW_ERROR("Qt.createQmlObject(): Missing parent object");
QQmlComponent component(engine);
component.setData(qml.toUtf8(), url);
@@ -1205,7 +1207,7 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args)
}
if (!component.isReady())
- V8THROW_ERROR("Qt.createQmlObject(): Component is not ready");
+ V4THROW_ERROR("Qt.createQmlObject(): Component is not ready");
QObject *obj = component.beginCreate(effectiveContext);
if (obj) {
@@ -1264,12 +1266,12 @@ See \l {Dynamic QML Object Creation from JavaScript} for more information on usi
To create a QML object from an arbitrary string of QML (instead of a file),
use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
-v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
+QV4::Value createComponent(const v8::Arguments &args)
{
- const char *invalidArgs = "Qt.createComponent(): Invalid arguments";
- const char *invalidParent = "Qt.createComponent(): Invalid parent object";
+ const QString invalidArgs = QStringLiteral("Qt.createComponent(): Invalid arguments");
+ const QString invalidParent = QStringLiteral("Qt.createComponent(): Invalid parent object");
if (args.Length() < 1 || args.Length() > 3)
- V8THROW_ERROR(invalidArgs);
+ v8::Isolate::GetEngine()->current->throwError(invalidArgs);
QV8Engine *v8engine = V8ENGINE();
QQmlEngine *engine = v8engine->engine();
@@ -1295,24 +1297,24 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
if (args[1]->IsInt32()) {
int mode = args[1]->Int32Value();
if (mode != int(QQmlComponent::PreferSynchronous) && mode != int(QQmlComponent::Asynchronous))
- V8THROW_ERROR(invalidArgs);
+ v8::Isolate::GetEngine()->current->throwError(invalidArgs);
compileMode = QQmlComponent::CompilationMode(mode);
consumedCount += 1;
} else {
// The second argument could be the parent only if there are exactly two args
if ((args.Length() != 2) || !(lastArg->IsObject() || lastArg->IsNull()))
- V8THROW_ERROR(invalidArgs);
+ v8::Isolate::GetEngine()->current->throwError(invalidArgs);
}
if (consumedCount < args.Length()) {
if (lastArg->IsObject()) {
parentArg = v8engine->toQObject(lastArg->v4Value());
if (!parentArg)
- V8THROW_ERROR(invalidParent);
+ v8::Isolate::GetEngine()->current->throwError(invalidParent);
} else if (lastArg->IsNull()) {
parentArg = 0;
} else {
- V8THROW_ERROR(invalidParent);
+ v8::Isolate::GetEngine()->current->throwError(invalidParent);
}
}
}
@@ -1344,16 +1346,16 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
\sa {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
+QV4::Value qsTranslate(const v8::Arguments &args)
{
if (args.Length() < 2)
- V8THROW_ERROR("qsTranslate() requires at least two arguments");
+ V4THROW_ERROR("qsTranslate() requires at least two arguments");
if (!args[0]->IsString())
- V8THROW_ERROR("qsTranslate(): first argument (context) must be a string");
+ V4THROW_ERROR("qsTranslate(): first argument (context) must be a string");
if (!args[1]->IsString())
- V8THROW_ERROR("qsTranslate(): second argument (sourceText) must be a string");
+ V4THROW_ERROR("qsTranslate(): second argument (sourceText) must be a string");
if ((args.Length() > 2) && !args[2]->IsString())
- V8THROW_ERROR("qsTranslate(): third argument (disambiguation) must be a string");
+ V4THROW_ERROR("qsTranslate(): third argument (disambiguation) must be a string");
QV8Engine *v8engine = V8ENGINE();
QString context = args[0]->v4Value().toQString();
@@ -1401,11 +1403,11 @@ v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
\sa {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
+QV4::Value qsTranslateNoOp(const v8::Arguments &args)
{
if (args.Length() < 2)
return QV4::Value::undefinedValue();
- return args[1];
+ return args[1]->v4Value();
}
/*!
@@ -1425,16 +1427,16 @@ v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
\sa {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
+QV4::Value qsTr(const v8::Arguments &args)
{
if (args.Length() < 1)
- V8THROW_ERROR("qsTr() requires at least one argument");
+ V4THROW_ERROR("qsTr() requires at least one argument");
if (!args[0]->IsString())
- V8THROW_ERROR("qsTr(): first argument (sourceText) must be a string");
+ V4THROW_ERROR("qsTr(): first argument (sourceText) must be a string");
if ((args.Length() > 1) && !args[1]->IsString())
- V8THROW_ERROR("qsTr(): second argument (disambiguation) must be a string");
+ V4THROW_ERROR("qsTr(): second argument (disambiguation) must be a string");
if ((args.Length() > 2) && !args[2]->IsNumber())
- V8THROW_ERROR("qsTr(): third argument (n) must be a number");
+ V4THROW_ERROR("qsTr(): third argument (n) must be a number");
QV8Engine *v8engine = V8ENGINE();
QQmlContextData *ctxt = v8engine->callingContext();
@@ -1479,11 +1481,11 @@ v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
\sa {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
+QV4::Value qsTrNoOp(const v8::Arguments &args)
{
if (args.Length() < 1)
return QV4::Value::undefinedValue();
- return args[0];
+ return args[0]->v4Value();
}
/*!
@@ -1516,14 +1518,14 @@ v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
\sa QT_TRID_NOOP, {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
+QV4::Value qsTrId(const v8::Arguments &args)
{
if (args.Length() < 1)
- V8THROW_ERROR("qsTrId() requires at least one argument");
+ V4THROW_ERROR("qsTrId() requires at least one argument");
if (!args[0]->IsString())
- V8THROW_TYPE("qsTrId(): first argument (id) must be a string");
+ V4THROW_TYPE("qsTrId(): first argument (id) must be a string");
if (args.Length() > 1 && !args[1]->IsNumber())
- V8THROW_TYPE("qsTrId(): second argument (n) must be a number");
+ V4THROW_TYPE("qsTrId(): second argument (n) must be a number");
int n = -1;
if (args.Length() > 1)
@@ -1549,11 +1551,11 @@ v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
\sa qsTrId(), {Localization And Internationalization Support In Qt Quick}
*/
-v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
+QV4::Value qsTrIdNoOp(const v8::Arguments &args)
{
if (args.Length() < 1)
return QV4::Value::undefinedValue();
- return args[0];
+ return args[0]->v4Value();
}
#endif // QT_NO_TRANSLATION
@@ -1577,13 +1579,13 @@ v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
\sa QtQuick2::Locale
*/
-v8::Handle<v8::Value> locale(const v8::Arguments &args)
+QV4::Value locale(const v8::Arguments &args)
{
QString code;
if (args.Length() > 1)
- V8THROW_ERROR("locale() requires 0 or 1 argument");
+ V4THROW_ERROR("locale() requires 0 or 1 argument");
if (args.Length() == 1 && !args[0]->IsString())
- V8THROW_TYPE("locale(): argument (locale code) must be a string");
+ V4THROW_TYPE("locale(): argument (locale code) must be a string");
QV8Engine *v8engine = V8ENGINE();
if (args.Length() == 1)
@@ -1638,17 +1640,17 @@ v8::Handle<v8::Value> locale(const v8::Arguments &args)
\since QtQuick 2.0
*/
-v8::Handle<v8::Value> binding(const v8::Arguments &args)
+QV4::Value binding(const v8::Arguments &args)
{
QString code;
if (args.Length() != 1)
- V8THROW_ERROR("binding() requires 1 argument");
+ V4THROW_ERROR("binding() requires 1 argument");
if (!args[0]->IsFunction())
- V8THROW_TYPE("binding(): argument (binding expression) must be a function");
+ V4THROW_TYPE("binding(): argument (binding expression) must be a function");
v8::Handle<v8::Object> rv = args[0]->ToObject()->Clone();
rv->SetHiddenValue(v8::Value::fromV4Value(V8ENGINE()->bindingFlagKey()), v8::Boolean::New(true));
- return rv;
+ return rv->v4Value();
}
} // namespace QQmlBuiltinFunctions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index f73802b136..fb79397921 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -60,57 +60,57 @@ QT_BEGIN_NAMESPACE
namespace QQmlBuiltinFunctions
{
-v8::Handle<v8::Value> gc(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleError(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleLog(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleProfile(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleProfileEnd(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleTime(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleCount(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleWarn(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args);
-v8::Handle<v8::Value> consoleException(const v8::Arguments &args);
-v8::Handle<v8::Value> isQtObject(const v8::Arguments &args);
-v8::Handle<v8::Value> rgba(const v8::Arguments &args);
-v8::Handle<v8::Value> hsla(const v8::Arguments &args);
-v8::Handle<v8::Value> colorEqual(const v8::Arguments &args);
-v8::Handle<v8::Value> font(const v8::Arguments &args);
-v8::Handle<v8::Value> rect(const v8::Arguments &args);
-v8::Handle<v8::Value> point(const v8::Arguments &args);
-v8::Handle<v8::Value> size(const v8::Arguments &args);
-v8::Handle<v8::Value> vector2d(const v8::Arguments &args);
-v8::Handle<v8::Value> vector3d(const v8::Arguments &args);
-v8::Handle<v8::Value> vector4d(const v8::Arguments &args);
-v8::Handle<v8::Value> quaternion(const v8::Arguments &args);
-v8::Handle<v8::Value> matrix4x4(const v8::Arguments &args);
-v8::Handle<v8::Value> lighter(const v8::Arguments &args);
-v8::Handle<v8::Value> darker(const v8::Arguments &args);
-v8::Handle<v8::Value> tint(const v8::Arguments &args);
-v8::Handle<v8::Value> formatDate(const v8::Arguments &args);
-v8::Handle<v8::Value> formatTime(const v8::Arguments &args);
-v8::Handle<v8::Value> formatDateTime(const v8::Arguments &args);
-v8::Handle<v8::Value> openUrlExternally(const v8::Arguments &args);
-v8::Handle<v8::Value> fontFamilies(const v8::Arguments &args);
-v8::Handle<v8::Value> md5(const v8::Arguments &args);
-v8::Handle<v8::Value> btoa(const v8::Arguments &args);
-v8::Handle<v8::Value> atob(const v8::Arguments &args);
-v8::Handle<v8::Value> quit(const v8::Arguments &args);
-v8::Handle<v8::Value> resolvedUrl(const v8::Arguments &args);
-v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args);
-v8::Handle<v8::Value> createComponent(const v8::Arguments &args);
+QV4::Value gc(const v8::Arguments &args);
+QV4::Value consoleError(const v8::Arguments &args);
+QV4::Value consoleLog(const v8::Arguments &args);
+QV4::Value consoleProfile(const v8::Arguments &args);
+QV4::Value consoleProfileEnd(const v8::Arguments &args);
+QV4::Value consoleTime(const v8::Arguments &args);
+QV4::Value consoleTimeEnd(const v8::Arguments &args);
+QV4::Value consoleCount(const v8::Arguments &args);
+QV4::Value consoleTrace(const v8::Arguments &args);
+QV4::Value consoleWarn(const v8::Arguments &args);
+QV4::Value consoleAssert(const v8::Arguments &args);
+QV4::Value consoleException(const v8::Arguments &args);
+QV4::Value isQtObject(const v8::Arguments &args);
+QV4::Value rgba(const v8::Arguments &args);
+QV4::Value hsla(const v8::Arguments &args);
+QV4::Value colorEqual(const v8::Arguments &args);
+QV4::Value font(const v8::Arguments &args);
+QV4::Value rect(const v8::Arguments &args);
+QV4::Value point(const v8::Arguments &args);
+QV4::Value size(const v8::Arguments &args);
+QV4::Value vector2d(const v8::Arguments &args);
+QV4::Value vector3d(const v8::Arguments &args);
+QV4::Value vector4d(const v8::Arguments &args);
+QV4::Value quaternion(const v8::Arguments &args);
+QV4::Value matrix4x4(const v8::Arguments &args);
+QV4::Value lighter(const v8::Arguments &args);
+QV4::Value darker(const v8::Arguments &args);
+QV4::Value tint(const v8::Arguments &args);
+QV4::Value formatDate(const v8::Arguments &args);
+QV4::Value formatTime(const v8::Arguments &args);
+QV4::Value formatDateTime(const v8::Arguments &args);
+QV4::Value openUrlExternally(const v8::Arguments &args);
+QV4::Value fontFamilies(const v8::Arguments &args);
+QV4::Value md5(const v8::Arguments &args);
+QV4::Value btoa(const v8::Arguments &args);
+QV4::Value atob(const v8::Arguments &args);
+QV4::Value quit(const v8::Arguments &args);
+QV4::Value resolvedUrl(const v8::Arguments &args);
+QV4::Value createQmlObject(const v8::Arguments &args);
+QV4::Value createComponent(const v8::Arguments &args);
#ifndef QT_NO_TRANSLATION
-v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args);
-v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args);
-v8::Handle<v8::Value> qsTr(const v8::Arguments &args);
-v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args);
-v8::Handle<v8::Value> qsTrId(const v8::Arguments &args);
-v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args);
+QV4::Value qsTranslate(const v8::Arguments &args);
+QV4::Value qsTranslateNoOp(const v8::Arguments &args);
+QV4::Value qsTr(const v8::Arguments &args);
+QV4::Value qsTrNoOp(const v8::Arguments &args);
+QV4::Value qsTrId(const v8::Arguments &args);
+QV4::Value qsTrIdNoOp(const v8::Arguments &args);
#endif
-v8::Handle<v8::Value> stringArg(const v8::Arguments &args);
-v8::Handle<v8::Value> locale(const v8::Arguments &args);
-v8::Handle<v8::Value> binding(const v8::Arguments &args);
+QV4::Value stringArg(const v8::Arguments &args);
+QV4::Value locale(const v8::Arguments &args);
+QV4::Value binding(const v8::Arguments &args);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h
index 434f9c5846..3d612cb397 100644
--- a/src/qml/qml/v8/qv4domerrors_p.h
+++ b/src/qml/qml/v8/qv4domerrors_p.h
@@ -83,6 +83,14 @@ QT_BEGIN_NAMESPACE
return v8::Handle<v8::Value>(); \
}
+#define V4THROW_DOM(error, string) { \
+ QV4::ExecutionContext *ctx = v8::Isolate::GetEngine()->current; \
+ QV4::Value v = QV4::Value::fromString(ctx, QStringLiteral(string)); \
+ QV4::Object *ex = ctx->engine->newErrorObject(v); \
+ ex->put(ctx, ctx->engine->newIdentifier(QStringLiteral("code")), QV4::Value::fromInt32(error)); \
+ ctx->throwError(QV4::Value::fromObject(ex)); \
+}
+
namespace QV4 {
struct ExecutionEngine;
}
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index d8f6e1bb39..db8984ccda 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -116,10 +116,17 @@ namespace QV4 {
v8::ThrowException(v8::Exception::Error(v8::String::New(string))); \
return v8::Handle<v8::Value>(); \
}
+
+#define V4THROW_ERROR(string) \
+ v8::Isolate::GetEngine()->current->throwError(QStringLiteral(string));
+
#define V8THROW_TYPE(string) { \
v8::ThrowException(v8::Exception::TypeError(v8::String::New(string))); \
return v8::Handle<v8::Value>(); \
}
+#define V4THROW_TYPE(string) \
+ v8::Isolate::GetEngine()->current->throwError(QStringLiteral(string));
+
#define V8ENGINE_ACCESSOR() ((QV8Engine *)v8::External::Cast(info.Data().get())->Value());
#define V8THROW_ERROR_SETTER(string) { \
v8::ThrowException(v8::Exception::Error(v8::String::New(string))); \
diff --git a/src/qml/qml/v8/qv8include.cpp b/src/qml/qml/v8/qv8include.cpp
index 92e262157b..72b7868b9b 100644
--- a/src/qml/qml/v8/qv8include.cpp
+++ b/src/qml/qml/v8/qv8include.cpp
@@ -167,7 +167,7 @@ void QV8Include::finished()
/*
Documented in qv8engine.cpp
*/
-v8::Handle<v8::Value> QV8Include::include(const v8::Arguments &args)
+QV4::Value QV8Include::include(const v8::Arguments &args)
{
if (args.Length() == 0)
return QV4::Value::undefinedValue();
@@ -176,7 +176,7 @@ v8::Handle<v8::Value> QV8Include::include(const v8::Arguments &args)
QQmlContextData *context = engine->callingContext();
if (!context || !context->isJSContext)
- V8THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
+ V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
QUrl url(context->resolvedUrl(QUrl(args[0]->v4Value().toQString())));
@@ -237,7 +237,7 @@ v8::Handle<v8::Value> QV8Include::include(const v8::Arguments &args)
if (result.IsEmpty())
return QV4::Value::undefinedValue();
else
- return result;
+ return result->v4Value();
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv8include_p.h b/src/qml/qml/v8/qv8include_p.h
index 36a322e33a..ab7b2ff8db 100644
--- a/src/qml/qml/v8/qv8include_p.h
+++ b/src/qml/qml/v8/qv8include_p.h
@@ -78,7 +78,7 @@ public:
Exception = 3
};
- static v8::Handle<v8::Value> include(const v8::Arguments &args);
+ static QV4::Value include(const v8::Arguments &args);
private slots:
void finished();
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index e58584b9ca..aa22156ae3 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -133,7 +133,7 @@ struct CallArgument {
inline void initAsType(int type);
inline void fromValue(int type, QV8Engine *, v8::Handle<v8::Value>);
- inline v8::Handle<v8::Value> toValue(QV8Engine *);
+ inline QV4::Value toValue(QV8Engine *);
private:
CallArgument(const CallArgument &);
@@ -1366,10 +1366,10 @@ int QV8QObjectConnectionList::qt_metacall(QMetaObject::Call method, int index, v
return -1;
}
-v8::Handle<v8::Value> QV8QObjectWrapper::Connect(const v8::Arguments &args)
+QV4::Value QV8QObjectWrapper::Connect(const v8::Arguments &args)
{
if (args.Length() == 0)
- V8THROW_ERROR("Function.prototype.connect: no arguments given");
+ V4THROW_ERROR("Function.prototype.connect: no arguments given");
QV8Engine *engine = V8ENGINE();
@@ -1378,13 +1378,13 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Connect(const v8::Arguments &args)
int signalIndex = signalInfo.second;
if (signalIndex < 0)
- V8THROW_ERROR("Function.prototype.connect: this object is not a signal");
+ V4THROW_ERROR("Function.prototype.connect: this object is not a signal");
if (!signalObject)
- V8THROW_ERROR("Function.prototype.connect: cannot connect to deleted QObject");
+ V4THROW_ERROR("Function.prototype.connect: cannot connect to deleted QObject");
if (signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal)
- V8THROW_ERROR("Function.prototype.connect: this object is not a signal");
+ V4THROW_ERROR("Function.prototype.connect: this object is not a signal");
v8::Handle<v8::Value> functionValue;
v8::Handle<v8::Value> functionThisValue;
@@ -1397,10 +1397,10 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Connect(const v8::Arguments &args)
}
if (!functionValue->IsFunction())
- V8THROW_ERROR("Function.prototype.connect: target is not a function");
+ V4THROW_ERROR("Function.prototype.connect: target is not a function");
if (!functionThisValue.IsEmpty() && !functionThisValue->IsObject())
- V8THROW_ERROR("Function.prototype.connect: target this is not an object");
+ V4THROW_ERROR("Function.prototype.connect: target this is not an object");
QV8QObjectWrapper *qobjectWrapper = engine->qobjectWrapper();
QHash<QObject *, QV8QObjectConnectionList *> &connections = qobjectWrapper->m_connections;
@@ -1425,10 +1425,10 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Connect(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> QV8QObjectWrapper::Disconnect(const v8::Arguments &args)
+QV4::Value QV8QObjectWrapper::Disconnect(const v8::Arguments &args)
{
if (args.Length() == 0)
- V8THROW_ERROR("Function.prototype.disconnect: no arguments given");
+ V4THROW_ERROR("Function.prototype.disconnect: no arguments given");
QV8Engine *engine = V8ENGINE();
@@ -1437,13 +1437,13 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Disconnect(const v8::Arguments &args)
int signalIndex = signalInfo.second;
if (signalIndex == -1)
- V8THROW_ERROR("Function.prototype.disconnect: this object is not a signal");
+ V4THROW_ERROR("Function.prototype.disconnect: this object is not a signal");
if (!signalObject)
- V8THROW_ERROR("Function.prototype.disconnect: cannot disconnect from deleted QObject");
+ V4THROW_ERROR("Function.prototype.disconnect: cannot disconnect from deleted QObject");
if (signalIndex < 0 || signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal)
- V8THROW_ERROR("Function.prototype.disconnect: this object is not a signal");
+ V4THROW_ERROR("Function.prototype.disconnect: this object is not a signal");
v8::Handle<v8::Value> functionValue;
v8::Handle<v8::Value> functionThisValue;
@@ -1456,10 +1456,10 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Disconnect(const v8::Arguments &args)
}
if (!functionValue->IsFunction())
- V8THROW_ERROR("Function.prototype.disconnect: target is not a function");
+ V4THROW_ERROR("Function.prototype.disconnect: target is not a function");
if (!functionThisValue.IsEmpty() && !functionThisValue->IsObject())
- V8THROW_ERROR("Function.prototype.disconnect: target this is not an object");
+ V4THROW_ERROR("Function.prototype.disconnect: target this is not an object");
QV8QObjectWrapper *qobjectWrapper = engine->qobjectWrapper();
QHash<QObject *, QV8QObjectConnectionList *> &connectionsList = qobjectWrapper->m_connections;
@@ -1555,7 +1555,7 @@ private:
};
}
-static v8::Handle<v8::Value> CallMethod(QObject *object, int index, int returnType, int argCount,
+static QV4::Value CallMethod(QObject *object, int index, int returnType, int argCount,
int *argTypes, QV8Engine *engine, CallArgs &callArgs)
{
if (argCount > 0) {
@@ -1795,7 +1795,7 @@ static const QQmlPropertyData * RelatedMethod(QObject *object,
}
}
-static v8::Handle<v8::Value> CallPrecise(QObject *object, const QQmlPropertyData &data,
+static QV4::Value CallPrecise(QObject *object, const QQmlPropertyData &data,
QV8Engine *engine, CallArgs &callArgs)
{
QByteArray unknownTypeError;
@@ -1805,8 +1805,7 @@ static v8::Handle<v8::Value> CallPrecise(QObject *object, const QQmlPropertyData
if (returnType == QMetaType::UnknownType) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method return type: %1").arg(typeName);
- v8::ThrowException(v8::Exception::Error(engine->toString(error)));
- return v8::Handle<v8::Value>();
+ QV8Engine::getV4(engine)->current->throwError(error);
}
if (data.hasArguments()) {
@@ -1820,14 +1819,12 @@ static v8::Handle<v8::Value> CallPrecise(QObject *object, const QQmlPropertyData
if (!args) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method parameter type: %1").arg(typeName);
- v8::ThrowException(v8::Exception::Error(engine->toString(error)));
- return v8::Handle<v8::Value>();
+ QV8Engine::getV4(engine)->current->throwError(error);
}
if (args[0] > callArgs.Length()) {
QString error = QLatin1String("Insufficient arguments");
- v8::ThrowException(v8::Exception::Error(engine->toString(error)));
- return v8::Handle<v8::Value>();
+ QV8Engine::getV4(engine)->current->throwError(error);
}
return CallMethod(object, data.coreIndex, returnType, args[0], args + 1, engine, callArgs);
@@ -1852,7 +1849,7 @@ Resolve the overloaded method to call. The algorithm works conceptually like th
If two or more overloads have the same match score, call the last one. The match
score is constructed by adding the matchScore() result for each of the parameters.
*/
-static v8::Handle<v8::Value> CallOverloaded(QObject *object, const QQmlPropertyData &data,
+static QV4::Value CallOverloaded(QObject *object, const QQmlPropertyData &data,
QV8Engine *engine, CallArgs &callArgs)
{
int argumentCount = callArgs.Length();
@@ -1923,12 +1920,11 @@ static v8::Handle<v8::Value> CallOverloaded(QObject *object, const QQmlPropertyD
candidate = RelatedMethod(object, candidate, dummy);
}
- v8::ThrowException(v8::Exception::Error(engine->toString(error)));
- return v8::Handle<v8::Value>();
+ QV8Engine::getV4(engine)->current->throwError(error);
}
}
-static v8::Handle<v8::Value> ToString(QV8Engine *engine, QObject *object, int, v8::Handle<v8::Object>)
+static QV4::Value ToString(QV8Engine *engine, QObject *object, int, v8::Handle<v8::Object>)
{
QString result;
if (object) {
@@ -1952,7 +1948,7 @@ static v8::Handle<v8::Value> ToString(QV8Engine *engine, QObject *object, int, v
return engine->toString(result);
}
-static v8::Handle<v8::Value> Destroy(QV8Engine *, QObject *object, int argCount, v8::Handle<v8::Object> args)
+static QV4::Value Destroy(QV8Engine *, QObject *object, int argCount, v8::Handle<v8::Object> args)
{
QQmlData *ddata = QQmlData::get(object, false);
if (!ddata || ddata->indestructible || ddata->rootObjectInCreation) {
@@ -1973,7 +1969,7 @@ static v8::Handle<v8::Value> Destroy(QV8Engine *, QObject *object, int argCount,
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> QV8QObjectWrapper::Invoke(const v8::Arguments &args)
+QV4::Value QV8QObjectWrapper::Invoke(const v8::Arguments &args)
{
// object, index, qmlglobal, argCount, args
Q_ASSERT(args.Length() == 5);
@@ -1992,7 +1988,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Invoke(const v8::Arguments &args)
v8::Handle<v8::Array> data = v8::Array::New(2);
data->Set(0, args[0]);
data->Set(1, args[1]);
- return data;
+ return data->v4Value();
}
QObject *object = resource->object;
@@ -2043,7 +2039,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Invoke(const v8::Arguments &args)
QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, method.coreIndex, args);
if (rv.IsEmpty()) return QV4::Value::undefinedValue();
- return rv;
+ return rv->v4Value();
}
CallArgs callArgs(argCount, &arguments);
@@ -2229,20 +2225,20 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, v8::Handle<v8::Val
}
}
-v8::Handle<v8::Value> CallArgument::toValue(QV8Engine *engine)
+QV4::Value CallArgument::toValue(QV8Engine *engine)
{
if (type == qMetaTypeId<QJSValue>()) {
- return v8::Value::fromV4Value(QJSValuePrivate::get(*qjsValuePtr)->getValue(QV8Engine::getV4(engine)));
+ return QJSValuePrivate::get(*qjsValuePtr)->getValue(QV8Engine::getV4(engine));
} else if (type == QMetaType::Int) {
- return v8::Integer::New(int(intValue));
+ return QV4::Value::fromInt32(int(intValue));
} else if (type == QMetaType::UInt) {
- return v8::Integer::NewFromUnsigned(intValue);
+ return QV4::Value::fromUInt32(intValue);
} else if (type == QMetaType::Bool) {
- return v8::Boolean::New(boolValue);
+ return QV4::Value::fromBoolean(boolValue);
} else if (type == QMetaType::Double) {
- return v8::Number::New(doubleValue);
+ return QV4::Value::fromDouble(doubleValue);
} else if (type == QMetaType::Float) {
- return v8::Number::New(floatValue);
+ return QV4::Value::fromDouble(floatValue);
} else if (type == QMetaType::QString) {
return engine->toString(*qstringPtr);
} else if (type == QMetaType::QObjectStar) {
@@ -2254,22 +2250,23 @@ v8::Handle<v8::Value> CallArgument::toValue(QV8Engine *engine)
// XXX Can this be made more by using Array as a prototype and implementing
// directly against QList<QObject*>?
QList<QObject *> &list = *qlistPtr;
- v8::Handle<v8::Array> array = v8::Array::New(list.count());
+ QV4::ArrayObject *array = QV8Engine::getV4(engine)->newArrayObject();
+ array->setArrayLength(list.count());
for (int ii = 0; ii < list.count(); ++ii)
- array->Set(ii, engine->newQObject(list.at(ii)));
- return array;
+ array->arrayData[ii].value = engine->newQObject(list.at(ii));
+ return QV4::Value::fromObject(array);
} else if (type == qMetaTypeId<QQmlV4Handle>()) {
- return handlePtr->toV8Handle();
+ return handlePtr->toValue();
} else if (type == QMetaType::QJsonArray) {
- return v8::Value::fromV4Value(engine->jsonArrayToJS(*jsonArrayPtr));
+ return engine->jsonArrayToJS(*jsonArrayPtr);
} else if (type == QMetaType::QJsonObject) {
- return v8::Value::fromV4Value(engine->jsonObjectToJS(*jsonObjectPtr));
+ return engine->jsonObjectToJS(*jsonObjectPtr);
} else if (type == QMetaType::QJsonValue) {
- return v8::Value::fromV4Value(engine->jsonValueToJS(*jsonValuePtr));
+ return engine->jsonValueToJS(*jsonValuePtr);
} else if (type == -1 || type == qMetaTypeId<QVariant>()) {
QVariant value = *qvariantPtr;
- v8::Handle<v8::Value> rv = engine->fromVariant(value);
- if (QObject *object = engine->toQObject(rv->v4Value()))
+ QV4::Value rv = engine->fromVariant(value);
+ if (QObject *object = engine->toQObject(rv))
QQmlData::get(object, true)->setImplicitDestructible();
return rv;
} else {
diff --git a/src/qml/qml/v8/qv8qobjectwrapper_p.h b/src/qml/qml/v8/qv8qobjectwrapper_p.h
index b0358cc1a7..0dd4b7f85b 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper_p.h
+++ b/src/qml/qml/v8/qv8qobjectwrapper_p.h
@@ -132,9 +132,9 @@ private:
static v8::Handle<v8::Integer> Query(v8::Handle<v8::String> property,
const v8::AccessorInfo &info);
static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> Connect(const v8::Arguments &args);
- static v8::Handle<v8::Value> Disconnect(const v8::Arguments &args);
- static v8::Handle<v8::Value> Invoke(const v8::Arguments &args);
+ static QV4::Value Connect(const v8::Arguments &args);
+ static QV4::Value Disconnect(const v8::Arguments &args);
+ static QV4::Value Invoke(const v8::Arguments &args);
static QPair<QObject *, int> ExtractQtMethod(QV8Engine *, v8::Handle<v8::Function>);
static QPair<QObject *, int> ExtractQtSignal(QV8Engine *, v8::Handle<v8::Object>);
static void WeakQObjectReferenceCallback(v8::Persistent<v8::Value> handle, void *wrapper);
diff --git a/src/qml/qml/v8/qv8sequencewrapper.cpp b/src/qml/qml/v8/qv8sequencewrapper.cpp
index 3f72697d9a..c4579fd73c 100644
--- a/src/qml/qml/v8/qv8sequencewrapper.cpp
+++ b/src/qml/qml/v8/qv8sequencewrapper.cpp
@@ -265,7 +265,7 @@ v8::Handle<v8::Value> QV8SequenceWrapper::SortGetter(v8::Handle<v8::String> prop
return info.Data();
}
-v8::Handle<v8::Value> QV8SequenceWrapper::Sort(const v8::Arguments &args)
+QV4::Value QV8SequenceWrapper::Sort(const v8::Arguments &args)
{
int argCount = args.Length();
@@ -283,24 +283,24 @@ v8::Handle<v8::Value> QV8SequenceWrapper::Sort(const v8::Arguments &args)
}
}
- return args.This();
+ return args.This()->v4Value();
}
-v8::Handle<v8::Value> QV8SequenceWrapper::ToString(const v8::Arguments &args)
+QV4::Value QV8SequenceWrapper::ToString(const v8::Arguments &args)
{
QV8SequenceResource *sr = v8_resource_cast<QV8SequenceResource>(args.This());
Q_ASSERT(sr);
return sr->toString();
}
-v8::Handle<v8::Value> QV8SequenceWrapper::ValueOf(const v8::Arguments &args)
+QV4::Value QV8SequenceWrapper::ValueOf(const v8::Arguments &args)
{
QV8SequenceResource *sr = v8_resource_cast<QV8SequenceResource>(args.This());
Q_ASSERT(sr);
- v8::Handle<v8::Value> tostringValue = sr->toString();
- if (!tostringValue.IsEmpty())
+ QV4::Value tostringValue = sr->toString();
+ if (!tostringValue.isUndefined())
return tostringValue;
- return v8::Integer::NewFromUnsigned(sr->lengthGetter());
+ return QV4::Value::fromUInt32(sr->lengthGetter());
}
v8::Handle<v8::Value> QV8SequenceWrapper::Getter(v8::Handle<v8::String> property,
diff --git a/src/qml/qml/v8/qv8sequencewrapper_p.h b/src/qml/qml/v8/qv8sequencewrapper_p.h
index e63d7af8c4..2408e4a2ae 100644
--- a/src/qml/qml/v8/qv8sequencewrapper_p.h
+++ b/src/qml/qml/v8/qv8sequencewrapper_p.h
@@ -99,13 +99,13 @@ private:
static v8::Handle<v8::Value> LengthGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info);
static void LengthSetter(v8::Handle<v8::String> property, v8::Handle<v8::Value> value, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> ToString(const v8::Arguments &args);
+ static QV4::Value ToString(const v8::Arguments &args);
static v8::Handle<v8::Value> ValueOfGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> SortGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> ValueOf(const v8::Arguments &args);
+ static QV4::Value ValueOf(const v8::Arguments &args);
static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, v8::Handle<v8::Value> value, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> Sort(const v8::Arguments &args);
+ static QV4::Value Sort(const v8::Arguments &args);
};
diff --git a/src/qml/qml/v8/qv8sequencewrapper_p_p.h b/src/qml/qml/v8/qv8sequencewrapper_p_p.h
index c8d61422e5..0924d106cd 100644
--- a/src/qml/qml/v8/qv8sequencewrapper_p_p.h
+++ b/src/qml/qml/v8/qv8sequencewrapper_p_p.h
@@ -87,7 +87,7 @@ public:
virtual v8::Handle<v8::Value> indexedGetter(quint32 index) = 0;
virtual v8::Handle<v8::Boolean> indexedDeleter(quint32 index) = 0;
virtual v8::Handle<v8::Array> indexedEnumerator() = 0;
- virtual v8::Handle<v8::Value> toString() = 0;
+ virtual QV4::Value toString() = 0;
virtual void sort(v8::Handle<v8::Function> comparer) = 0;
ObjectType objectType;
@@ -443,7 +443,7 @@ static QString convertUrlToString(QV8Engine *, const QUrl &v)
} \
return retn; \
} \
- v8::Handle<v8::Value> toString() \
+ QV4::Value toString() \
{ \
if (objectType == QV8SequenceResource::Reference) { \
if (!object) \
diff --git a/src/qml/qml/v8/qv8valuetypewrapper.cpp b/src/qml/qml/v8/qv8valuetypewrapper.cpp
index 1bc2c4b4a7..2215c99241 100644
--- a/src/qml/qml/v8/qv8valuetypewrapper.cpp
+++ b/src/qml/qml/v8/qv8valuetypewrapper.cpp
@@ -254,7 +254,7 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::ToStringGetter(v8::Handle<v8::String>
return info.Data();
}
-v8::Handle<v8::Value> QV8ValueTypeWrapper::ToString(const v8::Arguments &args)
+QV4::Value QV8ValueTypeWrapper::ToString(const v8::Arguments &args)
{
QV8ValueTypeResource *resource = v8_resource_cast<QV8ValueTypeResource>(args.This());
if (resource) {
diff --git a/src/qml/qml/v8/qv8valuetypewrapper_p.h b/src/qml/qml/v8/qv8valuetypewrapper_p.h
index 620f0bbc78..132ae1ad9c 100644
--- a/src/qml/qml/v8/qv8valuetypewrapper_p.h
+++ b/src/qml/qml/v8/qv8valuetypewrapper_p.h
@@ -87,7 +87,7 @@ public:
private:
static v8::Handle<v8::Value> ToStringGetter(v8::Handle<v8::String> property,
const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> ToString(const v8::Arguments &args);
+ static QV4::Value ToString(const v8::Arguments &args);
static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property,
const v8::AccessorInfo &info);
static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property,
diff --git a/src/qml/qml/v8/qv8variantwrapper.cpp b/src/qml/qml/v8/qv8variantwrapper.cpp
index c2c5988e0e..ffff9e4fd4 100644
--- a/src/qml/qml/v8/qv8variantwrapper.cpp
+++ b/src/qml/qml/v8/qv8variantwrapper.cpp
@@ -221,7 +221,7 @@ v8::Handle<v8::Value> QV8VariantWrapper::ValueOfGetter(v8::Handle<v8::String> pr
return info.Data();
}
-v8::Handle<v8::Value> QV8VariantWrapper::Preserve(const v8::Arguments &args)
+QV4::Value QV8VariantWrapper::Preserve(const v8::Arguments &args)
{
QV8VariantResource *resource = v8_resource_cast<QV8VariantResource>(args.This());
if (resource) {
@@ -230,7 +230,7 @@ v8::Handle<v8::Value> QV8VariantWrapper::Preserve(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> QV8VariantWrapper::Destroy(const v8::Arguments &args)
+QV4::Value QV8VariantWrapper::Destroy(const v8::Arguments &args)
{
QV8VariantResource *resource = v8_resource_cast<QV8VariantResource>(args.This());
if (resource) {
@@ -240,7 +240,7 @@ v8::Handle<v8::Value> QV8VariantWrapper::Destroy(const v8::Arguments &args)
return QV4::Value::undefinedValue();
}
-v8::Handle<v8::Value> QV8VariantWrapper::ToString(const v8::Arguments &args)
+QV4::Value QV8VariantWrapper::ToString(const v8::Arguments &args)
{
QV8VariantResource *resource = v8_resource_cast<QV8VariantResource>(args.This());
if (resource) {
@@ -253,7 +253,7 @@ v8::Handle<v8::Value> QV8VariantWrapper::ToString(const v8::Arguments &args)
}
}
-v8::Handle<v8::Value> QV8VariantWrapper::ValueOf(const v8::Arguments &args)
+QV4::Value QV8VariantWrapper::ValueOf(const v8::Arguments &args)
{
QV8VariantResource *resource = v8_resource_cast<QV8VariantResource>(args.This());
if (resource) {
@@ -266,14 +266,14 @@ v8::Handle<v8::Value> QV8VariantWrapper::ValueOf(const v8::Arguments &args)
case QVariant::Int:
case QVariant::Double:
case QVariant::UInt:
- return v8::Number::New(v.toDouble());
+ return QV4::Value::fromDouble(v.toDouble());
case QVariant::Bool:
- return v8::Boolean::New(v.toBool());
+ return QV4::Value::fromBoolean(v.toBool());
default:
break;
}
}
- return args.This();
+ return args.This()->v4Value();
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv8variantwrapper_p.h b/src/qml/qml/v8/qv8variantwrapper_p.h
index 125875ab24..a25d4917fc 100644
--- a/src/qml/qml/v8/qv8variantwrapper_p.h
+++ b/src/qml/qml/v8/qv8variantwrapper_p.h
@@ -90,10 +90,10 @@ private:
const v8::AccessorInfo &info);
static v8::Handle<v8::Value> ValueOfGetter(v8::Handle<v8::String> property,
const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> Preserve(const v8::Arguments &args);
- static v8::Handle<v8::Value> Destroy(const v8::Arguments &args);
- static v8::Handle<v8::Value> ToString(const v8::Arguments &args);
- static v8::Handle<v8::Value> ValueOf(const v8::Arguments &args);
+ static QV4::Value Preserve(const v8::Arguments &args);
+ static QV4::Value Destroy(const v8::Arguments &args);
+ static QV4::Value ToString(const v8::Arguments &args);
+ static QV4::Value ValueOf(const v8::Arguments &args);
QV8Engine *m_engine;
v8::Persistent<v8::Function> m_constructor;
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 3eb1461d5c..62a125de74 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -175,7 +175,7 @@ public:
int m_nextId;
- static v8::Handle<v8::Value> sendMessage(const v8::Arguments &args);
+ static QV4::Value sendMessage(const v8::Arguments &args);
signals:
void stopThread();
@@ -272,7 +272,7 @@ QQuickWorkerScriptEnginePrivate::QQuickWorkerScriptEnginePrivate(QQmlEngine *eng
{
}
-v8::Handle<v8::Value> QQuickWorkerScriptEnginePrivate::sendMessage(const v8::Arguments &args)
+QV4::Value QQuickWorkerScriptEnginePrivate::sendMessage(const v8::Arguments &args)
{
WorkerEngine *engine = (WorkerEngine*)V8ENGINE();
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 8bf44a2077..196394f253 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -60,6 +60,7 @@
#include <qqmlengine.h>
#include <private/qv4domerrors_p.h>
+#include <private/qv4engine_p.h>
#include <QtCore/qnumeric.h>
#include <private/qquickwindow_p.h>
@@ -114,7 +115,7 @@ static const double Q_PI = 3.14159265358979323846; // pi
#define DEGREES(t) ((t) * 180.0 / Q_PI)
#define CHECK_CONTEXT(r) if (!r || !r->context || !r->context->bufferValid()) \
- V8THROW_ERROR("Not a Context2D object");
+ V4THROW_ERROR("Not a Context2D object");
#define CHECK_CONTEXT_SETTER(r) if (!r || !r->context || !r->context->bufferValid()) \
V8THROW_ERROR_SETTER("Not a Context2D object");
@@ -422,7 +423,7 @@ static QString qt_composite_mode_to_string(QPainter::CompositionMode op)
}
-static v8::Handle<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
+static QV4::Value qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
{
QQuickContext2DEngineData *ed = engineData(engine);
v8::Handle<v8::Object> imageData = ed->constructorImageData->NewInstance();
@@ -438,7 +439,7 @@ static v8::Handle<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine*
pixelData->SetExternalResource(r);
imageData->SetInternalField(0, pixelData);
- return imageData;
+ return imageData->v4Value();
}
//static script functions
@@ -466,27 +467,27 @@ static v8::Handle<v8::Value> ctx2d_canvas(v8::Handle<v8::String>, const v8::Acce
\sa save()
*/
-static v8::Handle<v8::Value> ctx2d_restore(const v8::Arguments &args)
+static QV4::Value ctx2d_restore(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->popState();
- return args.This();
+ return args.ThisV4();
}
/*!
\qmlmethod object QtQuick2::Context2D::reset()
Resets the context state and properties to the default values.
*/
-static v8::Handle<v8::Value> ctx2d_reset(const v8::Arguments &args)
+static QV4::Value ctx2d_reset(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->reset();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -519,14 +520,14 @@ static v8::Handle<v8::Value> ctx2d_reset(const v8::Arguments &args)
The current path is NOT part of the drawing state. The path can be reset by
invoking the beginPath() method.
*/
-static v8::Handle<v8::Value> ctx2d_save(const v8::Arguments &args)
+static QV4::Value ctx2d_save(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->pushState();
- return args.This();
+ return args.ThisV4();
}
// transformations
@@ -545,14 +546,14 @@ static v8::Handle<v8::Value> ctx2d_save(const v8::Arguments &args)
where the \c angle of rotation is in radians.
*/
-static v8::Handle<v8::Value> ctx2d_rotate(const v8::Arguments &args)
+static QV4::Value ctx2d_rotate(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
if (args.Length() == 1)
r->context->rotate(args[0]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -569,7 +570,7 @@ static v8::Handle<v8::Value> ctx2d_rotate(const v8::Arguments &args)
\image qml-item-canvas-scale.png
*/
-static v8::Handle<v8::Value> ctx2d_scale(const v8::Arguments &args)
+static QV4::Value ctx2d_scale(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -577,7 +578,7 @@ static v8::Handle<v8::Value> ctx2d_scale(const v8::Arguments &args)
if (args.Length() == 2)
r->context->scale(args[0]->NumberValue(), args[1]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -613,7 +614,7 @@ static v8::Handle<v8::Value> ctx2d_scale(const v8::Arguments &args)
\sa transform()
*/
-static v8::Handle<v8::Value> ctx2d_setTransform(const v8::Arguments &args)
+static QV4::Value ctx2d_setTransform(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -627,7 +628,7 @@ static v8::Handle<v8::Value> ctx2d_setTransform(const v8::Arguments &args)
, args[4]->NumberValue()
, args[5]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -640,7 +641,7 @@ static v8::Handle<v8::Value> ctx2d_setTransform(const v8::Arguments &args)
\sa setTransform()
*/
-static v8::Handle<v8::Value> ctx2d_transform(const v8::Arguments &args)
+static QV4::Value ctx2d_transform(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -654,7 +655,7 @@ static v8::Handle<v8::Value> ctx2d_transform(const v8::Arguments &args)
, args[4]->NumberValue()
, args[5]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -666,7 +667,7 @@ static v8::Handle<v8::Value> ctx2d_transform(const v8::Arguments &args)
Translating the origin enables you to draw patterns of different objects on the canvas
without having to measure the coordinates manually for each shape.
*/
-static v8::Handle<v8::Value> ctx2d_translate(const v8::Arguments &args)
+static QV4::Value ctx2d_translate(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -674,7 +675,7 @@ static v8::Handle<v8::Value> ctx2d_translate(const v8::Arguments &args)
if (args.Length() == 2)
r->context->translate(args[0]->NumberValue(), args[1]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
@@ -684,14 +685,14 @@ static v8::Handle<v8::Value> ctx2d_translate(const v8::Arguments &args)
\sa transform(), setTransform(), reset()
*/
-static v8::Handle<v8::Value> ctx2d_resetTransform(const v8::Arguments &args)
+static QV4::Value ctx2d_resetTransform(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->setTransform(1, 0, 0, 1, 0, 0);
- return args.This();
+ return args.ThisV4();
}
@@ -699,7 +700,7 @@ static v8::Handle<v8::Value> ctx2d_resetTransform(const v8::Arguments &args)
\qmlmethod object QtQuick2::Context2D::shear(real sh, real sv )
Shear the transformation matrix with \a sh in horizontal direction and \a sv in vertical direction.
*/
-static v8::Handle<v8::Value> ctx2d_shear(const v8::Arguments &args)
+static QV4::Value ctx2d_shear(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -707,7 +708,7 @@ static v8::Handle<v8::Value> ctx2d_shear(const v8::Arguments &args)
if (args.Length() == 2)
r->context->shear(args[0]->NumberValue(), args[1]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
// compositing
@@ -992,7 +993,7 @@ static void ctx2d_strokeStyle_set(v8::Handle<v8::String>, v8::Handle<v8::Value>
\sa strokeStyle
*/
-static v8::Handle<v8::Value> ctx2d_createLinearGradient(const v8::Arguments &args)
+static QV4::Value ctx2d_createLinearGradient(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1014,15 +1015,15 @@ static v8::Handle<v8::Value> ctx2d_createLinearGradient(const v8::Arguments &arg
|| !qIsFinite(x1)
|| !qIsFinite(y1)) {
delete r;
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createLinearGradient(): Incorrect arguments")
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createLinearGradient(): Incorrect arguments")
}
r->brush = QLinearGradient(x0, y0, x1, y1);
gradient->SetExternalResource(r);
- return gradient;
+ return gradient->v4Value();
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1038,7 +1039,7 @@ static v8::Handle<v8::Value> ctx2d_createLinearGradient(const v8::Arguments &arg
\sa strokeStyle
*/
-static v8::Handle<v8::Value> ctx2d_createRadialGradient(const v8::Arguments &args)
+static QV4::Value ctx2d_createRadialGradient(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1065,19 +1066,19 @@ static v8::Handle<v8::Value> ctx2d_createRadialGradient(const v8::Arguments &arg
|| !qIsFinite(r1)
|| !qIsFinite(y1)) {
delete r;
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createRadialGradient(): Incorrect arguments")
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createRadialGradient(): Incorrect arguments")
}
if (r0 < 0 || r1 < 0)
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createRadialGradient(): Incorrect arguments")
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createRadialGradient(): Incorrect arguments")
r->brush = QRadialGradient(QPointF(x1, y1), r0+r1, QPointF(x0, y0));
gradient->SetExternalResource(r);
- return gradient;
+ return gradient->v4Value();
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1093,7 +1094,7 @@ static v8::Handle<v8::Value> ctx2d_createRadialGradient(const v8::Arguments &arg
\sa strokeStyle
*/
-static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &args)
+static QV4::Value ctx2d_createConicalGradient(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1111,20 +1112,20 @@ static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &ar
qreal angle = DEGREES(args[2]->NumberValue());
if (!qIsFinite(x) || !qIsFinite(y)) {
delete r;
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createConicalGradient(): Incorrect arguments");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createConicalGradient(): Incorrect arguments");
}
if (!qIsFinite(angle)) {
delete r;
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createConicalGradient(): Incorrect arguments");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createConicalGradient(): Incorrect arguments");
}
r->brush = QConicalGradient(x, y, angle);
gradient->SetExternalResource(r);
- return gradient;
+ return gradient->v4Value();
}
- return args.This();
+ return args.ThisV4();
}
/*!
\qmlmethod variant QtQuick2::Context2D::createPattern(color color, enumeration patternMode)
@@ -1169,7 +1170,7 @@ static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &ar
\sa strokeStyle
\sa fillStyle
*/
-static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args)
+static QV4::Value ctx2d_createPattern(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1224,7 +1225,7 @@ static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args)
v8::Handle<v8::Object> pattern = ed->constructorPattern->NewInstance();
pattern->SetExternalResource(styleResouce);
- return pattern;
+ return pattern->v4Value();
}
return QV4::Value::undefinedValue();
@@ -1531,7 +1532,7 @@ static void ctx2d_path_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value,
\qmlmethod object QtQuick2::Context2D::clearRect(real x, real y, real w, real h)
Clears all pixels on the canvas in the given rectangle to transparent black.
*/
-static v8::Handle<v8::Value> ctx2d_clearRect(const v8::Arguments &args)
+static QV4::Value ctx2d_clearRect(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1543,7 +1544,7 @@ static v8::Handle<v8::Value> ctx2d_clearRect(const v8::Arguments &args)
args[2]->NumberValue(),
args[3]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
\qmlmethod object QtQuick2::Context2D::fillRect(real x, real y, real w, real h)
@@ -1551,14 +1552,14 @@ static v8::Handle<v8::Value> ctx2d_clearRect(const v8::Arguments &args)
\sa fillStyle
*/
-static v8::Handle<v8::Value> ctx2d_fillRect(const v8::Arguments &args)
+static QV4::Value ctx2d_fillRect(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
if (args.Length() == 4)
r->context->fillRect(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), args[3]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1571,7 +1572,7 @@ static v8::Handle<v8::Value> ctx2d_fillRect(const v8::Arguments &args)
\sa lineJoin
\sa miterLimit
*/
-static v8::Handle<v8::Value> ctx2d_strokeRect(const v8::Arguments &args)
+static QV4::Value ctx2d_strokeRect(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1579,7 +1580,7 @@ static v8::Handle<v8::Value> ctx2d_strokeRect(const v8::Arguments &args)
if (args.Length() == 4)
r->context->strokeRect(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), args[3]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
// Complex shapes (paths) API
@@ -1590,7 +1591,7 @@ static v8::Handle<v8::Value> ctx2d_strokeRect(const v8::Arguments &args)
\sa arcTo,
{http://www.w3.org/TR/2dcontext/#dom-context-2d-arc}{W3C 2d context standard for arc}
*/
-static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
+static QV4::Value ctx2d_arc(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1604,7 +1605,7 @@ static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
qreal radius = args[2]->NumberValue();
if (qIsFinite(radius) && radius < 0)
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
r->context->arc(args[0]->NumberValue(),
args[1]->NumberValue(),
@@ -1614,7 +1615,7 @@ static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
antiClockwise);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1637,7 +1638,7 @@ static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
\sa arc, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto}{W3C 2d
context standard for arcTo}
*/
-static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args)
+static QV4::Value ctx2d_arcTo(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1646,7 +1647,7 @@ static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args)
qreal radius = args[4]->NumberValue();
if (qIsFinite(radius) && radius < 0)
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
r->context->arcTo(args[0]->NumberValue(),
args[1]->NumberValue(),
@@ -1655,7 +1656,7 @@ static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args)
radius);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1663,7 +1664,7 @@ static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args)
Resets the current path to a new path.
*/
-static v8::Handle<v8::Value> ctx2d_beginPath(const v8::Arguments &args)
+static QV4::Value ctx2d_beginPath(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1671,7 +1672,7 @@ static v8::Handle<v8::Value> ctx2d_beginPath(const v8::Arguments &args)
r->context->beginPath();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1693,7 +1694,7 @@ static v8::Handle<v8::Value> ctx2d_beginPath(const v8::Arguments &args)
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto}{W3C 2d context standard for bezierCurveTo}
\sa {http://www.openrise.com/lab/FlowerPower/}{The beautiful flower demo by using bezierCurveTo}
*/
-static v8::Handle<v8::Value> ctx2d_bezierCurveTo(const v8::Arguments &args)
+static QV4::Value ctx2d_bezierCurveTo(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1708,12 +1709,12 @@ static v8::Handle<v8::Value> ctx2d_bezierCurveTo(const v8::Arguments &args)
qreal y = args[5]->NumberValue();
if (!qIsFinite(cp1x) || !qIsFinite(cp1y) || !qIsFinite(cp2x) || !qIsFinite(cp2y) || !qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
r->context->bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1740,13 +1741,13 @@ static v8::Handle<v8::Value> ctx2d_bezierCurveTo(const v8::Arguments &args)
\sa fill()
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-clip}{W3C 2d context standard for clip}
*/
-static v8::Handle<v8::Value> ctx2d_clip(const v8::Arguments &args)
+static QV4::Value ctx2d_clip(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->clip();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1756,7 +1757,7 @@ static v8::Handle<v8::Value> ctx2d_clip(const v8::Arguments &args)
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-closepath}{W3C 2d context standard for closePath}
*/
-static v8::Handle<v8::Value> ctx2d_closePath(const v8::Arguments &args)
+static QV4::Value ctx2d_closePath(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1764,7 +1765,7 @@ static v8::Handle<v8::Value> ctx2d_closePath(const v8::Arguments &args)
r->context->closePath();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1776,12 +1777,12 @@ static v8::Handle<v8::Value> ctx2d_closePath(const v8::Arguments &args)
\sa fillStyle
*/
-static v8::Handle<v8::Value> ctx2d_fill(const v8::Arguments &args)
+static QV4::Value ctx2d_fill(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r);
r->context->fill();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1789,7 +1790,7 @@ static v8::Handle<v8::Value> ctx2d_fill(const v8::Arguments &args)
Draws a line from the current position to the point (x, y).
*/
-static v8::Handle<v8::Value> ctx2d_lineTo(const v8::Arguments &args)
+static QV4::Value ctx2d_lineTo(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1800,12 +1801,12 @@ static v8::Handle<v8::Value> ctx2d_lineTo(const v8::Arguments &args)
qreal y = args[1]->NumberValue();
if (!qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
r->context->lineTo(x, y);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1813,7 +1814,7 @@ static v8::Handle<v8::Value> ctx2d_lineTo(const v8::Arguments &args)
Creates a new subpath with the given point.
*/
-static v8::Handle<v8::Value> ctx2d_moveTo(const v8::Arguments &args)
+static QV4::Value ctx2d_moveTo(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1823,10 +1824,10 @@ static v8::Handle<v8::Value> ctx2d_moveTo(const v8::Arguments &args)
qreal y = args[1]->NumberValue();
if (!qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
r->context->moveTo(x, y);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1836,7 +1837,7 @@ static v8::Handle<v8::Value> ctx2d_moveTo(const v8::Arguments &args)
See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for for quadraticCurveTo}
*/
-static v8::Handle<v8::Value> ctx2d_quadraticCurveTo(const v8::Arguments &args)
+static QV4::Value ctx2d_quadraticCurveTo(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1848,12 +1849,12 @@ static v8::Handle<v8::Value> ctx2d_quadraticCurveTo(const v8::Arguments &args)
qreal y = args[3]->NumberValue();
if (!qIsFinite(cpx) || !qIsFinite(cpy) || !qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
r->context->quadraticCurveTo(cpx, cpy, x, y);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1861,14 +1862,14 @@ static v8::Handle<v8::Value> ctx2d_quadraticCurveTo(const v8::Arguments &args)
Adds a rectangle at position (\c x, \c y), with the given width \c w and height \c h, as a closed subpath.
*/
-static v8::Handle<v8::Value> ctx2d_rect(const v8::Arguments &args)
+static QV4::Value ctx2d_rect(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
if (args.Length() == 4)
r->context->rect(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), args[3]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1877,7 +1878,7 @@ static v8::Handle<v8::Value> ctx2d_rect(const v8::Arguments &args)
Adds the given rectangle rect with rounded corners to the path. The \c xRadius and \c yRadius arguments specify the radius of the
ellipses defining the corners of the rounded rectangle.
*/
-static v8::Handle<v8::Value> ctx2d_roundedRect(const v8::Arguments &args)
+static QV4::Value ctx2d_roundedRect(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1889,7 +1890,7 @@ static v8::Handle<v8::Value> ctx2d_roundedRect(const v8::Arguments &args)
, args[3]->NumberValue()
, args[4]->NumberValue()
, args[5]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1900,7 +1901,7 @@ static v8::Handle<v8::Value> ctx2d_roundedRect(const v8::Arguments &args)
The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).
*/
-static v8::Handle<v8::Value> ctx2d_ellipse(const v8::Arguments &args)
+static QV4::Value ctx2d_ellipse(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1909,7 +1910,7 @@ static v8::Handle<v8::Value> ctx2d_ellipse(const v8::Arguments &args)
if (args.Length() == 4)
r->context->ellipse(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), args[3]->NumberValue());
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1918,7 +1919,7 @@ static v8::Handle<v8::Value> ctx2d_ellipse(const v8::Arguments &args)
Adds the given \c text to the path as a set of closed subpaths created from the current context font supplied.
The subpaths are positioned so that the left end of the text's baseline lies at the point specified by (\c x, \c y).
*/
-static v8::Handle<v8::Value> ctx2d_text(const v8::Arguments &args)
+static QV4::Value ctx2d_text(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1928,10 +1929,10 @@ static v8::Handle<v8::Value> ctx2d_text(const v8::Arguments &args)
qreal y = args[2]->NumberValue();
if (!qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
r->context->text(args[0]->v4Value().toQString(), x, y);
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1943,13 +1944,13 @@ static v8::Handle<v8::Value> ctx2d_text(const v8::Arguments &args)
\sa strokeStyle
*/
-static v8::Handle<v8::Value> ctx2d_stroke(const v8::Arguments &args)
+static QV4::Value ctx2d_stroke(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
r->context->stroke();
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -1959,7 +1960,7 @@ static v8::Handle<v8::Value> ctx2d_stroke(const v8::Arguments &args)
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-ispointinpath}{W3C 2d context standard for isPointInPath}
*/
-static v8::Handle<v8::Value> ctx2d_isPointInPath(const v8::Arguments &args)
+static QV4::Value ctx2d_isPointInPath(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -1967,28 +1968,28 @@ static v8::Handle<v8::Value> ctx2d_isPointInPath(const v8::Arguments &args)
bool pointInPath = false;
if (args.Length() == 2)
pointInPath = r->context->isPointInPath(args[0]->NumberValue(), args[1]->NumberValue());
- return v8::Boolean::New(pointInPath);
+ return QV4::Value::fromBoolean(pointInPath);
}
-static v8::Handle<v8::Value> ctx2d_drawFocusRing(const v8::Arguments &args)
+static QV4::Value ctx2d_drawFocusRing(const v8::Arguments &args)
{
Q_UNUSED(args);
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::drawFocusRing is not supported");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::drawFocusRing is not supported");
}
-static v8::Handle<v8::Value> ctx2d_setCaretSelectionRect(const v8::Arguments &args)
+static QV4::Value ctx2d_setCaretSelectionRect(const v8::Arguments &args)
{
Q_UNUSED(args);
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::setCaretSelectionRect is not supported");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::setCaretSelectionRect is not supported");
}
-static v8::Handle<v8::Value> ctx2d_caretBlinkRate(const v8::Arguments &args)
+static QV4::Value ctx2d_caretBlinkRate(const v8::Arguments &args)
{
Q_UNUSED(args);
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::caretBlinkRate is not supported");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::caretBlinkRate is not supported");
}
// text
/*!
@@ -2153,7 +2154,7 @@ static void ctx2d_textBaseline_set(v8::Handle<v8::String>, v8::Handle<v8::Value>
\sa textBaseline
\sa strokeText
*/
-static v8::Handle<v8::Value> ctx2d_fillText(const v8::Arguments &args)
+static QV4::Value ctx2d_fillText(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2162,11 +2163,11 @@ static v8::Handle<v8::Value> ctx2d_fillText(const v8::Arguments &args)
qreal x = args[1]->NumberValue();
qreal y = args[2]->NumberValue();
if (!qIsFinite(x) || !qIsFinite(y))
- return args.This();
+ return args.ThisV4();
QPainterPath textPath = r->context->createTextGlyphs(x, y, args[0]->v4Value().toQString());
r->context->buffer()->fill(textPath);
}
- return args.This();
+ return args.ThisV4();
}
/*!
\qmlmethod object QtQuick2::Context2D::strokeText(text, x, y)
@@ -2176,14 +2177,14 @@ static v8::Handle<v8::Value> ctx2d_fillText(const v8::Arguments &args)
\sa textBaseline
\sa fillText
*/
-static v8::Handle<v8::Value> ctx2d_strokeText(const v8::Arguments &args)
+static QV4::Value ctx2d_strokeText(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
if (args.Length() == 3)
r->context->drawText(args[0]->v4Value().toQString(), args[1]->NumberValue(), args[2]->NumberValue(), false);
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -2210,7 +2211,7 @@ static v8::Handle<v8::Value> ctx2d_strokeText(const v8::Arguments &args)
\qmlmethod variant QtQuick2::Context2D::measureText(text)
Returns a TextMetrics object with the metrics of the given text in the current font.
*/
-static v8::Handle<v8::Value> ctx2d_measureText(const v8::Arguments &args)
+static QV4::Value ctx2d_measureText(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2218,9 +2219,9 @@ static v8::Handle<v8::Value> ctx2d_measureText(const v8::Arguments &args)
if (args.Length() == 1) {
QFontMetrics fm(r->context->state.font);
uint width = fm.width(args[0]->v4Value().toQString());
- v8::Handle<v8::Object> tm = v8::Object::New();
- tm->Set(v8::String::New("width"), v8::Number::New(width));
- return tm;
+ QV4::Object *tm = v8::Isolate::GetEngine()->newObject();
+ tm->put(v8::Isolate::GetEngine()->current, v8::Isolate::GetEngine()->newIdentifier(QStringLiteral("width")), QV4::Value::fromDouble(width));
+ return QV4::Value::fromObject(tm);
}
return QV4::Value::undefinedValue();
}
@@ -2284,7 +2285,7 @@ static v8::Handle<v8::Value> ctx2d_measureText(const v8::Arguments &args)
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage}{W3C 2d context standard for drawImage}
*/
-static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
+static QV4::Value ctx2d_drawImage(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2293,18 +2294,18 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
qreal sx, sy, sw, sh, dx, dy, dw, dh;
if (!args.Length())
- return args.This();
+ return args.ThisV4();
//FIXME:This function should be moved to QQuickContext2D::drawImage(...)
if (!r->context->state.invertibleCTM)
- return args.This();
+ return args.ThisV4();
QQmlRefPointer<QQuickCanvasPixmap> pixmap;
if (args[0]->IsString()) {
QUrl url(args[0]->v4Value().toQString());
if (!url.isValid())
- V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
pixmap = r->context->createPixmap(url);
} else if (args[0]->IsObject()) {
@@ -2321,14 +2322,14 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
if (!img.isNull())
pixmap.take(new QQuickCanvasPixmap(img, canvas->window()));
} else {
- V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
} else {
- V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
if (pixmap.isNull() || !pixmap->isValid())
- return args.This();
+ return args.ThisV4();
if (args.Length() == 3) {
dx = args[1]->NumberValue();
@@ -2358,7 +2359,7 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
dw = args[7]->NumberValue();
dh = args[8]->NumberValue();
} else {
- return args.This();
+ return args.ThisV4();
}
if (!qIsFinite(sx)
@@ -2369,7 +2370,7 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
|| !qIsFinite(dy)
|| !qIsFinite(dw)
|| !qIsFinite(dh))
- return args.This();
+ return args.ThisV4();
if (sx < 0
|| sy < 0
@@ -2378,12 +2379,12 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
|| sx + sw > pixmap->width()
|| sy + sh > pixmap->height()
|| sx + sw < 0 || sy + sh < 0) {
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "drawImage(), index size error");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "drawImage(), index size error");
}
r->context->buffer()->drawPixmap(pixmap, QRectF(sx, sy, sw, sh), QRectF(dx, dy, dw, dh));
- return args.This();
+ return args.ThisV4();
}
// pixel manipulation
@@ -2535,7 +2536,7 @@ v8::Handle<v8::Value> ctx2d_pixelArray_indexed_set(uint32_t index, v8::Handle<v8
\sa Canvas::loadImage(), QtQuick2::Canvas::unloadImage(), QtQuick2::Canvas::isImageLoaded
*/
-static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args)
+static QV4::Value ctx2d_createImageData(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2560,12 +2561,12 @@ static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args)
qreal h = args[1]->NumberValue();
if (!qIsFinite(w) || !qIsFinite(h))
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createImageData(): invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createImageData(): invalid arguments");
if (w > 0 && h > 0)
return qt_create_image_data(w, h, engine, QImage());
else
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createImageData(): invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createImageData(): invalid arguments");
}
return QV4::Value::undefinedValue();
}
@@ -2574,7 +2575,7 @@ static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args)
\qmlmethod CanvasImageData QtQuick2::Canvas::getImageData(real sx, real sy, real sw, real sh)
Returns an CanvasImageData object containing the image data for the given rectangle of the canvas.
*/
-static v8::Handle<v8::Value> ctx2d_getImageData(const v8::Arguments &args)
+static QV4::Value ctx2d_getImageData(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2586,13 +2587,13 @@ static v8::Handle<v8::Value> ctx2d_getImageData(const v8::Arguments &args)
qreal w = args[2]->NumberValue();
qreal h = args[3]->NumberValue();
if (!qIsFinite(x) || !qIsFinite(y) || !qIsFinite(w) || !qIsFinite(w))
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "getImageData(): Invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "getImageData(): Invalid arguments");
if (w <= 0 || h <= 0)
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments");
QImage image = r->context->canvas()->toImage(QRectF(x, y, w, h));
- v8::Handle<v8::Object> imageData = qt_create_image_data(w, h, engine, image);
+ QV4::Value imageData = qt_create_image_data(w, h, engine, image);
return imageData;
}
@@ -2603,7 +2604,7 @@ static v8::Handle<v8::Value> ctx2d_getImageData(const v8::Arguments &args)
\qmlmethod object QtQuick2::Context2D::putImageData(CanvasImageData imageData, real dx, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight)
Paints the data from the given ImageData object onto the canvas. If a dirty rectangle (\a dirtyX, \a dirtyY, \a dirtyWidth, \a dirtyHeight) is provided, only the pixels from that rectangle are painted.
*/
-static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
+static QV4::Value ctx2d_putImageData(const v8::Arguments &args)
{
QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(args.This());
CHECK_CONTEXT(r)
@@ -2611,14 +2612,14 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
return QV4::Value::undefinedValue();
if (args[0]->IsNull() || !args[0]->IsObject()) {
- V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "Context2D::putImageData, the image data type mismatch");
+ V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "Context2D::putImageData, the image data type mismatch");
}
qreal dx = args[1]->NumberValue();
qreal dy = args[2]->NumberValue();
qreal w, h, dirtyX, dirtyY, dirtyWidth, dirtyHeight;
if (!qIsFinite(dx) || !qIsFinite(dy))
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
v8::Handle<v8::Object> imageData = args[0]->ToObject();
QV8Context2DPixelArrayResource *pixelArray = v8_resource_cast<QV8Context2DPixelArrayResource>(imageData->Get(v8::String::New("data"))->ToObject());
@@ -2633,7 +2634,7 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
dirtyHeight = args[6]->NumberValue();
if (!qIsFinite(dirtyX) || !qIsFinite(dirtyY) || !qIsFinite(dirtyWidth) || !qIsFinite(dirtyHeight))
- V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
+ V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
if (dirtyWidth < 0) {
@@ -2665,7 +2666,7 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
}
if (dirtyWidth <=0 || dirtyHeight <= 0)
- return args.This();
+ return args.ThisV4();
} else {
dirtyX = 0;
dirtyY = 0;
@@ -2676,7 +2677,7 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
QImage image = pixelArray->image.copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
r->context->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight));
}
- return args.This();
+ return args.ThisV4();
}
/*!
@@ -2699,18 +2700,18 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args)
gradient.addColorStop(0.7, 'rgba(0, 255, 255, 1');
\endcode
*/
-static v8::Handle<v8::Value> ctx2d_gradient_addColorStop(const v8::Arguments &args)
+static QV4::Value ctx2d_gradient_addColorStop(const v8::Arguments &args)
{
QV8Context2DStyleResource *style = v8_resource_cast<QV8Context2DStyleResource>(args.This());
if (!style)
- V8THROW_ERROR("Not a CanvasGradient object");
+ V4THROW_ERROR("Not a CanvasGradient object");
QV8Engine *engine = V8ENGINE();
if (args.Length() == 2) {
if (!style->brush.gradient())
- V8THROW_ERROR("Not a valid CanvasGradient object, can't get the gradient information");
+ V4THROW_ERROR("Not a valid CanvasGradient object, can't get the gradient information");
QGradient gradient = *(style->brush.gradient());
qreal pos = args[0]->NumberValue();
QColor color;
@@ -2721,18 +2722,18 @@ static v8::Handle<v8::Value> ctx2d_gradient_addColorStop(const v8::Arguments &ar
color = qt_color_from_string(args[1]);
}
if (pos < 0.0 || pos > 1.0 || !qIsFinite(pos)) {
- V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "CanvasGradient: parameter offset out of range");
+ V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "CanvasGradient: parameter offset out of range");
}
if (color.isValid()) {
gradient.setColorAt(pos, color);
} else {
- V8THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "CanvasGradient: parameter color is not a valid color string");
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "CanvasGradient: parameter color is not a valid color string");
}
style->brush = gradient;
}
- return args.This();
+ return args.ThisV4();
}
void QQuickContext2D::scale(qreal x, qreal y)
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index b973d44012..f52c9b0352 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -52,7 +52,6 @@ PRIVATETESTS += \
qquickworkerscript \
qqmlbundle \
qrcqml \
- v4 \
qqmltimer \
qqmlinstantiator
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 51ecb0481a..364359f1b8 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -50,7 +50,6 @@
#include <QtCore/qnumeric.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlvmemetaobject_p.h>
-#include <private/qv4compiler_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
#include "../../shared/util.h"
@@ -2170,7 +2169,7 @@ static inline bool evaluate_error(QV8Engine *engine, v8::Handle<v8::Object> o, c
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
v8::TryCatch tc;
- v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ v8::Handle<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
if (tc.HasCaught())
return false;
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
@@ -2187,7 +2186,7 @@ static inline bool evaluate_value(QV8Engine *engine, v8::Handle<v8::Object> o,
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
v8::TryCatch tc;
- v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ v8::Handle<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
if (tc.HasCaught())
return false;
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
@@ -2209,7 +2208,7 @@ static inline v8::Handle<v8::Value> evaluate(QV8Engine *engine, v8::Handle<v8::O
QString functionSource = QLatin1String("(function(object) { return ") +
QLatin1String(source) + QLatin1String(" })");
v8::TryCatch tc;
- v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ v8::Handle<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
if (tc.HasCaught())
return v8::Handle<v8::Value>();
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
@@ -2239,10 +2238,7 @@ void tst_qqmlecmascript::callQtInvokables()
QV8Engine *engine = ep->v8engine();
- v8::HandleScope handle_scope;
- v8::Context::Scope scope(engine->context());
-
- v8::Local<v8::Object> object = engine->newQObject(o)->ToObject();
+ v8::Handle<v8::Object> object = engine->newQObject(o);
// Non-existent methods
o->reset();
@@ -2309,7 +2305,7 @@ void tst_qqmlecmascript::callQtInvokables()
{
v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QPointF()");
QVERIFY(!ret.IsEmpty());
- QCOMPARE(engine->toVariant(ret, -1), QVariant(QPointF(123, 4.5)));
+ QCOMPARE(engine->toVariant(ret->v4Value(), -1), QVariant(QPointF(123, 4.5)));
QCOMPARE(o->error(), false);
QCOMPARE(o->invoked(), 3);
QCOMPARE(o->actuals().count(), 0);
@@ -2318,7 +2314,7 @@ void tst_qqmlecmascript::callQtInvokables()
o->reset();
{
v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QObject()");
- QCOMPARE(engine->toQObject(ret), (QObject *)o);
+ QCOMPARE(engine->toQObject(ret->v4Value()), (QObject *)o);
QCOMPARE(o->error(), false);
QCOMPARE(o->invoked(), 4);
QCOMPARE(o->actuals().count(), 0);
@@ -2334,7 +2330,7 @@ void tst_qqmlecmascript::callQtInvokables()
{
v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QScriptValue()");
QVERIFY(ret->IsString());
- QCOMPARE(engine->toString(ret), QString("Hello world"));
+ QCOMPARE(ret->v4Value().toQString(), QString("Hello world"));
QCOMPARE(o->error(), false);
QCOMPARE(o->invoked(), 6);
QCOMPARE(o->actuals().count(), 0);
@@ -3785,16 +3781,11 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
scriptContext = engine->contextWrapper()->context(qmlglobal);
{
- v8::HandleScope handle_scope;
- v8::Persistent<v8::Context> context = v8::Context::New();
- v8::Context::Scope context_scope(context);
- v8::Local<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
+ v8::Handle<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
Q_UNUSED(temporaryScope)
-
- context.Dispose();
}
- QV8Engine::gc();
+ engine->gc();
newContext = engine->contextWrapper()->context(qmlglobal);
QVERIFY(scriptContext == newContext);
}
@@ -4875,7 +4866,6 @@ void tst_qqmlecmascript::propertyVarInheritance()
v8::Persistent<v8::Value> icoCanaryHandle;
v8::Persistent<v8::Value> ccoCanaryHandle;
{
- v8::HandleScope hs;
// XXX NOTE: this is very implementation dependent. QDVMEMO->vmeProperty() is the only
// public function which can return us a handle to something in the varProperties array.
icoCanaryHandle = qPersistentNew(icovmemo->vmeProperty(ico5->metaObject()->indexOfProperty("circ")));
@@ -4919,7 +4909,6 @@ void tst_qqmlecmascript::propertyVarInheritance2()
QCOMPARE(childObject->property("textCanary").toInt(), 10);
v8::Persistent<v8::Value> childObjectVarArrayValueHandle;
{
- v8::HandleScope hs;
propertyVarWeakRefCallbackCount = 0; // reset callback count.
childObjectVarArrayValueHandle = qPersistentNew(QQmlVMEMetaObject::get(childObject)->vmeProperty(childObject->metaObject()->indexOfProperty("vp")));
childObjectVarArrayValueHandle.MakeWeak(&propertyVarWeakRefCallbackCount, propertyVarWeakRefCallback);
@@ -6672,9 +6661,7 @@ void tst_qqmlecmascript::doubleEvaluate()
void tst_qqmlecmascript::nonNotifyable()
{
- QV4Compiler::enableV4(false);
QQmlComponent component(&engine, testFileUrl("nonNotifyable.qml"));
- QV4Compiler::enableV4(true);
QQmlTestMessageHandler messageHandler;
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 8d8b913df7..7a59a7f243 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -323,15 +323,6 @@ void tst_qqmlinstruction::dump()
}
{
- QQmlCompiledData::Instruction::StoreV4Binding i;
- i.property = 27;
- i.value = 2;
- i.context = 4;
- i.owner = 0;
- data->addInstruction(i);
- }
-
- {
QQmlCompiledData::Instruction::StoreValueSource i;
i.property.coreIndex = 29;
i.castValue = 4;
@@ -531,32 +522,31 @@ void tst_qqmlinstruction::dump()
<< "29\t\tASSIGN_SIGNAL_OBJECT\t4"
<< "30\t\tASSIGN_CUSTOMTYPE\t25\t6\t9"
<< "31\t\tSTORE_BINDING\t26\t3\t2"
- << "32\t\tSTORE_COMPILED_BINDING\t27\t2\t4"
- << "33\t\tSTORE_VALUE_SOURCE\t29\t4"
- << "34\t\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
- << "35\t\tBEGIN\t\t\t4"
- << "36\t\tSTORE_OBJECT_QLIST"
- << "37\t\tASSIGN_OBJECT_LIST"
- << "38\t\tFETCH_ATTACHED\t\t23"
- << "39\t\tFETCH_QLIST\t\t32"
- << "40\t\tFETCH\t\t\t33"
- << "41\t\tFETCH_VALUE\t\t34\t6\t7"
- << "42\t\tPOP"
- << "43\t\tPOP_QLIST"
- << "44\t\tPOP_VALUE\t\t35\t8"
+ << "32\t\tSTORE_VALUE_SOURCE\t29\t4"
+ << "33\t\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
+ << "34\t\tBEGIN\t\t\t4"
+ << "35\t\tSTORE_OBJECT_QLIST"
+ << "36\t\tASSIGN_OBJECT_LIST"
+ << "37\t\tFETCH_ATTACHED\t\t23"
+ << "38\t\tFETCH_QLIST\t\t32"
+ << "39\t\tFETCH\t\t\t33"
+ << "40\t\tFETCH_VALUE\t\t34\t6\t7"
+ << "41\t\tPOP"
+ << "42\t\tPOP_QLIST"
+ << "43\t\tPOP_VALUE\t\t35\t8"
+ << "44\t\tDEFER\t\t\t7"
<< "45\t\tDEFER\t\t\t7"
- << "46\t\tDEFER\t\t\t7"
- << "47\t\tSTORE_IMPORTED_SCRIPT\t2"
- << "48\t\tSTORE_VARIANT_INTEGER\t\t32\t11"
- << "49\t\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
- << "50\t\tDONE"
- << "51\t\tSTORE_TR_STRING\t99\t3\t14\t14\t2"
- << "52\t\tSTORE_TRID_STRING\t78\t7\t-1"
- << "53\t\tSTORE_VAR\t\t79\t5\t\t\"color(1, 1, 1, 1)\""
- << "54\t\tSTORE_VAR_OBJECT\t80"
- << "55\t\tSTORE_VAR_INTEGER\t81\t23"
- << "56\t\tSTORE_VAR_DOUBLE\t82\t66.3"
- << "57\t\tSTORE_VAR_BOOL\t\t83\ttrue"
+ << "46\t\tSTORE_IMPORTED_SCRIPT\t2"
+ << "47\t\tSTORE_VARIANT_INTEGER\t\t32\t11"
+ << "48\t\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
+ << "49\t\tDONE"
+ << "50\t\tSTORE_TR_STRING\t99\t3\t14\t14\t2"
+ << "51\t\tSTORE_TRID_STRING\t78\t7\t-1"
+ << "52\t\tSTORE_VAR\t\t79\t5\t\t\"color(1, 1, 1, 1)\""
+ << "53\t\tSTORE_VAR_OBJECT\t80"
+ << "54\t\tSTORE_VAR_INTEGER\t81\t23"
+ << "55\t\tSTORE_VAR_DOUBLE\t82\t66.3"
+ << "56\t\tSTORE_VAR_BOOL\t\t83\ttrue"
<< "-------------------------------------------------------------------------------";
QQmlTestMessageHandler messageHandler;
diff --git a/tests/auto/qml/v4/data/colorType.qml b/tests/auto/qml/v4/data/colorType.qml
deleted file mode 100644
index f6a98a4a3e..0000000000
--- a/tests/auto/qml/v4/data/colorType.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property bool useMyColor: true
- property color myColor: "red"
- property color myOtherColor: "green"
-
- property color test1: useMyColor ? myColor : myOtherColor
- property color test2: useMyColor ? "red" : "green"
- property color test3: useMyColor ? myColor : "green"
-
- property bool test4: !myColor ? false : true
-
- property bool test5: myColor != "red"
- property bool test6: myColor == "#ff0000"
- property bool test7: myColor != "#00ff00"
-}
-
diff --git a/tests/auto/qml/v4/data/conditionalExpr.qml b/tests/auto/qml/v4/data/conditionalExpr.qml
deleted file mode 100644
index 704f7c6c5a..0000000000
--- a/tests/auto/qml/v4/data/conditionalExpr.qml
+++ /dev/null
@@ -1,8 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property int n: 2
- property int a: n ? 1 : 0
- property int b: if (n) { 1 } else { 0 }
- result: (a && b) ? 0 : 1
-}
diff --git a/tests/auto/qml/v4/data/conversions.1.qml b/tests/auto/qml/v4/data/conversions.1.qml
deleted file mode 100644
index b3abde770a..0000000000
--- a/tests/auto/qml/v4/data/conversions.1.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning bool prop to other proptypes.
- boolProp: true
- intProp: boolProp
- floatProp: boolProp
- doubleProp: boolProp
- qrealProp: boolProp
- qstringProp: boolProp
- qurlProp: boolProp
- vec3Prop: Qt.vector3d(boolProp, boolProp, boolProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.2.qml b/tests/auto/qml/v4/data/conversions.2.qml
deleted file mode 100644
index 2fd0453ac2..0000000000
--- a/tests/auto/qml/v4/data/conversions.2.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning int prop to other proptypes.
- boolProp: intProp
- intProp: 4
- floatProp: intProp
- doubleProp: intProp
- qrealProp: intProp
- qstringProp: intProp
- qurlProp: intProp
- vec3Prop: Qt.vector3d(intProp, intProp, intProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.3.qml b/tests/auto/qml/v4/data/conversions.3.qml
deleted file mode 100644
index 66f0761a25..0000000000
--- a/tests/auto/qml/v4/data/conversions.3.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning float prop to other proptypes.
- boolProp: floatProp
- intProp: floatProp
- floatProp: 4.4
- doubleProp: floatProp
- qrealProp: floatProp
- qstringProp: floatProp
- qurlProp: floatProp
- vec3Prop: Qt.vector3d(floatProp, floatProp, floatProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.4.qml b/tests/auto/qml/v4/data/conversions.4.qml
deleted file mode 100644
index ccf0035313..0000000000
--- a/tests/auto/qml/v4/data/conversions.4.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning double prop to other prop types
- boolProp: doubleProp
- intProp: doubleProp
- floatProp: doubleProp
- doubleProp: 4.444444444
- qrealProp: doubleProp
- qstringProp: doubleProp
- qurlProp: doubleProp
- vec3Prop: Qt.vector3d(doubleProp, doubleProp, doubleProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.5.qml b/tests/auto/qml/v4/data/conversions.5.qml
deleted file mode 100644
index 26dc3b7195..0000000000
--- a/tests/auto/qml/v4/data/conversions.5.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning qreal prop to other prop types
- boolProp: qrealProp
- intProp: qrealProp
- floatProp: qrealProp
- doubleProp: qrealProp
- qrealProp: 4.44
- qstringProp: qrealProp
- qurlProp: qrealProp
- vec3Prop: Qt.vector3d(qrealProp, qrealProp, qrealProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.6.qml b/tests/auto/qml/v4/data/conversions.6.qml
deleted file mode 100644
index 573b227ada..0000000000
--- a/tests/auto/qml/v4/data/conversions.6.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning string prop to other proptypes.
- boolProp: qstringProp
- intProp: qstringProp
- floatProp: qstringProp
- doubleProp: qstringProp
- qrealProp: qstringProp
- qstringProp: "4"
- qurlProp: qstringProp
- vec3Prop: Qt.vector3d(qstringProp, qstringProp, qstringProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.7.qml b/tests/auto/qml/v4/data/conversions.7.qml
deleted file mode 100644
index 5112b06b1e..0000000000
--- a/tests/auto/qml/v4/data/conversions.7.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning url prop to other proptypes.
- boolProp: qurlProp
- intProp: qurlProp
- floatProp: qurlProp
- doubleProp: qurlProp
- qrealProp: qurlProp
- qstringProp: qurlProp
- qurlProp: "4"
- vec3Prop: Qt.vector3d(qurlProp, qurlProp, qurlProp)
-}
diff --git a/tests/auto/qml/v4/data/conversions.8.qml b/tests/auto/qml/v4/data/conversions.8.qml
deleted file mode 100644
index 18bf160e7e..0000000000
--- a/tests/auto/qml/v4/data/conversions.8.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.v4 1.0
-
-Conversion {
- // test assigning vector prop to other proptypes.
- boolProp: vec3Prop
- intProp: vec3Prop
- floatProp: vec3Prop
- doubleProp: vec3Prop
- qrealProp: vec3Prop
- qstringProp: vec3Prop
- qurlProp: vec3Prop
- vec3Prop: Qt.vector3d(4, 4, 4)
-}
diff --git a/tests/auto/qml/v4/data/doubleBoolJump.qml b/tests/auto/qml/v4/data/doubleBoolJump.qml
deleted file mode 100644
index 2eea73b573..0000000000
--- a/tests/auto/qml/v4/data/doubleBoolJump.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- QtObject {
- property real output: i1.p1 || i2.p2 == "text" ? 0.7 : 0
- }
-
- QtObject {
- id: i2
- property string p2
- }
-
- QtObject {
- id: i1
- property bool p1: false
- }
-}
-
diff --git a/tests/auto/qml/v4/data/equals.qml b/tests/auto/qml/v4/data/equals.qml
deleted file mode 100644
index 2862bb7ac9..0000000000
--- a/tests/auto/qml/v4/data/equals.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property QtObject myprop1: null
- property QtObject myprop2: QtObject {}
- property real zero: 0
- property bool falseProp: false
-
- property bool test1: myprop1 == false
- property bool test2: myprop1 == null
- property bool test3: 5 == myprop1
- property bool test4: null == myprop1
- property bool test5: myprop1 != false
- property bool test6: myprop1 != null
- property bool test7: 5 != myprop1
- property bool test8: null != myprop1
-
- property bool test9: myprop2 == false
- property bool test10: myprop2 == null
- property bool test11: 5 == myprop2
- property bool test12: null == myprop2
- property bool test13: myprop2 != false
- property bool test14: myprop2 != null
- property bool test15: 5 != myprop2
- property bool test16: null != myprop2
-
- property bool test17: myprop1 == myprop1
- property bool test18: myprop1 != myprop1
- property bool test19: myprop1 == myprop2
- property bool test20: myprop1 != myprop2
- property bool test21: myprop2 == myprop2
- property bool test22: myprop2 != myprop2
-
- property bool test23: myprop1 == "hello"
- property bool test24: myprop1 != "hello"
- property bool test25: myprop2 == "hello"
- property bool test26: myprop2 != "hello"
-
- property bool test27: falseProp == zero
- property bool test28: falseProp != zero
- property bool test29: falseProp == 1
- property bool test30: falseProp != 1
- property bool test31: true == zero
- property bool test32: true != zero
- property bool test33: true == 1
- property bool test34: true != 1
-
- property bool test35: "a\
-b" === "ab"
-}
-
diff --git a/tests/auto/qml/v4/data/fetchException.qml b/tests/auto/qml/v4/data/fetchException.qml
deleted file mode 100644
index 6431fcfae8..0000000000
--- a/tests/auto/qml/v4/data/fetchException.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property Item data
- property int a: data.x, 1
-}
diff --git a/tests/auto/qml/v4/data/integerOperations.qml b/tests/auto/qml/v4/data/integerOperations.qml
deleted file mode 100644
index 805f4566fb..0000000000
--- a/tests/auto/qml/v4/data/integerOperations.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property int testa1: i1.p1
- property int testa2: -testa1 - i1.p1
-
- property int testb1: i1.p1 & 2
- property int testb2: i1.p2 & 2
- property int testb3: 2 & i1.p1
- property int testb4: 2 & i1.p2
- property int testb5: i1.p1 & i1.p3
- property int testb6: i1.p2 & i1.p3
- property int testb7: i1.p3 & i1.p1
- property int testb8: i1.p3 & i1.p2
-
- property int testc1: i1.p1 | 2
- property int testc2: i1.p2 | 2
- property int testc3: 2 | i1.p1
- property int testc4: 2 | i1.p2
- property int testc5: i1.p1 | i1.p3
- property int testc6: i1.p2 | i1.p3
- property int testc7: i1.p3 | i1.p1
- property int testc8: i1.p3 | i1.p2
-
- property int testd1: i1.p1 ^ 7
- property int testd2: 7 ^ i1.p1
- property int testd3: i1.p1 ^ i1.p4
- property int testd4: i1.p4 ^ i1.p1
-
- property int teste1: i1.p4 << 2
- property int teste2: i1.p5 << 2
- property int teste3: 2 << i1.p4
- property int teste4: i1.p4 << i1.p3
- property int teste5: i1.p5 << i1.p3
- property int teste6: i1.p3 << i1.p4
-
- property int testf1: i1.p4 >> 2
- property int testf2: i1.p5 >> 2
- property int testf3: 2 >> i1.p4
- property int testf4: i1.p4 >> i1.p3
- property int testf5: i1.p5 >> i1.p3
- property int testf6: i1.p3 >> i1.p4
-
- property int testg1: i1.p4 >>> 2
- property int testg2: i1.p5 >>> 2
- property int testg3: 2 >>> i1.p4
- property int testg4: i1.p4 >>> i1.p3
- property int testg5: i1.p5 >>> i1.p3
- property int testg6: i1.p3 >>> i1.p4
-
- QtObject {
- id: i1
- property int p1: 333
- property int p2: -666
- property int p3: 2
- property int p4: 7
- property int p5: -7
- }
- }
diff --git a/tests/auto/qml/v4/data/jsvalueHandling.qml b/tests/auto/qml/v4/data/jsvalueHandling.qml
deleted file mode 100644
index d15e878a52..0000000000
--- a/tests/auto/qml/v4/data/jsvalueHandling.qml
+++ /dev/null
@@ -1,69 +0,0 @@
-import QtQuick 2.0
-import Qt.v4 1.0
-
-JSValueTest {
- property bool pBool: true
- property int pInt: 666
- property real pReal: 3.1415927
- property string pString: 'foo'
- property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property color pColor: Qt.rgba(1, 0, 0, 0.5)
- property QtObject pObject: QtObject { property string foo: 'bar' }
- property var pVar: pUrl
-
- // Test assignment to QJSValue
- boolVar: pBool
- intVar: pInt
- realVar: pReal
- stringVar: pString
- urlVar: pUrl
- colorVar: pColor
- objectVar: pObject
- nullVar: null
- varVar: pVar
-
- // Test equivalence
- property bool boolConversionSuccess: (boolVar == true)
- property bool intConversionSuccess: (intVar == 666)
- property bool realConversionSuccess: (realVar == 3.1415927)
- property bool stringConversionSuccess: (stringVar == 'foo')
-
- property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property bool urlConversionSuccess: (urlVar == comparisonUrl)
-
- property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
- property bool colorConversionSuccess: (colorVar == comparisonColor)
-
- property bool objectConversionSuccess: (objectVar == pObject)
- property bool nullConversionSuccess: (nullVar == null)
-
- property bool varConversionSuccess: (varVar == comparisonUrl)
-
- // Operations are not handled by V4 - they should pass through correctly
- property var pVarNot: !boolVar
- property var pVarComplement: ~intVar
- property var pVarEqual: (boolVar == pBool)
- property var pVarLiteralEqual: (boolVar == true)
- property var pVarUnequal: (urlVar == colorVar)
- property var pVarComparison: (intVar <= intVar)
- property var pVarShift: (intVar >> 1)
-
- Component.onCompleted: {
- if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
- if (!intConversionSuccess) console.warn('QV4: int conversion failed');
- if (!realConversionSuccess) console.warn('QV4: real conversion failed');
- if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
- if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
- if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
- if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
- if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
- if (!varConversionSuccess) console.warn('QV4: var conversion failed');
- if (pVarNot != false) console.warn('QV4: var negation impeded');
- if (pVarComplement != ~666) console.warn('QV4: var complement impeded');
- if (pVarEqual != true) console.warn('QV4: var equality impeded');
- if (pVarLiteralEqual != true) console.warn('QV4: var/literal equality impeded');
- if (pVarUnequal != false) console.warn('QV4: var unequality impeded');
- if (pVarComparison != true) console.warn('QV4: var comparison impeded');
- if (pVarShift != 333) console.warn('QV4: var shift impeded');
- }
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.2.qml b/tests/auto/qml/v4/data/logicalAnd.2.qml
deleted file mode 100644
index cc3d75bd90..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.2.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property string s: "foo" && "bar"
- result: s == "bar"
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.3.qml b/tests/auto/qml/v4/data/logicalAnd.3.qml
deleted file mode 100644
index 6527f05d07..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.3.qml
+++ /dev/null
@@ -1,8 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property string s: ""
- property bool flag: true
-
- result: (s && flag) == ""
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.4.qml b/tests/auto/qml/v4/data/logicalAnd.4.qml
deleted file mode 100644
index fbcee91699..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.4.qml
+++ /dev/null
@@ -1,8 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property string s: "foo"
- property bool flag: true
-
- result: (!flag && s) == false
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.5.qml b/tests/auto/qml/v4/data/logicalAnd.5.qml
deleted file mode 100644
index f0698463fe..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.5.qml
+++ /dev/null
@@ -1,7 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property bool flag: true
-
- result: (null && flag) == null
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.6.qml b/tests/auto/qml/v4/data/logicalAnd.6.qml
deleted file mode 100644
index e98b5c99cd..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.6.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property string s: ""
- property bool flag: true
- property string subresult: s && flag
-
- result: subresult === ""
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.7.qml b/tests/auto/qml/v4/data/logicalAnd.7.qml
deleted file mode 100644
index 0f19d3fb40..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.7.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property real nan: Number.NaN
- property bool flag: true
- property real subresult: nan && flag
-
- result: isNaN(subresult)
-}
diff --git a/tests/auto/qml/v4/data/logicalAnd.qml b/tests/auto/qml/v4/data/logicalAnd.qml
deleted file mode 100644
index 40fc3616c2..0000000000
--- a/tests/auto/qml/v4/data/logicalAnd.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property int a: 10
- result: a == 10 && a == 2
-}
diff --git a/tests/auto/qml/v4/data/logicalOr.2.qml b/tests/auto/qml/v4/data/logicalOr.2.qml
deleted file mode 100644
index 54fb78b127..0000000000
--- a/tests/auto/qml/v4/data/logicalOr.2.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property string s: "foo" || "bar"
- result: s == "foo"
-}
diff --git a/tests/auto/qml/v4/data/logicalOr.qml b/tests/auto/qml/v4/data/logicalOr.qml
deleted file mode 100644
index 406a7d83eb..0000000000
--- a/tests/auto/qml/v4/data/logicalOr.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property int a: 10
- result: a == 1 || a == 2
-}
diff --git a/tests/auto/qml/v4/data/mathAbs.qml b/tests/auto/qml/v4/data/mathAbs.qml
deleted file mode 100644
index eb504ae4d8..0000000000
--- a/tests/auto/qml/v4/data/mathAbs.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.abs(i1.p1)
- property real test2: Math.abs(i1.p2)
-
- property int test3: Math.abs(i1.p3)
- property int test4: Math.abs(i1.p4)
-
- property real subtest5: Math.abs()
- property real subtest6: Math.abs(i1.p6)
- property bool test5: isNaN(subtest5)
- property bool test6: isNaN(subtest6)
-
- property real subtest7: Math.abs(i1.p7)
- property bool test7: isNaN(subtest7)
- property int test8: Math.abs(i1.p8)
-
- property real subtest9: Math.abs(i1.p9)
- property real subtest10: Math.abs(i1.p10)
- property bool test9: subtest9 === Number.POSITIVE_INFINITY
- property bool test10: subtest10 === Number.POSITIVE_INFINITY
-
- property int test11: Math.abs(i1.p11)
- property real subtest12: Math.abs(i1.p12)
- property bool test12: subtest12 === 0 && (1/subtest12) === Infinity
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.5
- property int p3: 18
- property int p4: -72
- property real p6: Number.NaN
- property string p7: "hello world"
- property string p8: "82"
- property real p9: Number.NEGATIVE_INFINITY
- property real p10: Number.POSITIVE_INFINITY
- property real p11: 0
- property real p12: -0
- }
- }
diff --git a/tests/auto/qml/v4/data/mathCeil.qml b/tests/auto/qml/v4/data/mathCeil.qml
deleted file mode 100644
index 1f65066233..0000000000
--- a/tests/auto/qml/v4/data/mathCeil.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.ceil(i1.p1)
- property real test2: Math.ceil(i1.p2)
-
- property real subtest3: Math.ceil()
- property real subtest4: Math.ceil(i1.p4)
- property bool test3: isNaN(subtest3)
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.ceil(i1.p5)
- property bool test5: isNaN(subtest5)
- property real test6: Math.ceil(i1.p6)
-
- property real subtest7: Math.ceil(i1.p7)
- property real subtest8: Math.ceil(i1.p8)
- property bool test7: subtest7 === Number.NEGATIVE_INFINITY
- property bool test8: subtest8 === Number.POSITIVE_INFINITY
-
- property real test9: Math.ceil(i1.p9)
- property real subtest10: Math.ceil(i1.p10)
- property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
-
- property real subtest11: Math.ceil(i1.p11)
- property bool test11: subtest11 === 0 && (1/subtest11) === -Infinity
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- property real p11: -0.5
- }
- }
diff --git a/tests/auto/qml/v4/data/mathCos.qml b/tests/auto/qml/v4/data/mathCos.qml
deleted file mode 100644
index 44c47e9f15..0000000000
--- a/tests/auto/qml/v4/data/mathCos.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.cos(i1.p1)
- property real test2: Math.cos(i1.p2)
-
- property real subtest3: Math.cos()
- property real subtest4: Math.cos(i1.p4)
- property bool test3: isNaN(subtest3)
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.cos(i1.p5)
- property bool test5: isNaN(subtest5)
- property real test6: Math.cos(i1.p6)
-
- property real subtest7: Math.cos(i1.p7)
- property real subtest8: Math.cos(i1.p8)
- property bool test7: isNaN(subtest7)
- property bool test8: isNaN(subtest8)
-
- property real subtest9: Math.cos(i1.p9)
- property bool test9: subtest9 === 1
- property real subtest10: Math.cos(i1.p10)
- property bool test10: subtest10 === 1
-
- property real subtest11: Math.PI / 6.66
- property real test11: Math.cos(subtest11)
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- }
- }
diff --git a/tests/auto/qml/v4/data/mathFloor.qml b/tests/auto/qml/v4/data/mathFloor.qml
deleted file mode 100644
index 3473dccd10..0000000000
--- a/tests/auto/qml/v4/data/mathFloor.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.floor(i1.p1)
- property real test2: Math.floor(i1.p2)
-
- property real subtest3: Math.floor()
- property real subtest4: Math.floor(i1.p4)
- property bool test3: isNaN(subtest3)
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.floor(i1.p5)
- property bool test5: isNaN(subtest5)
- property real test6: Math.floor(i1.p6)
-
- property real subtest7: Math.floor(i1.p7)
- property real subtest8: Math.floor(i1.p8)
- property bool test7: subtest7 === Number.NEGATIVE_INFINITY
- property bool test8: subtest8 === Number.POSITIVE_INFINITY
-
- property real test9: Math.floor(i1.p9)
- property real subtest10: Math.floor(i1.p10)
- property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- }
- }
diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml
deleted file mode 100644
index cd8a88a3e7..0000000000
--- a/tests/auto/qml/v4/data/mathMax.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.max(i1.p1, i1.p2)
- property real test2: Math.max(i1.p2, i1.p3)
-
- property real subtest3: Math.max()
- property real subtest4: Math.max(i1.p4)
- property bool test3: subtest3 === -Infinity
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.max(i1.p5, i1.p1)
- property bool test5: isNaN(subtest5)
- property real test6: Math.max(i1.p6, i1.p3)
-
- property real test7: Math.max(i1.p7, i1.p2)
- property real subtest8: Math.max(i1.p8, i1.p2)
- property bool test8: subtest8 === Number.POSITIVE_INFINITY
-
- property real subtest9: Math.max(i1.p10, i1.p9)
- property bool test9: subtest9 === 0 && (1/subtest9) === Infinity
-
- // Reverse the inputs to Math.max
- property real subtest10: Math.max(i1.p9, i1.p10)
- property bool test10: subtest10 === 0 && (1/subtest10) === Infinity
-
- property real test11: Math.max(i1.p11, i1.p1)
- property real test12: Math.max(i1.p11, i1.p2)
- property real test13: Math.max(i1.p1, i1.p2, i1.p3)
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property int p3: 7
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- property var p11: null
- }
-}
diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml
deleted file mode 100644
index 4ae5408b58..0000000000
--- a/tests/auto/qml/v4/data/mathMin.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.min(i1.p1, i1.p2)
- property real test2: Math.min(i1.p2, i1.p3)
-
- property real subtest3: Math.min()
- property real subtest4: Math.min(i1.p4)
- property bool test3: subtest3 === Infinity
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.min(i1.p5, i1.p1)
- property bool test5: isNaN(subtest5)
- property real test6: Math.min(i1.p6, i1.p3)
-
- property real subtest7: Math.min(i1.p7, i1.p2)
- property bool test7: subtest7 === Number.NEGATIVE_INFINITY
- property real test8: Math.min(i1.p8, i1.p2)
-
- property real subtest9: Math.min(i1.p10, i1.p9)
- property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity
-
- // Reverse the inputs to Math.min
- property real subtest10: Math.min(i1.p9, i1.p10)
- property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
-
- property real test11: Math.min(i1.p11, i1.p1)
- property real test12: Math.min(i1.p11, i1.p2)
- property real test13: Math.min(i1.p1, i1.p2, i1.p3)
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property int p3: 95
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- property var p11: null
- }
- }
diff --git a/tests/auto/qml/v4/data/mathSin.qml b/tests/auto/qml/v4/data/mathSin.qml
deleted file mode 100644
index c48ec03fee..0000000000
--- a/tests/auto/qml/v4/data/mathSin.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: Math.sin(i1.p1)
- property real test2: Math.sin(i1.p2)
-
- property real subtest3: Math.sin()
- property real subtest4: Math.sin(i1.p4)
- property bool test3: isNaN(subtest3)
- property bool test4: isNaN(subtest4)
-
- property real subtest5: Math.sin(i1.p5)
- property bool test5: isNaN(subtest5)
- property real test6: Math.sin(i1.p6)
-
- property real subtest7: Math.sin(i1.p7)
- property real subtest8: Math.sin(i1.p8)
- property bool test7: isNaN(subtest7)
- property bool test8: isNaN(subtest8)
-
- property real subtest9: Math.sin(i1.p9)
- property bool test9: subtest9 === 0 && (1/subtest9) === Infinity
- property real subtest10: Math.sin(i1.p10)
- property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
-
- property real subtest11: Math.PI / 6.66
- property real test11: Math.sin(subtest11)
-
- QtObject {
- id: i1
- property real p1: -3.7
- property real p2: 4.4
- property real p4: Number.NaN
- property string p5: "hello world"
- property string p6: "82.6"
- property real p7: Number.NEGATIVE_INFINITY
- property real p8: Number.POSITIVE_INFINITY
- property real p9: 0
- property real p10: -0
- }
- }
diff --git a/tests/auto/qml/v4/data/nestedLogicalAnd.qml b/tests/auto/qml/v4/data/nestedLogicalAnd.qml
deleted file mode 100644
index 1358fcea64..0000000000
--- a/tests/auto/qml/v4/data/nestedLogicalAnd.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property bool val1: false
- property bool val2: true
- property bool val3: false
-
- property bool b1: (true && true && false)
- property bool b2: (true && (false && true))
- property bool b3: ((true && true) && true)
- property bool b4: (val1 && (val2 && val3)) ? true : false
-
- result: !b1 && !b2 && b3 && !b4
-}
diff --git a/tests/auto/qml/v4/data/nestedLogicalOr.qml b/tests/auto/qml/v4/data/nestedLogicalOr.qml
deleted file mode 100644
index c4478a3e7b..0000000000
--- a/tests/auto/qml/v4/data/nestedLogicalOr.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property bool val1: false
- property bool val2: true
- property bool val3: false
-
- property bool b1: (false || false || true)
- property bool b2: (false || (false || true))
- property bool b3: ((false || false) || true)
- property bool b4: (val1 || (val2 || val3)) ? true : false
-
- result: b1 && b2 && b3 && b4
-}
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess.qml b/tests/auto/qml/v4/data/nestedObjectAccess.qml
deleted file mode 100644
index 56cd17e41e..0000000000
--- a/tests/auto/qml/v4/data/nestedObjectAccess.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- result: nested.result
-}
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess2.qml b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
deleted file mode 100644
index 2f0e0db01c..0000000000
--- a/tests/auto/qml/v4/data/nestedObjectAccess2.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- result: nested2.result
-}
diff --git a/tests/auto/qml/v4/data/nullQObject.qml b/tests/auto/qml/v4/data/nullQObject.qml
deleted file mode 100644
index 00185b3988..0000000000
--- a/tests/auto/qml/v4/data/nullQObject.qml
+++ /dev/null
@@ -1,7 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property QtObject obj
- property QtObject test
- test: obj
-}
diff --git a/tests/auto/qml/v4/data/objectToBool.qml b/tests/auto/qml/v4/data/objectToBool.qml
deleted file mode 100644
index 8c8a67bee0..0000000000
--- a/tests/auto/qml/v4/data/objectToBool.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property QtObject prop1: null
- property QtObject prop2: QtObject {}
-
- property bool test1: prop1 ? true : false
- property bool test2: prop2 ? true : false
-
- property bool test3: prop1 == false
- property bool test4: prop1 === false
-
- property bool test5: prop2 == false
- property bool test6: prop2 === false
-}
-
diff --git a/tests/auto/qml/v4/data/qrealToIntRounding.qml b/tests/auto/qml/v4/data/qrealToIntRounding.qml
deleted file mode 100644
index ee3d405073..0000000000
--- a/tests/auto/qml/v4/data/qrealToIntRounding.qml
+++ /dev/null
@@ -1,10 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property int data: 1
-
- property int test1: 6.6 + data
- property int test2: 6.2 + data
- property int test3: 6 + data
-}
-
diff --git a/tests/auto/qml/v4/data/qtbug_21883.qml b/tests/auto/qml/v4/data/qtbug_21883.qml
deleted file mode 100644
index a51f97c944..0000000000
--- a/tests/auto/qml/v4/data/qtbug_21883.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property Result dummy: Result
-}
diff --git a/tests/auto/qml/v4/data/qtbug_22816.qml b/tests/auto/qml/v4/data/qtbug_22816.qml
deleted file mode 100644
index bfa8d4948c..0000000000
--- a/tests/auto/qml/v4/data/qtbug_22816.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-import QtQuick 2.0
-
-Item {
- QtObject {
- id: object
- property bool prop1: true
- function myfunction() { return true; }
- property bool prop2: object.prop1 && myfunction();
- }
-
- property bool test1: object.prop1 && object.prop2
- property bool test2: object.prop1
-
- Component.onCompleted: {
- object.prop1 = false;
- }
-}
-
diff --git a/tests/auto/qml/v4/data/singletonType.qml b/tests/auto/qml/v4/data/singletonType.qml
deleted file mode 100644
index 3fcbcae64d..0000000000
--- a/tests/auto/qml/v4/data/singletonType.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-import Qt.test 1.0 as ModApi
-import QtQuick 2.0
-
-Item {
- property int testProp: ModApi.V4.ip
- property int testProp2: 2
-
- function getRandom() {
- testProp2 = ModApi.V4.random();
- // testProp should also have changed.
- }
-}
diff --git a/tests/auto/qml/v4/data/strictEquals.qml b/tests/auto/qml/v4/data/strictEquals.qml
deleted file mode 100644
index 503ca50454..0000000000
--- a/tests/auto/qml/v4/data/strictEquals.qml
+++ /dev/null
@@ -1,53 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property QtObject myprop1: null
- property QtObject myprop2: QtObject {}
- property real zero: 0
- property bool falseProp: false
-
- property bool test1: myprop1 === false
- property bool test2: myprop1 === null
- property bool test3: 5 === myprop1
- property bool test4: null === myprop1
- property bool test5: myprop1 !== false
- property bool test6: myprop1 !== null
- property bool test7: 5 !== myprop1
- property bool test8: null !== myprop1
-
- property bool test9: myprop2 === false
- property bool test10: myprop2 === null
- property bool test11: 5 === myprop2
- property bool test12: null === myprop2
- property bool test13: myprop2 !== false
- property bool test14: myprop2 !== null
- property bool test15: 5 !== myprop2
- property bool test16: null !== myprop2
-
- property bool test17: myprop1 === myprop1
- property bool test18: myprop1 !== myprop1
- property bool test19: myprop1 === myprop2
- property bool test20: myprop1 !== myprop2
- property bool test21: myprop2 === myprop2
- property bool test22: myprop2 !== myprop2
-
- property bool test23: myprop1 === "hello"
- property bool test24: myprop1 !== "hello"
- property bool test25: myprop2 === "hello"
- property bool test26: myprop2 !== "hello"
-
- property bool test27: falseProp === zero
- property bool test28: falseProp !== zero
- property bool test29: falseProp === 1
- property bool test30: falseProp !== 1
- property bool test31: true === zero
- property bool test32: true !== zero
- property bool test33: true === 1
- property bool test34: true !== 1
-
- property bool test35: zero === 5.0
- property bool test36: zero !== 5.0
- property bool test37: zero === 1
- property bool test38: zero !== 1
-}
-
diff --git a/tests/auto/qml/v4/data/stringComparison.qml b/tests/auto/qml/v4/data/stringComparison.qml
deleted file mode 100644
index d9eab5389e..0000000000
--- a/tests/auto/qml/v4/data/stringComparison.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property string string1: "aaba"
- property string string2: "aa"
- property string string3: "aaab"
- property string string4: "c"
- property string string5: string2 + string4
-
- property bool test1: string1 > string2
- property bool test2: string2 < string1
- property bool test3: string1 > string3
- property bool test4: string3 < string1
- property bool test5: string1 < string4
- property bool test6: string4 > string1
- property bool test7: string1 < string5
- property bool test8: string5 > string1
-
- property bool test9: string1 == "aaba"
- property bool test10: string1 != "baa"
- property bool test11: string1 === "aaba"
- property bool test12: string1 !== "baa"
- property bool test13: string4 == "c"
- property bool test14: string4 != "d"
- property bool test15: string4 === "c"
- property bool test16: string4 !== "d"
- property bool test17: string5 === "aac"
- property bool test18: string5 !== "aad"
-
- property bool test19: string1 >= string2
- property bool test20: string2 <= string1
- property bool test21: string1 >= string3
- property bool test22: string3 <= string1
- property bool test23: string1 <= string4
- property bool test24: string4 >= string1
- property bool test25: string4 <= "c"
- property bool test26: string4 >= "c"
- property bool test27: string5 <= "aac"
- property bool test28: string5 >= "aac"
-}
-
diff --git a/tests/auto/qml/v4/data/subscriptions.1.qml b/tests/auto/qml/v4/data/subscriptions.1.qml
deleted file mode 100644
index 607233819e..0000000000
--- a/tests/auto/qml/v4/data/subscriptions.1.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-import QtQuick 2.0
-
-Rectangle {
- id: root
- width: 400
- height: 400
-
- property real targetHeight: menuItems.height + 1
- property real heightValue: if (1) menuItems.height //this must be v8?
- property bool boolProp: menuItems.height > heightValue //this must be v4?
-
- Column {
- id: menuItems
- Item { height: 200; width: 10 }
- }
-}
diff --git a/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml b/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml
deleted file mode 100644
index a8e05eeda1..0000000000
--- a/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import QtQuick 2.0
-
-Item {
- id: thisTest
-
- property bool cond: true
- property real a: 1
- property real result: cond ? a : a
-
- PropertyAction { running: true; target: thisTest; property: "a"; value: 2; }
-}
diff --git a/tests/auto/qml/v4/data/unaryMinus.qml b/tests/auto/qml/v4/data/unaryMinus.qml
deleted file mode 100644
index 410654fc3c..0000000000
--- a/tests/auto/qml/v4/data/unaryMinus.qml
+++ /dev/null
@@ -1,24 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: -i1.p2
- property int test2: -i1.p2
- property real test3: -i1.p1
- property int test4: -i1.p1
- property real test5: -i1.p3
- property int test6: -i1.p3
- property real test7: -i1.p4
- property int test8: -i1.p4
- property real test9: -i1.p5
- property int test10: -i1.p5
-
- QtObject {
- id: i1
- property real p1: -3.7
- property int p2: 18
- property real p3: -3.3
- property int p4: -7
- property real p5: 4.4
- }
- }
-
diff --git a/tests/auto/qml/v4/data/unaryPlus.qml b/tests/auto/qml/v4/data/unaryPlus.qml
deleted file mode 100644
index cd5315a7cc..0000000000
--- a/tests/auto/qml/v4/data/unaryPlus.qml
+++ /dev/null
@@ -1,24 +0,0 @@
-import QtQuick 2.0
-
-Item {
- property real test1: +i1.p2
- property int test2: +i1.p2
- property real test3: +i1.p1
- property int test4: +i1.p1
- property real test5: +i1.p3
- property int test6: +i1.p3
- property real test7: +i1.p4
- property int test8: +i1.p4
- property real test9: +i1.p5
- property int test10: +i1.p5
-
- QtObject {
- id: i1
- property real p1: -3.7
- property int p2: 18
- property real p3: -3.3
- property int p4: -7
- property real p5: 4.4
- }
-}
-
diff --git a/tests/auto/qml/v4/data/unnecessaryReeval.qml b/tests/auto/qml/v4/data/unnecessaryReeval.qml
deleted file mode 100644
index 48662d7a2d..0000000000
--- a/tests/auto/qml/v4/data/unnecessaryReeval.qml
+++ /dev/null
@@ -1,7 +0,0 @@
-import Qt.v4 1.0
-
-Result {
- property int a: 8
- property int b: 19
- result: (a == 8)?b:7
-}
diff --git a/tests/auto/qml/v4/data/varHandling.qml b/tests/auto/qml/v4/data/varHandling.qml
deleted file mode 100644
index c19e6a256f..0000000000
--- a/tests/auto/qml/v4/data/varHandling.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property bool pBool: true
- property int pInt: 666
- property real pReal: 3.1415927
- property string pString: 'foo'
- property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property color pColor: Qt.rgba(1, 0, 0, 0.5)
- property QtObject pObject: QtObject { property string foo: 'bar' }
-
- // Test assignment to var
- property var pBoolVar: pBool
- property var pIntVar: pInt
- property var pRealVar: pReal
- property var pStringVar: pString
- property var pUrlVar: pUrl
- property var pColorVar: pColor
- property var pObjectVar: pObject
- property var pNullVar: null
- property var pVarVar: pUrlVar
-
- // Test equivalence
- property bool boolConversionSuccess: (pBoolVar == true)
- property bool intConversionSuccess: (pIntVar == 666)
- property bool realConversionSuccess: (pRealVar == 3.1415927)
- property bool stringConversionSuccess: (pStringVar == 'foo')
-
- property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property bool urlConversionSuccess: (pUrlVar == comparisonUrl)
-
- property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
- property bool colorConversionSuccess: (pColorVar == comparisonColor)
-
- property bool objectConversionSuccess: (pObjectVar == pObject)
- property bool nullConversionSuccess: (pNullVar == null)
-
- property bool varConversionSuccess: (pVarVar == comparisonUrl)
-
- // Operations are not handled by V4 - they should pass through correctly
- property var pVarNot: !pBoolVar
- property var pVarComplement: ~pIntVar
- property var pVarEqual: (pBoolVar == pBoolVar)
- property var pVarLiteralEqual: (pBoolVar == true)
- property var pVarUnequal: (pUrlVar == pColorVar)
- property var pVarComparison: (pIntVar <= pIntVar)
- property var pVarShift: (pIntVar >> 1)
-
- Component.onCompleted: {
- if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
- if (!intConversionSuccess) console.warn('QV4: int conversion failed');
- if (!realConversionSuccess) console.warn('QV4: real conversion failed');
- if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
- if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
- if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
- if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
- if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
- if (!varConversionSuccess) console.warn('QV4: var conversion failed');
- if (pVarNot != false) console.warn('QV4: var negation impeded');
- if (pVarComplement != ~666) console.warn('QV4: var complement impeded');
- if (pVarEqual != true) console.warn('QV4: var equality impeded');
- if (pVarLiteralEqual != true) console.warn('QV4: var/literal equality impeded');
- if (pVarUnequal != false) console.warn('QV4: var unequality impeded');
- if (pVarComparison != true) console.warn('QV4: var comparison impeded');
- if (pVarShift != 333) console.warn('QV4: var shift impeded');
- }
-}
diff --git a/tests/auto/qml/v4/data/variantHandling.qml b/tests/auto/qml/v4/data/variantHandling.qml
deleted file mode 100644
index 3d48eef57e..0000000000
--- a/tests/auto/qml/v4/data/variantHandling.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-import QtQuick 2.0
-
-QtObject {
- property bool pBool: true
- property int pInt: 666
- property real pReal: 3.1415927
- property string pString: 'foo'
- property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property color pColor: Qt.rgba(1, 0, 0, 0.5)
- property QtObject pObject: QtObject { property string foo: 'bar' }
-
- // Test assignment to variant
- property variant pBoolVar: pBool
- property variant pIntVar: pInt
- property variant pRealVar: pReal
- property variant pStringVar: pString
- property variant pUrlVar: pUrl
- property variant pColorVar: pColor
- property variant pObjectVar: pObject
- property variant pNullVar: null
- property variant pVarVar: pUrlVar
-
- // Test equivalence
- property bool boolConversionSuccess: (pBoolVar == true)
- property bool intConversionSuccess: (pIntVar == 666)
- property bool realConversionSuccess: (pRealVar == 3.1415927)
- property bool stringConversionSuccess: (pStringVar == 'foo')
-
- property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
- property bool urlConversionSuccess: (pUrlVar == comparisonUrl)
-
- property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
- property bool colorConversionSuccess: (pColorVar == comparisonColor)
-
- property bool objectConversionSuccess: (pObjectVar == pObject)
- property bool nullConversionSuccess: (pNullVar == null)
-
- property bool variantConversionSuccess: (pVarVar == comparisonUrl)
-
- // Operations are not handled by V4 - they should pass through correctly
- property variant pVarNot: !pBoolVar
- property variant pVarComplement: ~pIntVar
- property variant pVarEqual: (pBoolVar == pBoolVar)
- property variant pVarLiteralEqual: (pBoolVar == true)
- property variant pVarUnequal: (pUrlVar == pColorVar)
- property variant pVarComparison: (pIntVar <= pIntVar)
- property variant pVarShift: (pIntVar >> 1)
-
- Component.onCompleted: {
- if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
- if (!intConversionSuccess) console.warn('QV4: int conversion failed');
- if (!realConversionSuccess) console.warn('QV4: real conversion failed');
- if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
- if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
- if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
- if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
- if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
- if (!variantConversionSuccess) console.warn('QV4: variant conversion failed');
- if (pVarNot != false) console.warn('QV4: variant negation impeded');
- if (pVarComplement != ~666) console.warn('QV4: variant complement impeded');
- if (pVarEqual != true) console.warn('QV4: variant equality impeded');
- if (pVarLiteralEqual != true) console.warn('QV4: variant/literal equality impeded');
- if (pVarUnequal != false) console.warn('QV4: variant unequality impeded');
- if (pVarComparison != true) console.warn('QV4: variant comparison impeded');
- if (pVarShift != 333) console.warn('QV4: variant shift impeded');
- }
-}
diff --git a/tests/auto/qml/v4/testtypes.cpp b/tests/auto/qml/v4/testtypes.cpp
deleted file mode 100644
index ba81e591fc..0000000000
--- a/tests/auto/qml/v4/testtypes.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "testtypes.h"
-
-#include <QtQml/qqml.h>
-
-void registerTypes()
-{
- qmlRegisterType<ResultObject>("Qt.v4", 1,0, "Result");
- qmlRegisterType<NestedObject>();
- qmlRegisterType<ConversionObject>("Qt.v4", 1, 0, "Conversion");
- qmlRegisterType<JSValueTest>("Qt.v4", 1, 0, "JSValueTest");
-}
diff --git a/tests/auto/qml/v4/testtypes.h b/tests/auto/qml/v4/testtypes.h
deleted file mode 100644
index ee516f2927..0000000000
--- a/tests/auto/qml/v4/testtypes.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TESTTYPES_H
-#define TESTTYPES_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QVector3D>
-#include <QJSValue>
-
-class NestedObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int dummy READ dummy);
- Q_PROPERTY(int result READ result FINAL CONSTANT);
-
-public:
- int dummy() const { return 7; }
- int result() const { return 37; }
-};
-
-class ResultObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int result READ result WRITE setResult FINAL)
- Q_PROPERTY(NestedObject *nested READ nested CONSTANT)
- Q_PROPERTY(NestedObject *nested2 READ nested2 FINAL CONSTANT)
-public:
- ResultObject() : m_result(0), m_resultCounter(0) {}
-
- int resultCounter() const { return m_resultCounter; }
- void resetResultCounter() { m_resultCounter = 0; }
-
- int result() const { return m_result; }
- void setResult(int result) { m_result = result; m_resultCounter++; }
-
- NestedObject *nested() { return &m_nested; }
- NestedObject *nested2() { return &m_nested2; }
-
-private:
- int m_result;
- int m_resultCounter;
-
- NestedObject m_nested;
- NestedObject m_nested2;
-};
-
-class ConversionObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(bool boolProp READ boolProp WRITE setBoolProp NOTIFY boolPropChanged)
- Q_PROPERTY(int intProp READ intProp WRITE setIntProp NOTIFY intPropChanged)
- Q_PROPERTY(float floatProp READ floatProp WRITE setFloatProp NOTIFY floatPropChanged)
- Q_PROPERTY(double doubleProp READ doubleProp WRITE setDoubleProp NOTIFY doublePropChanged)
- Q_PROPERTY(qreal qrealProp READ qrealProp WRITE setQrealProp NOTIFY qrealPropChanged)
- Q_PROPERTY(QString qstringProp READ qstringProp WRITE setQstringProp NOTIFY qstringPropChanged)
- Q_PROPERTY(QUrl qurlProp READ qurlProp WRITE setQurlProp NOTIFY qurlPropChanged)
- Q_PROPERTY(QVector3D vec3Prop READ vec3Prop WRITE setVec3Prop NOTIFY vec3PropChanged)
- Q_PROPERTY(QJSValue jsvalueProp READ jsvalueProp WRITE setJsvalueProp NOTIFY jsvaluePropChanged)
-
-public:
- ConversionObject() : m_boolProp(false), m_intProp(0), m_floatProp(0.0), m_doubleProp(0.0), m_qrealProp(0.0) {}
- ~ConversionObject() {}
-
- bool boolProp() const { return m_boolProp; }
- void setBoolProp(bool v) { m_boolProp = v; emit boolPropChanged(); }
- int intProp() const { return m_intProp; }
- void setIntProp(int v) { m_intProp = v; emit intPropChanged(); }
- float floatProp() const { return m_floatProp; }
- void setFloatProp(float v) { m_floatProp = v; emit floatPropChanged(); }
- double doubleProp() const { return m_doubleProp; }
- void setDoubleProp(double v) { m_doubleProp = v; emit doublePropChanged(); }
- qreal qrealProp() const { return m_qrealProp; }
- void setQrealProp(qreal v) { m_qrealProp = v; emit qrealPropChanged(); }
- QString qstringProp() const { return m_qstringProp; }
- void setQstringProp(const QString& v) { m_qstringProp = v; emit qstringPropChanged(); }
- QUrl qurlProp() const { return m_qurlProp; }
- void setQurlProp(const QUrl& v) { m_qurlProp = v; emit qurlPropChanged(); }
- QVector3D vec3Prop() const { return m_vec3Prop; }
- void setVec3Prop(const QVector3D& v) { m_vec3Prop = v; emit vec3PropChanged(); }
- QJSValue jsvalueProp() const { return m_jsvalueProp; }
- void setJsvalueProp(const QJSValue &v) { m_jsvalueProp = v; emit jsvaluePropChanged(); }
-
-signals:
- void boolPropChanged();
- void intPropChanged();
- void floatPropChanged();
- void doublePropChanged();
- void qrealPropChanged();
- void qstringPropChanged();
- void qurlPropChanged();
- void vec3PropChanged();
- void jsvaluePropChanged();
-
-private:
- bool m_boolProp;
- int m_intProp;
- float m_floatProp;
- double m_doubleProp;
- qreal m_qrealProp;
- QString m_qstringProp;
- QUrl m_qurlProp;
- QVector3D m_vec3Prop;
- QJSValue m_jsvalueProp;
-};
-
-class JSValueTest : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QJSValue boolVar READ boolVar WRITE setBoolVar NOTIFY boolVarChanged)
- Q_PROPERTY(QJSValue intVar READ intVar WRITE setIntVar NOTIFY intVarChanged)
- Q_PROPERTY(QJSValue realVar READ realVar WRITE setRealVar NOTIFY realVarChanged)
- Q_PROPERTY(QJSValue stringVar READ stringVar WRITE setStringVar NOTIFY stringVarChanged)
- Q_PROPERTY(QJSValue urlVar READ urlVar WRITE setUrlVar NOTIFY urlVarChanged)
- Q_PROPERTY(QJSValue colorVar READ colorVar WRITE setColorVar NOTIFY colorVarChanged)
- Q_PROPERTY(QJSValue objectVar READ objectVar WRITE setObjectVar NOTIFY objectVarChanged)
- Q_PROPERTY(QJSValue nullVar READ nullVar WRITE setNullVar NOTIFY nullVarChanged)
- Q_PROPERTY(QJSValue varVar READ varVar WRITE setVarVar NOTIFY varVarChanged)
-
-public:
- JSValueTest() {}
- ~JSValueTest() {}
-
- QJSValue boolVar() const { return m_boolVar; }
- void setBoolVar(const QJSValue &v) { m_boolVar = v; emit boolVarChanged(); }
-
- QJSValue intVar() const { return m_intVar; }
- void setIntVar(const QJSValue &v) { m_intVar = v; emit intVarChanged(); }
-
- QJSValue realVar() const { return m_realVar; }
- void setRealVar(const QJSValue &v) { m_realVar = v; emit realVarChanged(); }
-
- QJSValue stringVar() const { return m_stringVar; }
- void setStringVar(const QJSValue &v) { m_stringVar = v; emit stringVarChanged(); }
-
- QJSValue urlVar() const { return m_urlVar; }
- void setUrlVar(const QJSValue &v) { m_urlVar = v; emit urlVarChanged(); }
-
- QJSValue colorVar() const { return m_colorVar; }
- void setColorVar(const QJSValue &v) { m_colorVar = v; emit colorVarChanged(); }
-
- QJSValue objectVar() const { return m_objectVar; }
- void setObjectVar(const QJSValue &v) { m_objectVar = v; emit objectVarChanged(); }
-
- QJSValue nullVar() const { return m_nullVar; }
- void setNullVar(const QJSValue &v) { m_nullVar = v; emit nullVarChanged(); }
-
- QJSValue varVar() const { return m_varVar; }
- void setVarVar(const QJSValue &v) { m_varVar = v; emit varVarChanged(); }
-
-signals:
- void boolVarChanged();
- void intVarChanged();
- void realVarChanged();
- void stringVarChanged();
- void urlVarChanged();
- void colorVarChanged();
- void objectVarChanged();
- void nullVarChanged();
- void varVarChanged();
-
-private:
- QJSValue m_boolVar;
- QJSValue m_intVar;
- QJSValue m_realVar;
- QJSValue m_stringVar;
- QJSValue m_urlVar;
- QJSValue m_colorVar;
- QJSValue m_objectVar;
- QJSValue m_nullVar;
- QJSValue m_varVar;
-};
-
-void registerTypes();
-
-#endif // TESTTYPES_H
-
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
deleted file mode 100644
index e08bccd016..0000000000
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ /dev/null
@@ -1,1125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qtest.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qdir.h>
-#include <QtQml/qqmlengine.h>
-#include <QtQml/qqmlcomponent.h>
-#include <QtCore/qdebug.h>
-#include <QtGui/qcolor.h>
-#include <QtCore/qnumeric.h>
-
-#include <private/qv4compiler_p.h>
-
-#include "../../shared/util.h"
-#include "testtypes.h"
-
-class tst_v4 : public QQmlDataTest
-{
- Q_OBJECT
-public:
- tst_v4() {}
-
-private slots:
- void initTestCase();
-
- void unnecessaryReeval();
- void logicalOr();
- void nestedLogicalOr();
- void logicalAnd();
- void nestedLogicalAnd();
- void conditionalExpr();
- void qtscript();
- void qtscript_data();
- void nestedObjectAccess();
- void subscriptionsInConditionalExpressions();
- void qtbug_21883();
- void qtbug_22816();
- void stringComparison();
- void unaryMinus();
- void unaryPlus();
- void colorType();
- void mathAbs();
- void mathCeil();
- void mathFloor();
- void mathMax();
- void mathMin();
- void mathCos();
- void mathSin();
- void singletonType();
- void integerOperations();
-
- void conversions_data();
- void conversions();
- void subscriptions();
-
- void debuggingDumpInstructions(); // this test should be last.
-
-private:
- QQmlEngine engine;
-};
-
-void tst_v4::initTestCase()
-{
- QQmlDataTest::initTestCase();
- registerTypes();
-}
-
-void tst_v4::qtscript()
-{
- QFETCH(QString, file);
- QV4Compiler::enableBindingsTest(true);
-
- QQmlComponent component(&engine, testFileUrl(file));
-
- QQmlTestMessageHandler messageHandler;
-
- QObject *o = component.create();
- delete o;
-
- QEXPECT_FAIL("jsvalueHandling", "QTBUG-26951 - QJSValue has a different representation of NULL to QV8Engine", Continue);
- const int v4ErrorCount = messageHandler.messages().filter(QLatin1String("QV4")).size();
- QVERIFY2(v4ErrorCount == 0, qPrintable(messageHandler.messageString()));
-
- QV4Compiler::enableBindingsTest(false);
-}
-
-void tst_v4::qtscript_data()
-{
- QTest::addColumn<QString>("file");
-
- QTest::newRow("equals") << "equals.qml";
- QTest::newRow("strict equals") << "strictEquals.qml";
- QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml";
- QTest::newRow("exception on fetch") << "fetchException.qml";
- QTest::newRow("logical or") << "logicalOr.qml";
- QTest::newRow("conditional expressions") << "conditionalExpr.qml";
- QTest::newRow("double bool jump") << "doubleBoolJump.qml";
- QTest::newRow("unary minus") << "unaryMinus.qml";
- QTest::newRow("null qobject") << "nullQObject.qml";
- QTest::newRow("qobject -> bool") << "objectToBool.qml";
- QTest::newRow("conversion from bool") << "conversions.1.qml";
- QTest::newRow("conversion from int") << "conversions.2.qml";
- QTest::newRow("conversion from float") << "conversions.3.qml";
- QTest::newRow("conversion from double") << "conversions.4.qml";
- QTest::newRow("conversion from real") << "conversions.5.qml";
- QTest::newRow("conversion from string") << "conversions.6.qml";
- QTest::newRow("conversion from url") << "conversions.7.qml";
- QTest::newRow("conversion from vec3") << "conversions.8.qml";
- QTest::newRow("variantHandling") << "variantHandling.qml";
- QTest::newRow("varHandling") << "varHandling.qml";
- QTest::newRow("jsvalueHandling") << "jsvalueHandling.qml";
- QTest::newRow("integerOperations") << "integerOperations.qml";
-}
-
-void tst_v4::unnecessaryReeval()
-{
- QQmlComponent component(&engine, testFileUrl("unnecessaryReeval.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->resultCounter(), 1);
- QCOMPARE(ro->result(), 19);
- ro->resetResultCounter();
-
- ro->setProperty("b", 6);
-
- QCOMPARE(ro->resultCounter(), 1);
- QCOMPARE(ro->result(), 6);
- ro->resetResultCounter();
-
- ro->setProperty("a", 14);
-
- QCOMPARE(ro->resultCounter(), 1);
- QCOMPARE(ro->result(), 7);
- ro->resetResultCounter();
-
- ro->setProperty("b", 14);
- QCOMPARE(ro->resultCounter(), 0);
- QCOMPARE(ro->result(), 7);
-
- delete o;
-}
-
-void tst_v4::logicalOr()
-{
- {
- QQmlComponent component(&engine, testFileUrl("logicalOr.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 0);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalOr.2.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-}
-
-void tst_v4::nestedLogicalOr()
-{
- //we are primarily testing that v4 does not get caught in a loop (QTBUG-24038)
- QQmlComponent component(&engine, testFileUrl("nestedLogicalOr.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
-}
-
-void tst_v4::logicalAnd()
-{
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 0);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.2.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.3.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-
- {
- // QTBUG-24660
- QQmlComponent component(&engine, testFileUrl("logicalAnd.4.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.5.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.6.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("logicalAnd.7.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
- }
-}
-
-void tst_v4::nestedLogicalAnd()
-{
- QQmlComponent component(&engine, testFileUrl("nestedLogicalAnd.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 1);
- delete o;
-}
-
-void tst_v4::conditionalExpr()
-{
- {
- QQmlComponent component(&engine, testFileUrl("conditionalExpr.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 0);
- delete o;
- }
-}
-
-// This would previously use the metaObject of the root element to result the nested access.
-// That is, the index for accessing "result" would have been RootObject::result, instead of
-// NestedObject::result.
-void tst_v4::nestedObjectAccess()
-{
- {
- QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 37);
-
- delete o;
- }
-
- {
- QQmlComponent component(&engine, testFileUrl("nestedObjectAccess2.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->result(), 37);
-
- delete o;
- }
-}
-
-void tst_v4::subscriptionsInConditionalExpressions()
-{
- QQmlComponent component(&engine, testFileUrl("subscriptionsInConditionalExpressions.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QObject *ro = qobject_cast<QObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->property("result").toReal(), qreal(2));
-
- delete o;
-}
-
-// Crash test
-void tst_v4::qtbug_21883()
-{
- QQmlComponent component(&engine, testFileUrl("qtbug_21883.qml"));
-
- QString warning = component.url().toString() + ":4: Unable to assign null to ResultObject*";
- QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
-
- QObject *o = component.create();
- QVERIFY(o != 0);
- delete o;
-}
-
-void tst_v4::qtbug_22816()
-{
- QQmlComponent component(&engine, testFileUrl("qtbug_22816.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
- QCOMPARE(o->property("test1").toBool(), false);
- QCOMPARE(o->property("test2").toBool(), false);
- delete o;
-}
-
-void tst_v4::stringComparison()
-{
- QQmlComponent component(&engine, testFileUrl("stringComparison.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
- QCOMPARE(o->property("test1").toBool(), true);
- QCOMPARE(o->property("test2").toBool(), true);
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toBool(), true);
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QCOMPARE(o->property("test11").toBool(), true);
- QCOMPARE(o->property("test12").toBool(), true);
- QCOMPARE(o->property("test13").toBool(), true);
- QCOMPARE(o->property("test14").toBool(), true);
- QCOMPARE(o->property("test15").toBool(), true);
- QCOMPARE(o->property("test16").toBool(), true);
- QCOMPARE(o->property("test17").toBool(), true);
- QCOMPARE(o->property("test18").toBool(), true);
- QCOMPARE(o->property("test19").toBool(), true);
- QCOMPARE(o->property("test20").toBool(), true);
- QCOMPARE(o->property("test21").toBool(), true);
- QCOMPARE(o->property("test22").toBool(), true);
- delete o;
-}
-
-void tst_v4::unaryMinus()
-{
- QQmlComponent component(&engine, testFileUrl("unaryMinus.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(-18));
- QCOMPARE(o->property("test2").toInt(), -18);
- QCOMPARE(o->property("test3").toReal(), qreal(3.7));
- QCOMPARE(o->property("test4").toInt(), 4);
- QCOMPARE(o->property("test5").toReal(), qreal(3.3));
- QCOMPARE(o->property("test6").toInt(), 3);
- QCOMPARE(o->property("test7").toReal(), qreal(7));
- QCOMPARE(o->property("test8").toInt(), 7);
- QCOMPARE(o->property("test9").toReal(), qreal(-4.4));
- QCOMPARE(o->property("test10").toInt(), -4);
-
- delete o;
-}
-
-void tst_v4::unaryPlus()
-{
- QQmlComponent component(&engine, testFileUrl("unaryPlus.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(18));
- QCOMPARE(o->property("test2").toInt(), 18);
- QCOMPARE(o->property("test3").toReal(), qreal(-3.7));
- QCOMPARE(o->property("test4").toInt(), -4);
- QCOMPARE(o->property("test5").toReal(), qreal(-3.3));
- QCOMPARE(o->property("test6").toInt(), -3);
- QCOMPARE(o->property("test7").toReal(), qreal(-7));
- QCOMPARE(o->property("test8").toInt(), -7);
- QCOMPARE(o->property("test9").toReal(), qreal(4.4));
- QCOMPARE(o->property("test10").toInt(), 4);
-
- delete o;
-}
-
-void tst_v4::colorType()
-{
- QQmlComponent component(&engine, testFileUrl("colorType.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
- QCOMPARE(o->property("test1").value<QColor>(), QColor("red"));
- QCOMPARE(o->property("test2").value<QColor>(), QColor("red"));
- QCOMPARE(o->property("test3").value<QColor>(), QColor("red"));
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toBool(), true);
- QCOMPARE(o->property("test7").toBool(), true);
- delete o;
-}
-
-void tst_v4::mathAbs()
-{
- QQmlComponent component(&engine, testFileUrl("mathAbs.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(3.7));
- QCOMPARE(o->property("test2").toReal(), qreal(4.5));
- QCOMPARE(o->property("test3").toInt(), 18);
- QCOMPARE(o->property("test4").toInt(), 72);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toBool(), true);
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toInt(), 82);
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QCOMPARE(o->property("test11").toInt(), 0);
- QCOMPARE(o->property("test12").toBool(), true);
-
- delete o;
-}
-
-void tst_v4::mathCeil()
-{
- QQmlComponent component(&engine, testFileUrl("mathCeil.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(-3));
- QCOMPARE(o->property("test2").toReal(), qreal(5));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toReal(), qreal(83));
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toInt(), 0);
- QCOMPARE(o->property("test10").toBool(), true);
- QCOMPARE(o->property("test11").toBool(), true);
-
- delete o;
-}
-
-void tst_v4::mathFloor()
-{
- QQmlComponent component(&engine, testFileUrl("mathFloor.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(-4));
- QCOMPARE(o->property("test2").toReal(), qreal(4));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toReal(), qreal(82));
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toInt(), 0);
- QCOMPARE(o->property("test10").toBool(), true);
-
- delete o;
-}
-
-void tst_v4::mathMax()
-{
- QQmlComponent component(&engine, testFileUrl("mathMax.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(4.4));
- QCOMPARE(o->property("test2").toReal(), qreal(7));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toReal(), qreal(82.6));
- QCOMPARE(o->property("test7").toReal(), qreal(4.4));
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QCOMPARE(o->property("test11").toReal(), qreal(0));
- QCOMPARE(o->property("test12").toReal(), qreal(4.4));
- QCOMPARE(o->property("test13").toReal(), qreal(7));
-
- delete o;
-}
-
-void tst_v4::mathMin()
-{
- QQmlComponent component(&engine, testFileUrl("mathMin.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("test1").toReal(), qreal(-3.7));
- QCOMPARE(o->property("test2").toReal(), qreal(4.4));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QCOMPARE(o->property("test6").toReal(), qreal(82.6));
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toReal(), qreal(4.4));
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QCOMPARE(o->property("test11").toReal(), qreal(-3.7));
- QCOMPARE(o->property("test12").toReal(), qreal(0));
- QCOMPARE(o->property("test13").toReal(), qreal(-3.7));
- delete o;
-}
-
-static bool fuzzyCompare(qreal a, qreal b)
-{
- const qreal EPSILON = 0.0001;
- return (a + EPSILON > b) && (a - EPSILON < b);
-}
-
-void tst_v4::mathCos()
-{
- QQmlComponent component(&engine, testFileUrl("mathCos.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QVERIFY(fuzzyCompare(o->property("test1").toReal(), qreal(-0.848100)));
- QVERIFY(fuzzyCompare(o->property("test2").toReal(), qreal(-0.307333)));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QVERIFY(fuzzyCompare(o->property("test6").toReal(), qreal(0.606941)));
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QVERIFY(fuzzyCompare(o->property("test11").toReal(), qreal(0.890792)));
-
- delete o;
-}
-
-void tst_v4::mathSin()
-{
- QQmlComponent component(&engine, testFileUrl("mathSin.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QVERIFY(fuzzyCompare(o->property("test1").toReal(), qreal(0.529836)));
- QVERIFY(fuzzyCompare(o->property("test2").toReal(), qreal(-0.951602)));
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- QVERIFY(fuzzyCompare(o->property("test6").toReal(), qreal(0.794747)));
- QCOMPARE(o->property("test7").toBool(), true);
- QCOMPARE(o->property("test8").toBool(), true);
- QCOMPARE(o->property("test9").toBool(), true);
- QCOMPARE(o->property("test10").toBool(), true);
- QVERIFY(fuzzyCompare(o->property("test11").toReal(), qreal(0.454411)));
-
- delete o;
-}
-
-void tst_v4::integerOperations()
-{
- QQmlComponent component(&engine, testFileUrl("integerOperations.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QCOMPARE(o->property("testa1").toInt(), 333);
- QCOMPARE(o->property("testa2").toInt(), -666);
-
- QCOMPARE(o->property("testb1").toInt(), 0);
- QCOMPARE(o->property("testb2").toInt(), 2);
- QCOMPARE(o->property("testb3").toInt(), 0);
- QCOMPARE(o->property("testb4").toInt(), 2);
- QCOMPARE(o->property("testb5").toInt(), 0);
- QCOMPARE(o->property("testb6").toInt(), 2);
- QCOMPARE(o->property("testb7").toInt(), 0);
- QCOMPARE(o->property("testb8").toInt(), 2);
-
- QCOMPARE(o->property("testc1").toInt(), 335);
- QCOMPARE(o->property("testc2").toInt(), -666);
- QCOMPARE(o->property("testc3").toInt(), 335);
- QCOMPARE(o->property("testc4").toInt(), -666);
- QCOMPARE(o->property("testc5").toInt(), 335);
- QCOMPARE(o->property("testc6").toInt(), -666);
- QCOMPARE(o->property("testc7").toInt(), 335);
- QCOMPARE(o->property("testc8").toInt(), -666);
-
- QCOMPARE(o->property("testd1").toInt(), 330);
- QCOMPARE(o->property("testd2").toInt(), 330);
- QCOMPARE(o->property("testd3").toInt(), 330);
- QCOMPARE(o->property("testd4").toInt(), 330);
-
- QCOMPARE(o->property("teste1").toInt(), 28);
- QCOMPARE(o->property("teste2").toInt(), -28);
- QCOMPARE(o->property("teste3").toInt(), 256);
- QCOMPARE(o->property("teste4").toInt(), 28);
- QCOMPARE(o->property("teste5").toInt(), -28);
- QCOMPARE(o->property("teste6").toInt(), 256);
-
- QCOMPARE(o->property("testf1").toInt(), 1);
- QCOMPARE(o->property("testf2").toInt(), -2);
- QCOMPARE(o->property("testf3").toInt(), 0);
- QCOMPARE(o->property("testf4").toInt(), 1);
- QCOMPARE(o->property("testf5").toInt(), -2);
- QCOMPARE(o->property("testf6").toInt(), 0);
-
- QCOMPARE(o->property("testg1").toInt(), 1);
- QCOMPARE(o->property("testg2").toInt(), 0x3FFFFFFE);
- QCOMPARE(o->property("testg3").toInt(), 0);
- QCOMPARE(o->property("testg4").toInt(), 1);
- QCOMPARE(o->property("testg5").toInt(), 0x3FFFFFFE);
- QCOMPARE(o->property("testg6").toInt(), 0);
-
- delete o;
-}
-
-class V4SingletonType : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int ip READ ip WRITE setIp NOTIFY ipChanged FINAL)
-public:
- V4SingletonType() : m_ip(12) {}
- ~V4SingletonType() {}
-
- Q_INVOKABLE int random() { static int prng = 3; prng++; m_ip++; emit ipChanged(); return prng; }
-
- int ip() const { return m_ip; }
- void setIp(int v) { m_ip = v; emit ipChanged(); }
-
-signals:
- void ipChanged();
-
-private:
- int m_ip;
-};
-
-static QObject *v4_module_api_factory(QQmlEngine*, QJSEngine*)
-{
- return new V4SingletonType;
-}
-
-void tst_v4::singletonType()
-{
- // register singleton type, providing typeinfo via template
- qmlRegisterSingletonType<V4SingletonType>("Qt.test", 1, 0, "V4", v4_module_api_factory);
- QQmlComponent component(&engine, testFileUrl("singletonType.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
- QCOMPARE(o->property("testProp").toInt(), 12);
- QCOMPARE(o->property("testProp2").toInt(), 2);
- QMetaObject::invokeMethod(o, "getRandom");
- QCOMPARE(o->property("testProp").toInt(), 13);
- QCOMPARE(o->property("testProp2").toInt(), 4);
- delete o;
-}
-
-void tst_v4::conversions_data()
-{
- QTest::addColumn<QUrl>("file");
- QTest::addColumn<QStringList>("warnings");
- QTest::addColumn<bool>("boolProp");
- QTest::addColumn<int>("intProp");
- QTest::addColumn<float>("floatProp");
- QTest::addColumn<double>("doubleProp");
- QTest::addColumn<qreal>("qrealProp");
- QTest::addColumn<QString>("qstringProp");
- QTest::addColumn<QUrl>("qurlProp");
- QTest::addColumn<QVector3D>("vec3Prop");
-
- QTest::newRow("from bool") << testFileUrl("conversions.1.qml")
- << (QStringList() << (testFileUrl("conversions.1.qml").toString() + QLatin1String(":11:15: Unable to assign bool to QUrl")))
- << true
- << (int)true
- << (float)1.0
- << (double)1.0
- << (qreal)1.0
- << QString(QLatin1String("true"))
- << QUrl() // cannot assign bool to url.
- << QVector3D(1, 1, 1);
-
- QTest::newRow("from integer") << testFileUrl("conversions.2.qml")
- << (QStringList() << (testFileUrl("conversions.2.qml").toString() + QLatin1String(":11:15: Unable to assign int to QUrl")))
- << (bool)4
- << 4
- << (float)4.0
- << (double)4.0
- << (qreal)4.0
- << QString(QLatin1String("4"))
- << QUrl() // cannot assign int to url.
- << QVector3D(4, 4, 4);
-
- QTest::newRow("from float") << testFileUrl("conversions.3.qml")
- << (QStringList() << (testFileUrl("conversions.3.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
- << (bool)4.4
- << (int)4.4
- << (float)4.4
- << (double)((float)4.4)
- << (qreal)((float)4.4)
- << QString::number((double)((float)4.4), 'g', 16)
- << QUrl() // cannot assign number to url.
- << QVector3D(4.4, 4.4, 4.4);
-
- QTest::newRow("from double") << testFileUrl("conversions.4.qml")
- << (QStringList() << (testFileUrl("conversions.4.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
- << (bool)4.444444444
- << (int)4.444444444
- << (float)4.444444444
- << (double)4.444444444
- << (qreal)4.444444444
- << QString::number((double)4.444444444, 'g', 16)
- << QUrl() // cannot assign number to url.
- << QVector3D(4.444444444, 4.444444444, 4.444444444);
-
- QTest::newRow("from qreal") << testFileUrl("conversions.5.qml")
- << (QStringList() << (testFileUrl("conversions.5.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
- << (bool)4.44
- << (int)4.44
- << (float)4.44
- << (double)4.44
- << (qreal)4.44
- << QString(QLatin1String("4.44"))
- << QUrl() // cannot assign number to url.
- << QVector3D(4.44, 4.44, 4.44);
-
- QTest::newRow("from string") << testFileUrl("conversions.6.qml")
- << (QStringList())
- << true
- << 4
- << (float)4.0
- << (double)4.0
- << (qreal)4.0
- << QString(QLatin1String("4"))
- << QUrl(testFileUrl("").toString() + QString(QLatin1String("4")))
- << QVector3D(4, 4, 4);
-
- QTest::newRow("from url") << testFileUrl("conversions.7.qml")
- << (QStringList() << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":6:14: Unable to assign QUrl to int"))
- << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":7:16: Unable to assign QUrl to number"))
- << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":8:17: Unable to assign QUrl to number"))
- << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":9:16: Unable to assign QUrl to number")))
- << true
- << 0
- << (float) 0
- << (double) 0
- << (qreal) 0
- << QString(testFileUrl("").toString() + QString(QLatin1String("4")))
- << QUrl(testFileUrl("").toString() + QString(QLatin1String("4")))
- << QVector3D(qQNaN(), qQNaN(), qQNaN());
-
- QTest::newRow("from vector") << testFileUrl("conversions.8.qml")
- << (QStringList() << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":11: Unable to assign QVector3D to QUrl"))
- << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":10: Unable to assign QVector3D to QString"))
- << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":9: Unable to assign QVector3D to double"))
- << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":8: Unable to assign QVector3D to double"))
- << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":7: Unable to assign QVector3D to float"))
- << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":6: Unable to assign QVector3D to int")))
- << true // non-null therefore true
- << (int)0 // the other values should be the default-ctor values.
- << (float)0
- << (double)0
- << (qreal)0
- << QString()
- << QUrl()
- << QVector3D(4, 4, 4); // except this one.
-}
-
-#define COMPARE_NUMBER(type, prop, expected) \
- if (qIsNaN(expected)) \
- QVERIFY(qIsNaN(qvariant_cast<type>(prop))); \
- else \
- QCOMPARE((prop), QVariant::fromValue<type>(expected));
-
-void tst_v4::conversions()
-{
- QFETCH(QUrl, file);
- QFETCH(QStringList, warnings);
- QFETCH(bool, boolProp);
- QFETCH(int, intProp);
- QFETCH(float, floatProp);
- QFETCH(double, doubleProp);
- QFETCH(qreal, qrealProp);
- QFETCH(QString, qstringProp);
- QFETCH(QUrl, qurlProp);
- QFETCH(QVector3D, vec3Prop);
-
- foreach (const QString &w, warnings)
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w));
-
- QQmlComponent component(&engine, file);
- QObject *o = component.create();
- QVERIFY(o != 0);
- QCOMPARE(o->property("boolProp"), QVariant::fromValue<bool>(boolProp));
- QCOMPARE(o->property("intProp"), QVariant::fromValue<int>(intProp));
- COMPARE_NUMBER(float, o->property("floatProp"), floatProp);
- COMPARE_NUMBER(double, o->property("doubleProp"), doubleProp);
- COMPARE_NUMBER(qreal, o->property("qrealProp"), qrealProp);
- QCOMPARE(o->property("qstringProp"), QVariant::fromValue<QString>(qstringProp));
- QCOMPARE(o->property("qurlProp"), QVariant::fromValue<QUrl>(qurlProp));
-
- QVector3D vec3 = qvariant_cast<QVector3D>(o->property("vec3Prop"));
- COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.x()), vec3Prop.x());
- COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.y()), vec3Prop.y());
- COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.z()), vec3Prop.z());
- delete o;
-}
-
-void tst_v4::subscriptions()
-{
- {
- QQmlComponent component(&engine, testFileUrl("subscriptions.1.qml"));
-
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- QObject *ro = qobject_cast<QObject *>(o);
- QVERIFY(ro != 0);
-
- QCOMPARE(ro->property("targetHeight"), QVariant::fromValue<qreal>(201));
-
- delete o;
- }
-}
-
-static QByteArray getAddress(int address)
-{
- return QByteArray::number(address);
-}
-
-static QByteArray getLeading(int address)
-{
- QByteArray leading;
- if (address != -1) {
- leading = getAddress(address);
- leading.prepend(QByteArray(8 - leading.count(), ' '));
- }
- return leading;
-}
-
-#include <private/qv4instruction_p.h>
-void tst_v4::debuggingDumpInstructions()
-{
- QStringList expectedPreAddress;
- expectedPreAddress << "\t\tNoop";
- expectedPreAddress << "\t0:0:";
- expectedPreAddress << "\t\tSubscribeId\t\tId_Offset(0) -> Subscribe_Slot(0)";
- expectedPreAddress << "\t\tFetchAndSubscribe\tObject_Reg(0) Fast_Accessor(0x0) -> Output_Reg(0) Subscription_Slot(0)";
- expectedPreAddress << "\t\tLoadId\t\t\tId_Offset(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadScope\t\t-> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadRoot\t\t-> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadSingletonObject\t\t) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadAttached\t\tObject_Reg(0) Attached_Index(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tUnaryNot\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tUnaryMinusNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tUnaryMinusInt\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tUnaryPlusNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tUnaryPlusInt\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToInt\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToNumber\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToString\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertBoolToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToNumber\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToString\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertIntToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertJSValueToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToInt\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToString\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNumberToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToInt\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToNumber\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToUrl\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToColor\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertStringToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertUrlToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertUrlToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertUrlToString\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertUrlToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertUrlToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertColorToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertColorToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertColorToString\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertColorToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertColorToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertObjectToBool\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertObjectToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertObjectToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertObjectToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertVarToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNullToJSValue\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNullToObject\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNullToVariant\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tConvertNullToVar\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tResolveUrl\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathSinNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathCosNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathAbsNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathRoundNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathFloorNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathCeilNumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathPINumber\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadNull\t\tConstant(null) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadNumber\t\tConstant(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadInt\t\t\tConstant(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadBool\t\tConstant(false) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLoadString\t\tString_DataIndex(0) String_Length(0) -> Output_Register(0)";
- expectedPreAddress << "\t\tEnableV4Test\t\tString_DataIndex(0) String_Length(0)";
- expectedPreAddress << "\t\tTestV4Store\t\tInput_Reg(0) Reg_Type(0)";
- expectedPreAddress << "\t\tBitAndInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tBitOrInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tBitXorInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tAddNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tAddString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tSubNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMulNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tDivNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tModNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tRShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tURShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tGtNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLtNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tGeNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLeNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tNotEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictNotEqualNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tGtString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLtString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tGeString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tLeString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tEqualString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tNotEqualString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictEqualString\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictNotEqualString\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tEqualObject\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tNotEqualObject\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictEqualObject\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStrictNotEqualObject\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathMaxNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tMathMinNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tNewString\t\tRegister(0)";
- expectedPreAddress << "\t\tNewUrl\t\t\tRegister(0)";
- expectedPreAddress << "\t\tCleanupRegister\t\tRegister(0)";
- expectedPreAddress << "\t\tCopy\t\t\tInput_Reg(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tFetch\t\t\tObject_Reg(0) Property_Index(0) -> Output_Reg(0)";
- expectedPreAddress << "\t\tStore\t\t\tInput_Reg(0) -> Object_Reg(0) Property_Index(0)";
- expectedPreAddress << "\t\tJump\t\t\tAddress(UNIT_TEST_JUMP_ADDRESS) [if false == Input_Reg(0)]"; //(address + size() + i->jump.count)
- expectedPreAddress << "\t\tBranchTrue\t\tAddress(UNIT_TEST_BRANCH_ADDRESS) [if true == Input_Reg(0)]"; //(address + size() + i->branchop.offset)
- expectedPreAddress << "\t\tBranchFalse\t\tAddress(UNIT_TEST_BRANCH_ADDRESS) [if false == Input_Reg(0)]"; //(address + size() + i->branchop.offset)
- expectedPreAddress << "\t\tBranch\t\t\tAddress(UNIT_TEST_BRANCH_ADDRESS)"; //(address + size() + i->branchop.offset)
- expectedPreAddress << "\t\tBlock\t\t\tMask(0)";
- expectedPreAddress << "\t\tThrow\t\t\tInputReg(0)";
- expectedPreAddress << "\t\tInitString\t\tString_DataIndex(0) -> String_Slot(0)";
- QStringList expected;
-
- QQmlTestMessageHandler messageHandler;
-
- QQmlJS::Bytecode bc;
-#define DUMP_INSTR_IN_UNIT_TEST(I, FMT) { QQmlJS::V4InstrData<QQmlJS::V4Instr::I> i; memset(&i, 0, sizeof(i)); bc.append(i); }
- FOR_EACH_V4_INSTR(DUMP_INSTR_IN_UNIT_TEST);
-#undef DUMP_INSTR_IN_UNIT_TEST // NOTE: we memset in order to ensure stable output.
- const char *start = bc.constData();
- const char *end = start + bc.size();
- const char *codeAddr = start;
- int whichExpected = 0;
-#define DUMP_INSTR_SIZE_IN_UNIT_TEST(I, FMT) { \
- QString currExpected = whichExpected < expectedPreAddress.size() ? expectedPreAddress.at(whichExpected++) : QString(); \
- currExpected.prepend(getLeading(codeAddr - start)); \
- expected.append(currExpected); \
- codeAddr += QQmlJS::V4Instr::size(static_cast<QQmlJS::V4Instr::Type>(QQmlJS::V4Instr::I)); \
- }
- FOR_EACH_V4_INSTR(DUMP_INSTR_SIZE_IN_UNIT_TEST);
-#undef DUMP_INSTR_SIZE_IN_UNIT_TEST // so that we generate the correct address for each instruction comparison
- bc.dump(start, end);
-
- // ensure that the output was expected.
- const int messageCount = messageHandler.messages().count();
- QCOMPARE(messageCount, expected.count());
- for (int ii = 0; ii < messageCount; ++ii) {
- // Calculating the destination address of a null jump/branch instruction is tricky
- // so instead we simply don't compare that part of those instructions.
- QRegExp ignoreAddress("\\bAddress\\((\\w*)\\)");
- ignoreAddress.setMinimal(true);
- QString expectOut = expected.at(ii); expectOut.replace(ignoreAddress, "");
- QString actualOut = messageHandler.messages().at(ii); actualOut.replace(ignoreAddress, "");
- QCOMPARE(actualOut, expectOut);
- }
-}
-
-
-QTEST_MAIN(tst_v4)
-
-#include "tst_v4.moc"
diff --git a/tests/auto/qml/v4/v4.pro b/tests/auto/qml/v4/v4.pro
deleted file mode 100644
index ef549538da..0000000000
--- a/tests/auto/qml/v4/v4.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qqmlv4
-macx:CONFIG -= app_bundle
-
-SOURCES += tst_v4.cpp \
- testtypes.cpp
-HEADERS += testtypes.h
-
-include (../../shared/util.pri)
-
-TESTDATA = data/*
-
-CONFIG += parallel_test
-
-QT += core-private gui-private qml-private network testlib
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index bce1f9e4a2..2db79d7794 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -64,6 +64,7 @@
#include "../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
#include <QtGui/qstylehints.h>
+#include <qmath.h>
#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index d1ed6dd05a..7bde37af38 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -55,6 +55,7 @@
#include <QDebug>
#include <QDir>
#include <math.h>
+#include <qmath.h>
#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>