diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-06-15 14:19:22 +1000 |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-06-15 14:19:22 +1000 |
commit | e25c7140aa2a01fa68df1fe0dc6037bdd7919a8c (patch) | |
tree | fb9dff7fe0047b7a92e26a281bf4522593e3be00 /src/declarative/qml/v8/qv8contextwrapper.cpp | |
parent | e906e35e873fd62cc0259fb476044c89c6291c0e (diff) |
Fix autotests
Diffstat (limited to 'src/declarative/qml/v8/qv8contextwrapper.cpp')
-rw-r--r-- | src/declarative/qml/v8/qv8contextwrapper.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/declarative/qml/v8/qv8contextwrapper.cpp b/src/declarative/qml/v8/qv8contextwrapper.cpp index 87ea3795ac..937be3fc3f 100644 --- a/src/declarative/qml/v8/qv8contextwrapper.cpp +++ b/src/declarative/qml/v8/qv8contextwrapper.cpp @@ -63,9 +63,8 @@ public: QDeclarativeGuard<QObject> scopeObject; quint32 hasSubContexts:1; - quint32 ownsContext:1; quint32 readOnly:1; - quint32 dummy:29; + quint32 dummy:30; QObject *secondaryScope; @@ -88,14 +87,14 @@ private: }; QV8ContextResource::QV8ContextResource(QV8Engine *engine, QDeclarativeContextData *context, QObject *scopeObject) -: QV8ObjectResource(engine), scopeObject(scopeObject), hasSubContexts(false), ownsContext(false), - readOnly(true), secondaryScope(0), context(context) +: QV8ObjectResource(engine), scopeObject(scopeObject), hasSubContexts(false), readOnly(true), + secondaryScope(0), context(context) { } QV8ContextResource::~QV8ContextResource() { - if (ownsContext && context) + if (context && context->isJSContext) context->destroy(); } @@ -168,7 +167,6 @@ v8::Local<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url) // XXX NewInstance() should be optimized v8::Local<v8::Object> rv = m_urlConstructor->NewInstance(); QV8ContextResource *r = new QV8ContextResource(m_engine, context, 0); - r->ownsContext = true; rv->SetExternalResource(r); return rv; } @@ -242,6 +240,9 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property, if (!context) return v8::Undefined(); + if (v8::Context::GetCallingQmlGlobal() != info.This()) + return v8::Handle<v8::Value>(); + // Search type (attached property/enum/imported scripts) names // Secondary scope object // while (context) { @@ -252,6 +253,7 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property, // } QV8Engine *engine = resource->engine; + QObject *scopeObject = resource->scopeObject; QHashedV8String propertystring(property); @@ -378,8 +380,11 @@ v8::Handle<v8::Value> QV8ContextWrapper::Setter(v8::Local<v8::String> property, if (!context) return v8::Undefined(); - // See QV8ContextWrapper::Getter for resolution order + if (v8::Context::GetCallingQmlGlobal() != info.This()) + return v8::Handle<v8::Value>(); + // See QV8ContextWrapper::Getter for resolution order + QV8Engine *engine = resource->engine; QObject *scopeObject = resource->scopeObject; |