Lets try to keep information about original handle type if possible.
Change-Id: I76484c688ee5605cc99687aa4a17c6ca5d1a3891
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
// Converts a QRegExp to a JS RegExp.
// The conversion is not 100% exact since ECMA regexp and QRegExp
// have different semantics/flags, but we try to do our best.
-v8::Handle<v8::RegExp> QJSConverter::toRegExp(const QRegExp &re)
+v8::Local<v8::RegExp> QJSConverter::toRegExp(const QRegExp &re)
{
// Convert the pattern to a ECMAScript pattern.
QString pattern = qt_regexp_toCanonical(re.pattern(), re.patternSyntax());
// The result is a new Array object with length equal to the length
// of the QStringList, and the elements being the QStringList's
// elements converted to JS Strings.
-v8::Handle<v8::Array> QJSConverter::toStringList(const QStringList &lst)
+v8::Local<v8::Array> QJSConverter::toStringList(const QStringList &lst)
{
- v8::Handle<v8::Array> result = v8::Array::New(lst.size());
+ v8::Local<v8::Array> result = v8::Array::New(lst.size());
for (int i = 0; i < lst.size(); ++i)
result->Set(i, toString(lst.at(i)));
return result;
}
// Converts a QDateTime to a JS Date.
-v8::Handle<v8::Value> QJSConverter::toDateTime(const QDateTime &dt)
+v8::Local<v8::Value> QJSConverter::toDateTime(const QDateTime &dt)
{
double date;
if (!dt.isValid())
// Converts a QRegExp to a JS RegExp.
// The conversion is not 100% exact since ECMA regexp and QRegExp
// have different semantics/flags, but we try to do our best.
- static inline v8::Handle<v8::RegExp> toRegExp(const QRegExp &re);
+ static inline v8::Local<v8::RegExp> toRegExp(const QRegExp &re);
// Converts a QStringList to JS.
// The result is a new Array object with length equal to the length
// of the QStringList, and the elements being the QStringList's
// elements converted to JS Strings.
- static inline v8::Handle<v8::Array> toStringList(const QStringList &lst);
+ static inline v8::Local<v8::Array> toStringList(const QStringList &lst);
// Converts a JS Array object to a QStringList.
// The result is a QStringList with length equal to the length
static inline QDateTime toDateTime(v8::Handle<v8::Date> jsDate);
// Converts a QDateTime to a JS Date.
- static inline v8::Handle<v8::Value> toDateTime(const QDateTime &dt);
+ static inline v8::Local<v8::Value> toDateTime(const QDateTime &dt);
};
QT_END_NAMESPACE
Q_D(QJSEngine);
QScriptIsolate api(d, QScriptIsolate::NotNullEngine);
v8::HandleScope handleScope;
- return d->scriptValueFromInternal(v8::Handle<v8::Value>(QJSConverter::toDateTime(dt)));
+ return d->scriptValueFromInternal(QJSConverter::toDateTime(dt));
}
/*!
// The result is a new Array object with length equal to the length
// of the QVariantList, and the elements being the QVariantList's
// elements converted to JS, recursively.
-v8::Handle<v8::Array> QV8Engine::variantListToJS(const QVariantList &lst)
+v8::Local<v8::Array> QV8Engine::variantListToJS(const QVariantList &lst)
{
- v8::Handle<v8::Array> result = v8::Array::New(lst.size());
+ v8::Local<v8::Array> result = v8::Array::New(lst.size());
for (int i = 0; i < lst.size(); ++i)
result->Set(i, variantToJS(lst.at(i)));
return result;
// The result is a new Object object with property names being
// the keys of the QVariantMap, and values being the values of
// the QVariantMap converted to JS, recursively.
-v8::Handle<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap)
+v8::Local<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap)
{
- v8::Handle<v8::Object> result = v8::Object::New();
+ v8::Local<v8::Object> result = v8::Object::New();
QVariantMap::const_iterator it;
for (it = vmap.constBegin(); it != vmap.constEnd(); ++it)
result->Set(QJSConverter::toString(it.key()), variantToJS(it.value()));
}
// Creates a QVariant wrapper object.
-v8::Handle<v8::Object> QV8Engine::newVariant(const QVariant &value)
+v8::Local<v8::Object> QV8Engine::newVariant(const QVariant &value)
{
- v8::Handle<v8::Object> instance = variantWrapper()->newVariant(value);
- return instance;
+ return variantWrapper()->newVariant(value);
}
QScriptPassPointer<QJSValuePrivate> QV8Engine::evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCatch)
return value ? v8::True() : v8::False();
}
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(int value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(int value)
{
return v8::Integer::New(value);
}
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(uint value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(uint value)
{
return v8::Integer::NewFromUnsigned(value);
}
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(double value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(double value)
{
return v8::Number::New(value);
}
return v8::Undefined();
}
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(const QString& value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(const QString &value)
{
return QJSConverter::toString(value);
}
void setExtensionData(int, Deletable *);
inline v8::Handle<v8::Value> makeJSValue(bool value);
- inline v8::Handle<v8::Value> makeJSValue(int value);
- inline v8::Handle<v8::Value> makeJSValue(uint value);
- inline v8::Handle<v8::Value> makeJSValue(double value);
+ inline v8::Local<v8::Value> makeJSValue(int value);
+ inline v8::Local<v8::Value> makeJSValue(uint value);
+ inline v8::Local<v8::Value> makeJSValue(double value);
inline v8::Handle<v8::Value> makeJSValue(QJSValue::SpecialValue value);
- inline v8::Handle<v8::Value> makeJSValue(const QString& value);
+ inline v8::Local<v8::Value> makeJSValue(const QString &value);
inline QScriptPassPointer<QJSValuePrivate> evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1);
QScriptPassPointer<QJSValuePrivate> evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCatch);
QScriptPassPointer<QJSValuePrivate> newArray(uint length);
- v8::Handle<v8::Object> newVariant(const QVariant &variant);
+ v8::Local<v8::Object> newVariant(const QVariant &variant);
QScriptPassPointer<QJSValuePrivate> newVariant(QJSValuePrivate* value, const QVariant &variant);
- v8::Handle<v8::Array> variantListToJS(const QVariantList &lst);
+ v8::Local<v8::Array> variantListToJS(const QVariantList &lst);
QVariantList variantListFromJS(v8::Handle<v8::Array> jsArray);
- v8::Handle<v8::Object> variantMapToJS(const QVariantMap &vmap);
+ v8::Local<v8::Object> variantMapToJS(const QVariantMap &vmap);
QVariantMap variantMapFromJS(v8::Handle<v8::Object> jsObject);
v8::Handle<v8::Value> variantToJS(const QVariant &value);