diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-04-27 07:28:51 -0700 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-04-29 13:10:39 +0200 |
commit | 5efa0f373bf71c01a2a3ec312c015b07f8fcff8a (patch) | |
tree | a63d44837058b4ee2cb5dbc1f6aad17725bbf059 | |
parent | c1dccd6815bf545270277adb28481dba44046d21 (diff) |
Fix QV8Engine::getOwnPropertyNames API
Change-Id: I0b28835e9fe51df74ca87919be63f001d4a5d090
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 12 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8worker.cpp | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index eac90e0237..421cfbea2b 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -479,18 +479,18 @@ const QStringHash<bool> &QV8Engine::illegalNames() const } // Requires a handle scope -v8::Local<v8::Array> QV8Engine::getOwnPropertyNames(v8::Handle<v8::Object> o) +QV4::Value QV8Engine::getOwnPropertyNames(const QV4::Value &o) { - QV4::Value ovalue = o.get()->v4Value(); - if (!ovalue.asObject()) - return v8::Array::New(); + if (!o.asObject()) + return QV4::Value::fromObject(m_v4Engine->newArrayObject(m_v4Engine->current)); QV4::SimpleCallContext ctx; - ctx.arguments = &ovalue; + QV4::Value args = o; + ctx.arguments = &args; ctx.argumentCount = 1; ctx.engine = m_v4Engine; ctx.parent = m_v4Engine->current; QV4::Value result = QV4::ObjectPrototype::method_getOwnPropertyNames(&ctx); - return v8::Local<v8::Array>::New(v8::Value::fromV4Value(result)); + return result; } QQmlContextData *QV8Engine::callingContext() diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 22e2a14426..163ed0ae09 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -308,7 +308,7 @@ public: QQmlContextData *callingContext(); - v8::Local<v8::Array> getOwnPropertyNames(v8::Handle<v8::Object>); + QV4::Value getOwnPropertyNames(const QV4::Value &o); void freezeObject(v8::Handle<v8::Value>); QString toString(v8::Handle<v8::Value> string); diff --git a/src/qml/qml/v8/qv8worker.cpp b/src/qml/qml/v8/qv8worker.cpp index 9556e146ef..8aef8c2e94 100644 --- a/src/qml/qml/v8/qv8worker.cpp +++ b/src/qml/qml/v8/qv8worker.cpp @@ -44,6 +44,8 @@ #include <private/qqmllistmodel_p.h> #include <private/qqmllistmodelworkeragent_p.h> +#include <private/qv4value_p.h> + QT_BEGIN_NAMESPACE // We allow the following JavaScript types to be passed between the main and @@ -219,7 +221,7 @@ void QV8Worker::serialize(QByteArray &data, v8::Handle<v8::Value> v, QV8Engine * source->Write((uint16_t*)buffer); } else if (v->IsObject() && !v->ToObject()->GetExternalResource()) { v8::Handle<v8::Object> object = v->ToObject(); - v8::Local<v8::Array> properties = engine->getOwnPropertyNames(object); + v8::Local<v8::Array> properties = v8::Local<v8::Array>::New(v8::Value::fromV4Value(engine->getOwnPropertyNames(object->v4Value()))); quint32 length = properties->Length(); if (length > 0xFFFFFF) { push(data, valueheader(WorkerUndefined)); |