diff options
Diffstat (limited to 'src/declarative/qml/v8')
52 files changed, 548 insertions, 181 deletions
diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp index 5153043dc9..830b521027 100644 --- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp +++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -80,6 +80,36 @@ enum ConsoleLogTypes { Error }; +static QString extendMessage(const QString &msg) { + if (qmlConsoleExtended()) { + v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); + if (stackTrace->GetFrameCount()) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + int line = frame->GetLineNumber(); + QString scriptName = QString::fromUtf16(*v8::String::Value(frame->GetScriptName())); + + return QString::fromLatin1("%1 (%2:%3)").arg(msg).arg(scriptName).arg(line); + } + } + return msg; +} + +static void printStack() { + //The v8 default is currently 10 stack frames. + v8::Handle<v8::StackTrace> stackTrace = + v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); + int stackCount = stackTrace->GetFrameCount(); + + for (int i = 0; i < stackCount; i++) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i); + v8::String::Utf8Value func_name(frame->GetFunctionName()); + v8::String::Utf8Value script_name(frame->GetScriptName()); + int lineNumber = frame->GetLineNumber(); + int columnNumber = frame->GetColumn(); + qDebug("%s (%s:%d:%d)\n", *func_name, *script_name, lineNumber, columnNumber); + } +} + v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args) { v8::HandleScope handleScope; @@ -105,19 +135,7 @@ v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args } } - if (qmlConsoleExtended()) { - int line = -1; - QString scriptName; - //get only current frame - v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); - if (stackTrace->GetFrameCount()) { - v8::Local<v8::StackFrame> currentStackFrame = stackTrace->GetFrame(0); - line = currentStackFrame->GetLineNumber(); - scriptName = V8ENGINE()->toString(currentStackFrame->GetScriptName()); - } - - result = QString(QLatin1String("%1 (%2:%3)")).arg(result).arg(scriptName).arg(line); - } + result = extendMessage(result); switch (logType) { case Log: @@ -152,6 +170,7 @@ v8::Handle<v8::Value> consoleLog(const v8::Arguments &args) { //console.log //console.debug + //console.info //print return console(Log, args); } @@ -217,24 +236,39 @@ v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args) return v8::Undefined(); } -v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args) +v8::Handle<v8::Value> consoleCount(const v8::Arguments &args) { - if (args.Length() != 0) - V8THROW_ERROR("console.trace(): Invalid arguments"); + // first argument: name to print. Ignore any additional arguments + QString name; + if (args.Length() > 0) + name = V8ENGINE()->toString(args[0]); - //The v8 default is currently 10 stack frames. v8::Handle<v8::StackTrace> stackTrace = - v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); - int stackCount = stackTrace->GetFrameCount(); + v8::StackTrace::CurrentStackTrace(1, v8::StackTrace::kOverview); - for (int i = 0; i < stackCount; i++) { - v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i); - v8::String::Utf8Value func_name(frame->GetFunctionName()); - v8::String::Utf8Value script_name(frame->GetScriptName()); - int lineNumber = frame->GetLineNumber(); - int columnNumber = frame->GetColumn(); - qDebug("%s (%s:%d:%d)\n", *func_name, *script_name, lineNumber, columnNumber); + if (stackTrace->GetFrameCount()) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + + QString scriptName = V8ENGINE()->toString(frame->GetScriptName()); + int line = frame->GetLineNumber(); + int column = frame->GetColumn(); + + int value = V8ENGINE()->consoleCountHelper(scriptName, line, column); + QString message = name + QLatin1String(": ") + QString::number(value); + if (qmlConsoleExtended()) + message = QString::fromLatin1("%1 (%2:%3)").arg(message).arg(scriptName).arg(line); + qDebug("%s", qPrintable(message)); } + + return v8::Undefined(); +} + +v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args) +{ + if (args.Length() != 0) + V8THROW_ERROR("console.trace(): Invalid arguments"); + + printStack(); return v8::Undefined(); } @@ -243,6 +277,38 @@ v8::Handle<v8::Value> consoleWarn(const v8::Arguments &args) return console(Warn, args); } +v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args) +{ + if (args.Length() == 0) + V8THROW_ERROR("console.assert(): Missing argument"); + + if (!args[0]->ToBoolean()->Value()) { + QString message; + for (int i = 1; i < args.Length(); ++i) { + if (i != 1) + message.append(QLatin1Char(' ')); + + v8::Local<v8::Value> value = args[i]; + message.append(V8ENGINE()->toString(value->ToString())); + } + + message = extendMessage(message); + qCritical("%s", qPrintable(message)); + printStack(); + } + return v8::Undefined(); +} + +v8::Handle<v8::Value> consoleException(const v8::Arguments &args) +{ + if (args.Length() == 0) + V8THROW_ERROR("console.exception(): Missing argument"); + console(Error, args); + printStack(); + + return v8::Undefined(); +} + v8::Handle<v8::Value> stringArg(const v8::Arguments &args) { QString value = V8ENGINE()->toString(args.This()->ToString()); diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h b/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h index 815182f2a5..62dcffb367 100644 --- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h +++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -67,8 +67,11 @@ 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); diff --git a/src/declarative/qml/v8/qjsconverter_impl_p.h b/src/declarative/qml/v8/qjsconverter_impl_p.h index d00e9f5760..d5196fd619 100644 --- a/src/declarative/qml/v8/qjsconverter_impl_p.h +++ b/src/declarative/qml/v8/qjsconverter_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qjsconverter_p.h b/src/declarative/qml/v8/qjsconverter_p.h index 442c734c8c..95dee96f25 100644 --- a/src/declarative/qml/v8/qjsconverter_p.h +++ b/src/declarative/qml/v8/qjsconverter_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsengine.cpp b/src/declarative/qml/v8/qjsengine.cpp index 6bcd3ab134..97e247a6cb 100644 --- a/src/declarative/qml/v8/qjsengine.cpp +++ b/src/declarative/qml/v8/qjsengine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -158,6 +158,8 @@ QJSEngine::QJSEngine() { } +#ifdef QT_DEPRECATED + /*! \internal */ @@ -166,6 +168,8 @@ QJSEngine::QJSEngine(QJSEngine::ContextOwnership ownership) { } +#endif // QT_DEPRECATED + /*! Constructs a QJSEngine object with the given \a parent. @@ -198,7 +202,11 @@ QJSEngine::~QJSEngine() \internal */ +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if the last script evaluation resulted in an uncaught exception; otherwise returns false. @@ -215,6 +223,8 @@ bool QJSEngine::hasUncaughtException() const } /*! + \obsolete + Returns the current uncaught exception, or an invalid QJSValue if there is no uncaught exception. @@ -233,6 +243,8 @@ QJSValue QJSEngine::uncaughtException() const } /*! + \obsolete + Clears any uncaught exceptions in this engine. \sa hasUncaughtException() @@ -244,6 +256,7 @@ void QJSEngine::clearExceptions() d->clearExceptions(); } +#endif // QT_DEPRECATED /*! Runs the garbage collector. @@ -298,7 +311,11 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in return QJSValuePrivate::get(d->evaluate(program, fileName, lineNumber)); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns a QJSValue of the primitive type Null. \sa nullValue() @@ -312,6 +329,8 @@ QJSValue QJSEngine::nullValue() } /*! + \obsolete + Returns a QJSValue of the primitive type Undefined. \sa nullValue() @@ -324,6 +343,8 @@ QJSValue QJSEngine::undefinedValue() return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Undefined())); } +#endif // QT_DEPRECATED + /*! Creates a JavaScript object of class Object. @@ -382,7 +403,11 @@ QJSValue QJSEngine::newQObject(QObject *object) return d->scriptValueFromInternal(d->newQObject(object, QV8Engine::JavaScriptOwnership)); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Creates a JavaScript object holding the given variant \a value. If a default prototype has been registered with the meta type id of @@ -400,6 +425,7 @@ QJSValue QJSEngine::newVariant(const QVariant &value) return d->scriptValueFromInternal(d->newVariant(value)); } +#endif // QT_DEPRECATED /*! Returns this engine's Global Object. @@ -419,7 +445,11 @@ QJSValue QJSEngine::globalObject() const return d->scriptValueFromInternal(d->global()); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Converts the given \a value to an object, if such a conversion is possible; otherwise returns an invalid QJSValue. The conversion is performed according to the following table: @@ -445,6 +475,8 @@ QJSValue QJSEngine::toObject(const QJSValue& value) } /*! + \obsolete + Creates a JavaScript object of class Date from the given \a value. \sa QJSValue::toDateTime() @@ -458,6 +490,8 @@ QJSValue QJSEngine::newDate(const QDateTime &dt) } /*! + \obsolete + Creates a JavaScript object of class Date with the given \a value (the number of milliseconds since 01 January 1970, UTC). @@ -471,6 +505,8 @@ QJSValue QJSEngine::newDate(double date) } /*! + \obsolete + Creates a JavaScript object of class RegExp with the given \a regexp. @@ -485,6 +521,8 @@ QJSValue QJSEngine::newRegExp(const QRegExp ®exp) } /*! + \obsolete + Creates a JavaScript object of class RegExp with the given \a pattern and \a flags. @@ -499,6 +537,8 @@ QJSValue QJSEngine::newRegExp(const QString &pattern, const QString &flags) return QJSValuePrivate::get(d->newRegExp(pattern, flags)); } +#endif // QT_DEPRECATED + /*! * \internal * used by QJSEngine::toScriptValue diff --git a/src/declarative/qml/v8/qjsengine.h b/src/declarative/qml/v8/qjsengine.h index 09e055fcaf..877f6555f4 100644 --- a/src/declarative/qml/v8/qjsengine.h +++ b/src/declarative/qml/v8/qjsengine.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -35,7 +35,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDateTime; class QV8Engine; @@ -51,13 +50,15 @@ class Q_DECLARATIVE_EXPORT QJSEngine { Q_OBJECT public: +#ifdef QT_DEPRECATED enum ContextOwnership { AdoptCurrentContext, CreateNewContext }; + QT_DEPRECATED explicit QJSEngine(ContextOwnership ownership); +#endif QJSEngine(); - explicit QJSEngine(ContextOwnership ownership); explicit QJSEngine(QObject *parent); virtual ~QJSEngine(); @@ -65,22 +66,8 @@ public: QJSValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1); - bool hasUncaughtException() const; - QJSValue uncaughtException() const; - void clearExceptions(); - - QJSValue nullValue(); - QJSValue undefinedValue(); - - QJSValue newVariant(const QVariant &value); - - QJSValue newRegExp(const QRegExp ®exp); - QJSValue newObject(); QJSValue newArray(uint length = 0); - QJSValue newRegExp(const QString &pattern, const QString &flags); - QJSValue newDate(double value); - QJSValue newDate(const QDateTime &value); QJSValue newQObject(QObject *object); @@ -97,10 +84,27 @@ public: void collectGarbage(); - QJSValue toObject(const QJSValue &value); - QV8Engine *handle() const { return d; } +#ifdef QT_DEPRECATED + QT_DEPRECATED bool hasUncaughtException() const; + QT_DEPRECATED QJSValue uncaughtException() const; + QT_DEPRECATED void clearExceptions(); + + QT_DEPRECATED QJSValue nullValue(); + QT_DEPRECATED QJSValue undefinedValue(); + + QT_DEPRECATED QJSValue newVariant(const QVariant &value); + + QT_DEPRECATED QJSValue newRegExp(const QRegExp ®exp); + + QT_DEPRECATED QJSValue newRegExp(const QString &pattern, const QString &flags); + QT_DEPRECATED QJSValue newDate(double value); + QT_DEPRECATED QJSValue newDate(const QDateTime &value); + + QT_DEPRECATED QJSValue toObject(const QJSValue &value); +#endif + Q_SIGNALS: void signalHandlerException(const QJSValue &exception); diff --git a/src/declarative/qml/v8/qjsengine_p.h b/src/declarative/qml/v8/qjsengine_p.h index 1bb8f416b4..6f4b2812be 100644 --- a/src/declarative/qml/v8/qjsengine_p.h +++ b/src/declarative/qml/v8/qjsengine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp index 7df1d04847..db77bef2b7 100644 --- a/src/declarative/qml/v8/qjsvalue.cpp +++ b/src/declarative/qml/v8/qjsvalue.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -71,9 +71,9 @@ Object values have an internal \c{prototype} property, which can be accessed with prototype() and setPrototype(). - Function objects (objects for which isFunction() returns true) can + Function objects (objects for which isCallable()) returns true) can be invoked by calling call(). Constructor functions can be used to - construct new objects by calling construct(). + construct new objects by calling callAsConstructor(). Use equals() or strictlyEquals() to compare a QJSValue to another. @@ -213,6 +213,8 @@ QJSValue::QJSValue(QScriptPassPointer<QJSValuePrivate> d) { } +#ifdef QT_DEPRECATED + /*! \obsolete @@ -325,6 +327,8 @@ QJSValue::QJSValue(QJSEngine* engine, SpecialValue value) } } +#endif // QT_DEPRECATED + /*! Constructs a new QJSValue that is a copy of \a other. @@ -344,7 +348,11 @@ QJSValue::~QJSValue() { } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if this QJSValue is valid; otherwise returns false. */ @@ -355,6 +363,8 @@ bool QJSValue::isValid() const return d->isValid(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is of the primitive type Boolean; otherwise returns false. @@ -461,11 +471,25 @@ bool QJSValue::isObject() const } /*! - Returns true if this QJSValue is a function; otherwise returns - false. + Returns true if this QJSValue can be called a function, otherwise + returns false. \sa call() */ +bool QJSValue::isCallable() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->isCallable(); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use isCallable() instead. +*/ bool QJSValue::isFunction() const { Q_D(const QJSValue); @@ -473,6 +497,8 @@ bool QJSValue::isFunction() const return d->isCallable(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is a variant value; otherwise returns false. @@ -515,7 +541,7 @@ QString QJSValue::toString() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa isNumber(), toInteger(), toInt32(), toUInt32(), toUInt16() + \sa isNumber(), toInteger(), toInt(), toUInt(), toUInt16() */ double QJSValue::toNumber() const { @@ -543,7 +569,11 @@ bool QJSValue::toBool() const return d->toBool(); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns the integer value of this QJSValue, using the conversion rules described in \l{ECMA-262} section 9.4, "ToInteger". @@ -562,6 +592,8 @@ double QJSValue::toInteger() const return d->toInteger(); } +#endif // QT_DEPRECATED + /*! Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{ECMA-262} section 9.5, "ToInt32". @@ -572,9 +604,9 @@ double QJSValue::toInteger() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toUInt32() + \sa toNumber(), toUInt() */ -qint32 QJSValue::toInt32() const +qint32 QJSValue::toInt() const { Q_D(const QJSValue); QScriptIsolate api(d->engine()); @@ -591,7 +623,33 @@ qint32 QJSValue::toInt32() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toInt32() + \sa toNumber(), toInt() +*/ +quint32 QJSValue::toUInt() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toUInt32(); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use toInt() instead. +*/ +qint32 QJSValue::toInt32() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toInt32(); +} + +/*! + \obsolete + + Use toUInt() instead. */ quint32 QJSValue::toUInt32() const { @@ -631,6 +689,8 @@ QJSValue QJSValue::toObject() const return QJSValuePrivate::get(d->toObject()); } +#endif // QT_DEPRECATED + /*! Returns the QVariant value of this QJSValue, if it can be converted to a QVariant; otherwise returns an invalid QVariant. @@ -660,9 +720,31 @@ QVariant QJSValue::toVariant() const return d->toVariant(); } +/*! + Calls this QJSValue as a function, passing \a args as arguments + to the function, and using the globalObject() as the "this"-object. + Returns the value returned from the function. + + If this QJSValue is not callable, call() does nothing and + returns an undefined QJSValue. + + Calling call() can cause an exception to occur in the script engine; + in that case, call() returns the value that was thrown (typically an + \c{Error} object). You can call + QJSEngine::hasUncaughtException() to determine if an exception + occurred. + + \sa isCallable(), callWithInstance(), callAsConstructor() +*/ +QJSValue QJSValue::call(const QJSValueList &args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->call(/*thisObject=*/0, args); +} /*! - Calls this QJSValue as a function, using \a thisObject as + Calls this QJSValue as a function, using \a instance as the `this' object in the function call, and passing \a args as arguments to the function. Returns the value returned from the function. @@ -670,7 +752,7 @@ QVariant QJSValue::toVariant() const If this QJSValue is not a function, call() does nothing and returns an invalid QJSValue. - Note that if \a thisObject is not an object, the global object + Note that if \a instance is not an object, the global object (see \l{QJSEngine::globalObject()}) will be used as the `this' object. @@ -680,15 +762,13 @@ QVariant QJSValue::toVariant() const QJSEngine::hasUncaughtException() to determine if an exception occurred. - \snippet doc/src/snippets/code/src_script_qjsvalue.cpp 1 - - \sa construct() + \sa call() */ -QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) +QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList &args) { Q_D(QJSValue); QScriptIsolate api(d->engine()); - return d->call(QJSValuePrivate::get(thisObject), args); + return d->call(QJSValuePrivate::get(instance), args); } /*! @@ -698,25 +778,53 @@ QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) constructor call is an object, then that object is returned; otherwise the default constructed object is returned. - If this QJSValue is not a function, construct() does nothing - and returns an invalid QJSValue. + If this QJSValue is not a function, callAsConstructor() does + nothing and returns an undefined QJSValue. - Calling construct() can cause an exception to occur in the script - engine; in that case, construct() returns the value that was thrown - (typically an \c{Error} object). You can call + Calling this function can cause an exception to occur in the + script engine; in that case, the value that was thrown + (typically an \c{Error} object) is returned. You can call QJSEngine::hasUncaughtException() to determine if an exception occurred. \sa call(), QJSEngine::newObject() */ +QJSValue QJSValue::callAsConstructor(const QJSValueList &args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return QJSValuePrivate::get(d->callAsConstructor(args)); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use callWithInstance() instead. +*/ +QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->call(QJSValuePrivate::get(thisObject), args); +} + +/*! + \obsolete + + Use callAsConstructor() instead. +*/ QJSValue QJSValue::construct(const QJSValueList &args) { Q_D(QJSValue); QScriptIsolate api(d->engine()); - return QJSValuePrivate::get(d->construct(args)); + return QJSValuePrivate::get(d->callAsConstructor(args)); } /*! + \obsolete + Returns the QJSEngine that created this QJSValue, or 0 if this QJSValue is invalid or the value is not associated with a particular engine. @@ -731,6 +839,7 @@ QJSEngine* QJSValue::engine() const return 0; } +#endif // QT_DEPRECATED /*! If this QJSValue is an object, returns the internal prototype @@ -839,7 +948,11 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const return d_ptr->strictlyEquals(o); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if this QJSValue is an instance of \a other; otherwise returns false. @@ -855,6 +968,8 @@ bool QJSValue::instanceOf(const QJSValue &other) const return d->instanceOf(QJSValuePrivate::get(other)); } +#endif // QT_DEPRECATED + /*! Returns the value of this QJSValue's property with the given \a name. If no such property exists, an invalid QJSValue is returned. @@ -866,7 +981,7 @@ bool QJSValue::instanceOf(const QJSValue &other) const occurred, property() returns the value that was thrown (typically an \c{Error} object). - \sa setProperty(), propertyFlags(), QJSValueIterator + \sa setProperty(), hasProperty(), QJSValueIterator */ QJSValue QJSValue::property(const QString& name) const { @@ -915,7 +1030,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const built-in properties, such as the \c{length} property of Array objects or meta properties of QObject objects. - \sa property() + \sa property(), deleteProperty() */ void QJSValue::setProperty(const QString& name, const QJSValue& value) { @@ -944,6 +1059,63 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value) } /*! + Attempts to delete this object's property of the given \a name. + Returns true if the property was deleted, otherwise returns false. + + The behavior of this function is consistent with the JavaScript + delete operator. In particular: + + \list + \o Non-configurable properties cannot be deleted. + \o This function will return true even if this object doesn't + have a property of the given \a name (i.e., non-existent + properties are "trivially deletable"). + \o If this object doesn't have an own property of the given + \a name, but an object in the prototype() chain does, the + prototype object's property is not deleted, and this function + returns true. + \endlist + + \sa setProperty(), hasOwnProperty() +*/ +bool QJSValue::deleteProperty(const QString &name) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->deleteProperty(name); +} + +/*! + Returns true if this object has a property of the given \a name, + otherwise returns false. + + \sa property(), hasOwnProperty() +*/ +bool QJSValue::hasProperty(const QString &name) const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->hasProperty(name); +} + +/*! + Returns true if this object has an own (not prototype-inherited) + property of the given \a name, otherwise returns false. + + \sa property(), hasProperty() +*/ +bool QJSValue::hasOwnProperty(const QString &name) const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->hasOwnProperty(name); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + Returns the flags of the property with the given \a name. \sa property() @@ -955,6 +1127,8 @@ QJSValue::PropertyFlags QJSValue::propertyFlags(const QString& name) const return d->propertyFlags(name); } +#endif // QT_DEPRECATED + /*! * If this QJSValue is a QObject, returns the QObject pointer * that the QJSValue represents; otherwise, returns 0. @@ -986,7 +1160,11 @@ QDateTime QJSValue::toDateTime() const return d->toDataTime(); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns the QRegExp representation of this value. If this QJSValue is not a regular expression, an empty QRegExp is returned. @@ -1000,6 +1178,8 @@ QRegExp QJSValue::toRegExp() const return d->toRegExp(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is an object of the Date class; otherwise returns false. diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h index c75bd3fdc4..0acaa16de4 100644 --- a/src/declarative/qml/v8/qjsvalue.h +++ b/src/declarative/qml/v8/qjsvalue.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -34,7 +34,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QJSValue; class QJSEngine; @@ -53,12 +52,14 @@ template <class T> class QScriptPassPointer; class Q_DECLARATIVE_EXPORT QJSValue { public: +#ifdef QT_DEPRECATED enum PropertyFlag { ReadOnly = 0x00000001, Undeletable = 0x00000002, SkipInEnumeration = 0x00000004 }; Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag) +#endif enum SpecialValue { NullValue, @@ -69,12 +70,6 @@ public: QJSValue(); ~QJSValue(); QJSValue(const QJSValue &other); - QJSValue(QJSEngine *engine, SpecialValue val); - QJSValue(QJSEngine *engine, bool val); - QJSValue(QJSEngine *engine, int val); - QJSValue(QJSEngine *engine, uint val); - QJSValue(QJSEngine *engine, double val); - QJSValue(QJSEngine *engine, const QString &val); QJSValue(SpecialValue value); QJSValue(bool value); @@ -89,11 +84,8 @@ public: QJSValue &operator=(const QJSValue &other); - QJSEngine *engine() const; - bool isValid() const; bool isBool() const; bool isNumber() const; - bool isFunction() const; bool isNull() const; bool isString() const; bool isUndefined() const; @@ -107,18 +99,12 @@ public: QString toString() const; double toNumber() const; + qint32 toInt() const; + quint32 toUInt() const; bool toBool() const; - double toInteger() const; - qint32 toInt32() const; - quint32 toUInt32() const; - quint16 toUInt16() const; QVariant toVariant() const; QObject *toQObject() const; - QJSValue toObject() const; QDateTime toDateTime() const; - QRegExp toRegExp() const; - - bool instanceOf(const QJSValue &other) const; bool equals(const QJSValue &other) const; bool strictlyEquals(const QJSValue &other) const; @@ -129,21 +115,55 @@ public: QJSValue property(const QString &name) const; void setProperty(const QString &name, const QJSValue &value); + bool hasProperty(const QString &name) const; + bool hasOwnProperty(const QString &name) const; + QJSValue property(quint32 arrayIndex) const; void setProperty(quint32 arrayIndex, const QJSValue &value); - QJSValue::PropertyFlags propertyFlags(const QString &name) const; + bool deleteProperty(const QString &name); + + bool isCallable() const; + QJSValue call(const QJSValueList &args); + QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &args = QJSValueList()); + QJSValue callAsConstructor(const QJSValueList &args = QJSValueList()); + +#ifdef QT_DEPRECATED + QT_DEPRECATED QJSValue(QJSEngine *engine, SpecialValue val); + QT_DEPRECATED QJSValue(QJSEngine *engine, bool val); + QT_DEPRECATED QJSValue(QJSEngine *engine, int val); + QT_DEPRECATED QJSValue(QJSEngine *engine, uint val); + QT_DEPRECATED QJSValue(QJSEngine *engine, double val); + QT_DEPRECATED QJSValue(QJSEngine *engine, const QString &val); + + QT_DEPRECATED QJSEngine *engine() const; - QJSValue call(const QJSValue &thisObject = QJSValue(), + QT_DEPRECATED bool isValid() const; + QT_DEPRECATED bool isFunction() const; + QT_DEPRECATED double toInteger() const; + QT_DEPRECATED qint32 toInt32() const; + QT_DEPRECATED quint32 toUInt32() const; + QT_DEPRECATED quint16 toUInt16() const; + QT_DEPRECATED QJSValue toObject() const; + QT_DEPRECATED QRegExp toRegExp() const; + + QT_DEPRECATED bool instanceOf(const QJSValue &other) const; + + QT_DEPRECATED QJSValue::PropertyFlags propertyFlags(const QString &name) const; + + QT_DEPRECATED QJSValue call(const QJSValue &thisObject = QJSValue(), const QJSValueList &args = QJSValueList()); - QJSValue construct(const QJSValueList &args = QJSValueList()); + QT_DEPRECATED QJSValue construct(const QJSValueList &args = QJSValueList()); +#endif private: // force compile error, prevent QJSValue(bool) to be called QJSValue(void *); +#ifdef QT_DEPRECATED // force compile error, prevent QJSValue(QScriptEngine*, bool) to be called QJSValue(QJSEngine *, void *); QJSValue(QJSEngine *, const char *); +#endif QJSValue(QJSValuePrivate*); QJSValue(QScriptPassPointer<QJSValuePrivate>); @@ -154,7 +174,9 @@ private: Q_DECLARE_PRIVATE(QJSValue) }; +#ifdef QT_DEPRECATED Q_DECLARE_OPERATORS_FOR_FLAGS(QJSValue::PropertyFlags) +#endif QT_END_NAMESPACE diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h index 9e8259931a..c296d38b22 100644 --- a/src/declarative/qml/v8/qjsvalue_impl_p.h +++ b/src/declarative/qml/v8/qjsvalue_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -880,6 +880,26 @@ inline bool QJSValuePrivate::deleteProperty(const QString& name) return self->Delete(QJSConverter::toString(name)); } +inline bool QJSValuePrivate::hasProperty(const QString &name) const +{ + if (!isObject()) + return false; + + v8::HandleScope handleScope; + v8::Handle<v8::Object> self(v8::Handle<v8::Object>::Cast(m_value)); + return self->Has(QJSConverter::toString(name)); +} + +inline bool QJSValuePrivate::hasOwnProperty(const QString &name) const +{ + if (!isObject()) + return false; + + v8::HandleScope handleScope; + v8::Handle<v8::Object> self(v8::Handle<v8::Object>::Cast(m_value)); + return self->HasOwnProperty(QJSConverter::toString(name)); +} + inline QJSValue::PropertyFlags QJSValuePrivate::propertyFlags(const QString& name) const { if (!isObject()) @@ -954,7 +974,7 @@ QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::call(QJSValuePrivate* thisO return new QJSValuePrivate(e, result); } -inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(int argc, v8::Handle<v8::Value> *argv) +inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(int argc, v8::Handle<v8::Value> *argv) { QV8Engine *e = engine(); @@ -975,7 +995,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(int argc, return new QJSValuePrivate(e, result); } -inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(const QJSValueList& args) +inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(const QJSValueList& args) { if (!isCallable()) return InvalidValue(); @@ -986,11 +1006,11 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(const QJSV int argc = args.size(); QVarLengthArray<v8::Handle<v8::Value>, 8> argv(argc); if (!prepareArgumentsForCall(argv.data(), args)) { - qWarning("QJSValue::construct() failed: cannot construct function with argument created in a different engine"); + qWarning("QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine"); return InvalidValue(); } - return construct(argc, argv.data()); + return callAsConstructor(argc, argv.data()); } /*! \internal diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h index 364742532c..23aebc7822 100644 --- a/src/declarative/qml/v8/qjsvalue_p.h +++ b/src/declarative/qml/v8/qjsvalue_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -130,15 +130,17 @@ public: template<typename T> inline QScriptPassPointer<QJSValuePrivate> property(T name) const; inline bool deleteProperty(const QString& name); + inline bool hasProperty(const QString &name) const; + inline bool hasOwnProperty(const QString &name) const; inline QJSValue::PropertyFlags propertyFlags(const QString& name) const; inline QJSValue::PropertyFlags propertyFlags(v8::Handle<v8::String> name) const; inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValueList& args); inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValue& arguments); inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, int argc, v8::Handle< v8::Value >* argv); - inline QScriptPassPointer<QJSValuePrivate> construct(int argc, v8::Handle<v8::Value> *argv); - inline QScriptPassPointer<QJSValuePrivate> construct(const QJSValueList& args); - inline QScriptPassPointer<QJSValuePrivate> construct(const QJSValue& arguments); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(int argc, v8::Handle<v8::Value> *argv); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(const QJSValueList& args); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(const QJSValue& arguments); inline bool assignEngine(QV8Engine *engine); inline QV8Engine *engine() const; diff --git a/src/declarative/qml/v8/qjsvalueiterator.cpp b/src/declarative/qml/v8/qjsvalueiterator.cpp index 1e9973b79d..161343924a 100644 --- a/src/declarative/qml/v8/qjsvalueiterator.cpp +++ b/src/declarative/qml/v8/qjsvalueiterator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalueiterator.h b/src/declarative/qml/v8/qjsvalueiterator.h index d0d4065903..69bd57f806 100644 --- a/src/declarative/qml/v8/qjsvalueiterator.h +++ b/src/declarative/qml/v8/qjsvalueiterator.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -31,7 +31,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QString; diff --git a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h index 3da3a8ba9e..21f7119b3d 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalueiterator_p.h b/src/declarative/qml/v8/qjsvalueiterator_p.h index 95e1f22337..fb68203c65 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscript_impl_p.h b/src/declarative/qml/v8/qscript_impl_p.h index 00e965a997..5f21d92843 100644 --- a/src/declarative/qml/v8/qscript_impl_p.h +++ b/src/declarative/qml/v8/qscript_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptisolate_p.h b/src/declarative/qml/v8/qscriptisolate_p.h index b2ab24b7a7..6a22e19d8f 100644 --- a/src/declarative/qml/v8/qscriptisolate_p.h +++ b/src/declarative/qml/v8/qscriptisolate_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h index 4db5d17237..74151bddae 100644 --- a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h +++ b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptshareddata_p.h b/src/declarative/qml/v8/qscriptshareddata_p.h index 3d4284f2ee..8b0f0e3239 100644 --- a/src/declarative/qml/v8/qscriptshareddata_p.h +++ b/src/declarative/qml/v8/qscriptshareddata_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscripttools_p.h b/src/declarative/qml/v8/qscripttools_p.h index b68039aa7a..9263028816 100644 --- a/src/declarative/qml/v8/qscripttools_p.h +++ b/src/declarative/qml/v8/qscripttools_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qv8_p.h b/src/declarative/qml/v8/qv8_p.h index c70e3b5a7f..73ba1d4fd3 100644 --- a/src/declarative/qml/v8/qv8_p.h +++ b/src/declarative/qml/v8/qv8_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8bindings.cpp b/src/declarative/qml/v8/qv8bindings.cpp index e4aeecc5c1..3d0398d087 100644 --- a/src/declarative/qml/v8/qv8bindings.cpp +++ b/src/declarative/qml/v8/qv8bindings.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8bindings_p.h b/src/declarative/qml/v8/qv8bindings_p.h index e8ac1b119c..e8af97ce54 100644 --- a/src/declarative/qml/v8/qv8bindings_p.h +++ b/src/declarative/qml/v8/qv8bindings_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8contextwrapper.cpp b/src/declarative/qml/v8/qv8contextwrapper.cpp index 39e9fa89db..af12247870 100644 --- a/src/declarative/qml/v8/qv8contextwrapper.cpp +++ b/src/declarative/qml/v8/qv8contextwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8contextwrapper_p.h b/src/declarative/qml/v8/qv8contextwrapper_p.h index 3ac182d27f..04f2e6c6ab 100644 --- a/src/declarative/qml/v8/qv8contextwrapper_p.h +++ b/src/declarative/qml/v8/qv8contextwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8debug_p.h b/src/declarative/qml/v8/qv8debug_p.h index 13c32c6b19..b3a9c31721 100644 --- a/src/declarative/qml/v8/qv8debug_p.h +++ b/src/declarative/qml/v8/qv8debug_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8domerrors.cpp b/src/declarative/qml/v8/qv8domerrors.cpp index 8652cdac00..f86486cf5c 100644 --- a/src/declarative/qml/v8/qv8domerrors.cpp +++ b/src/declarative/qml/v8/qv8domerrors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8domerrors_p.h b/src/declarative/qml/v8/qv8domerrors_p.h index c3c6d3bf6e..fab93b4dcf 100644 --- a/src/declarative/qml/v8/qv8domerrors_p.h +++ b/src/declarative/qml/v8/qv8domerrors_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index ef65398859..e7fe2c713d 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -501,10 +501,6 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value) if (!value->IsFunction()) { v8::Context::Scope scope(context()); v8::Handle<v8::Object> object = value->ToObject(); - v8::Local<v8::Array> properties = object->GetPropertyNames(); - int length = properties->Length(); - if (length == 0) - return QVariant(); return variantMapFromJS(object); } @@ -530,14 +526,19 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) v8::Local<v8::Function> consoleLogFn = V8FUNCTION(consoleLog, this); console->Set(v8::String::New("debug"), consoleLogFn); - console->Set(v8::String::New("error"), V8FUNCTION(consoleError, this)); console->Set(v8::String::New("log"), consoleLogFn); + console->Set(v8::String::New("info"), consoleLogFn); + console->Set(v8::String::New("warn"), V8FUNCTION(consoleWarn, this)); + console->Set(v8::String::New("error"), V8FUNCTION(consoleError, this)); + console->Set(v8::String::New("assert"), V8FUNCTION(consoleAssert, this)); + + console->Set(v8::String::New("count"), V8FUNCTION(consoleCount, this)); console->Set(v8::String::New("profile"), V8FUNCTION(consoleProfile, this)); console->Set(v8::String::New("profileEnd"), V8FUNCTION(consoleProfileEnd, this)); console->Set(v8::String::New("time"), V8FUNCTION(consoleTime, this)); console->Set(v8::String::New("timeEnd"), V8FUNCTION(consoleTimeEnd, this)); console->Set(v8::String::New("trace"), V8FUNCTION(consoleTrace, this)); - console->Set(v8::String::New("warn"), V8FUNCTION(consoleWarn, this)); + console->Set(v8::String::New("exception"), V8FUNCTION(consoleException, this)); v8::Local<v8::Object> qt = v8::Object::New(); @@ -1086,14 +1087,19 @@ v8::Local<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap) QVariantMap QV8Engine::variantMapFromJS(v8::Handle<v8::Object> jsObject) { QVariantMap result; + + v8::HandleScope handleScope; + v8::Handle<v8::Array> propertyNames = jsObject->GetPropertyNames(); + uint32_t length = propertyNames->Length(); + if (length == 0) + return result; + int hash = jsObject->GetIdentityHash(); if (visitedConversionObjects.contains(hash)) return result; // Avoid recursion. + visitedConversionObjects.insert(hash); - v8::HandleScope handleScope; // TODO: Only object's own property names. Include non-enumerable properties. - v8::Handle<v8::Array> propertyNames = jsObject->GetPropertyNames(); - uint32_t length = propertyNames->Length(); for (uint32_t i = 0; i < length; ++i) { v8::Handle<v8::Value> name = propertyNames->Get(i); result.insert(QJSConverter::toString(name->ToString()), variantFromJS(jsObject->Get(name))); @@ -1511,6 +1517,15 @@ qint64 QV8Engine::stopTimer(const QString &timerName, bool *wasRunning) return m_time.elapsed() - startedAt; } +int QV8Engine::consoleCountHelper(const QString &file, int line, int column) +{ + const QString key = file + QString::number(line) + QString::number(column); + int number = m_consoleCount.value(key, 0); + number++; + m_consoleCount.insert(key, number); + return number; +} + void QV8GCCallback::registerGcPrologueCallback() { QV8Engine::ThreadData *td = QV8Engine::threadData(); diff --git a/src/declarative/qml/v8/qv8engine_impl_p.h b/src/declarative/qml/v8/qv8engine_impl_p.h index 575906ebcb..eed97d41a9 100644 --- a/src/declarative/qml/v8/qv8engine_impl_p.h +++ b/src/declarative/qml/v8/qv8engine_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h index 9dfc1d58f2..b625704c5b 100644 --- a/src/declarative/qml/v8/qv8engine_p.h +++ b/src/declarative/qml/v8/qv8engine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -432,6 +432,9 @@ public: void startTimer(const QString &timerName); qint64 stopTimer(const QString &timerName, bool *wasRunning); + // used for console.count() + int consoleCountHelper(const QString &file, int line, int column); + QObject *qtObjectFromJS(v8::Handle<v8::Value> value); QSet<int> visitedConversionObjects; @@ -486,6 +489,8 @@ protected: QElapsedTimer m_time; QHash<QString, qint64> m_startedTimers; + QHash<QString, quint32> m_consoleCount; + QVariant toBasicVariant(v8::Handle<v8::Value>); void initializeGlobal(v8::Handle<v8::Object>); diff --git a/src/declarative/qml/v8/qv8include.cpp b/src/declarative/qml/v8/qv8include.cpp index e0a10742f7..70585461a3 100644 --- a/src/declarative/qml/v8/qv8include.cpp +++ b/src/declarative/qml/v8/qv8include.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8include_p.h b/src/declarative/qml/v8/qv8include_p.h index 41feece9e7..935a209acc 100644 --- a/src/declarative/qml/v8/qv8include_p.h +++ b/src/declarative/qml/v8/qv8include_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8listwrapper.cpp b/src/declarative/qml/v8/qv8listwrapper.cpp index 0ef94e079c..ccbe1f74b4 100644 --- a/src/declarative/qml/v8/qv8listwrapper.cpp +++ b/src/declarative/qml/v8/qv8listwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8listwrapper_p.h b/src/declarative/qml/v8/qv8listwrapper_p.h index 89cb679375..46a6e72c94 100644 --- a/src/declarative/qml/v8/qv8listwrapper_p.h +++ b/src/declarative/qml/v8/qv8listwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8profiler_p.h b/src/declarative/qml/v8/qv8profiler_p.h index 51d681e3a1..0851a33263 100644 --- a/src/declarative/qml/v8/qv8profiler_p.h +++ b/src/declarative/qml/v8/qv8profiler_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index 2663344534..a8d5a279bd 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp +++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -589,10 +589,11 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QDeclarativ v8::StackTrace::kScriptName)); v8::Local<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); + int columNumber = frame->GetColumn(); QString url = engine->toString(frame->GetScriptName()); newBinding = new QDeclarativeBinding(&function, object, context); - newBinding->setSourceLocation(url, lineNumber); + newBinding->setSourceLocation(url, lineNumber, columNumber); newBinding->setTarget(object, *property, context); newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject); diff --git a/src/declarative/qml/v8/qv8qobjectwrapper_p.h b/src/declarative/qml/v8/qv8qobjectwrapper_p.h index 9c545cb3b1..54d354c638 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper_p.h +++ b/src/declarative/qml/v8/qv8qobjectwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper.cpp b/src/declarative/qml/v8/qv8sequencewrapper.cpp index 32c98f046a..091b44063c 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper.cpp +++ b/src/declarative/qml/v8/qv8sequencewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper_p.h b/src/declarative/qml/v8/qv8sequencewrapper_p.h index ef7f714e0f..2ca5ab503e 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper_p.h +++ b/src/declarative/qml/v8/qv8sequencewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper_p_p.h b/src/declarative/qml/v8/qv8sequencewrapper_p_p.h index c7a8ca4d8d..8b2487e8d0 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper_p_p.h +++ b/src/declarative/qml/v8/qv8sequencewrapper_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -180,12 +180,14 @@ static QString convertQStringToString(QV8Engine *, const QString &v) static QUrl convertV8ValueToUrl(QV8Engine *e, v8::Handle<v8::Value> v) { - return QUrl(e->toString(v->ToString())); + QUrl u; + u.setEncodedUrl(e->toString(v->ToString()).toUtf8(), QUrl::TolerantMode); + return u; } static v8::Handle<v8::Value> convertUrlToV8Value(QV8Engine *e, const QUrl &v) { - return e->toString(v.toString()); + return e->toString(v.toEncoded()); } static QString convertUrlToString(QV8Engine *, const QUrl &v) diff --git a/src/declarative/qml/v8/qv8stringwrapper.cpp b/src/declarative/qml/v8/qv8stringwrapper.cpp index efc513a965..745d4d374a 100644 --- a/src/declarative/qml/v8/qv8stringwrapper.cpp +++ b/src/declarative/qml/v8/qv8stringwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8stringwrapper_p.h b/src/declarative/qml/v8/qv8stringwrapper_p.h index ff0e9dc51b..011acf8249 100644 --- a/src/declarative/qml/v8/qv8stringwrapper_p.h +++ b/src/declarative/qml/v8/qv8stringwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp index 3016f7b37d..f1c095678b 100644 --- a/src/declarative/qml/v8/qv8typewrapper.cpp +++ b/src/declarative/qml/v8/qv8typewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -196,9 +196,16 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, resource->importNamespace); if (r.isValid()) { - Q_ASSERT(r.type); + if (r.type) { + return v8engine->typeWrapper()->newObject(object, r.type, resource->mode); + } else if (r.scriptIndex != -1) { + int index = r.scriptIndex; + QDeclarativeContextData *context = v8engine->callingContext(); + if (index < context->importedScripts.count()) + return context->importedScripts.at(index); + } - return v8engine->typeWrapper()->newObject(object, r.type, resource->mode); + return v8::Undefined(); } else if (QDeclarativeMetaType::ModuleApiInstance *moduleApi = resource->typeNamespace->moduleApi(resource->importNamespace)) { if (moduleApi->scriptCallback) { diff --git a/src/declarative/qml/v8/qv8typewrapper_p.h b/src/declarative/qml/v8/qv8typewrapper_p.h index e1c6b177df..f658b9b14c 100644 --- a/src/declarative/qml/v8/qv8typewrapper_p.h +++ b/src/declarative/qml/v8/qv8typewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8valuetypewrapper.cpp b/src/declarative/qml/v8/qv8valuetypewrapper.cpp index b712ac5028..f6ce43ee10 100644 --- a/src/declarative/qml/v8/qv8valuetypewrapper.cpp +++ b/src/declarative/qml/v8/qv8valuetypewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -342,10 +342,11 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Local<v8::String> property v8::StackTrace::kScriptName)); v8::Local<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); + int columnNumber = frame->GetColumn(); QString url = r->engine->toString(frame->GetScriptName()); newBinding = new QDeclarativeBinding(&function, reference->object, context); - newBinding->setSourceLocation(url, lineNumber); + newBinding->setSourceLocation(url, lineNumber, columnNumber); newBinding->setTarget(reference->object, cacheData, context); newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject); diff --git a/src/declarative/qml/v8/qv8valuetypewrapper_p.h b/src/declarative/qml/v8/qv8valuetypewrapper_p.h index bb5085557c..f0f018074a 100644 --- a/src/declarative/qml/v8/qv8valuetypewrapper_p.h +++ b/src/declarative/qml/v8/qv8valuetypewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantresource_p.h b/src/declarative/qml/v8/qv8variantresource_p.h index cca272bbc9..a87fa9606c 100644 --- a/src/declarative/qml/v8/qv8variantresource_p.h +++ b/src/declarative/qml/v8/qv8variantresource_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantwrapper.cpp b/src/declarative/qml/v8/qv8variantwrapper.cpp index 2fc63333d6..cdc1444633 100644 --- a/src/declarative/qml/v8/qv8variantwrapper.cpp +++ b/src/declarative/qml/v8/qv8variantwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantwrapper_p.h b/src/declarative/qml/v8/qv8variantwrapper_p.h index d46832ae87..e3412fab0b 100644 --- a/src/declarative/qml/v8/qv8variantwrapper_p.h +++ b/src/declarative/qml/v8/qv8variantwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8worker.cpp b/src/declarative/qml/v8/qv8worker.cpp index e1bc3ec3a9..474b28bb5b 100644 --- a/src/declarative/qml/v8/qv8worker.cpp +++ b/src/declarative/qml/v8/qv8worker.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8worker_p.h b/src/declarative/qml/v8/qv8worker_p.h index e42438f8d6..3b456a8db9 100644 --- a/src/declarative/qml/v8/qv8worker_p.h +++ b/src/declarative/qml/v8/qv8worker_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** |