summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptcontext.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-10 16:11:03 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-10 16:11:03 (GMT)
commit8ad989ca2a9ccd9c7fb62a50197e87d59218fe20 (patch)
treed54667e9a7eca57a87ebb853bb2abcb0ab71dfe2 /src/script/api/qscriptcontext.cpp
parent336f0bf740842ab8defdbf482a7f043de95857e4 (diff)
downloadQt-8ad989ca2a9ccd9c7fb62a50197e87d59218fe20.zip
Qt-8ad989ca2a9ccd9c7fb62a50197e87d59218fe20.tar.gz
Qt-8ad989ca2a9ccd9c7fb62a50197e87d59218fe20.tar.bz2
make QScriptContext::setScope() fail for object created in other engine
Also fix some autotest failures, improve the descriptions of failures, and make the tests run to completion.
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r--src/script/api/qscriptcontext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index d6440b0..669002d 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -654,6 +654,12 @@ void QScriptContext::pushScope(const QScriptValue &object)
{
if (!object.isObject())
return;
+ else if (object.engine() != engine()) {
+ qWarning("QScriptContext::pushScope() failed: "
+ "cannot push an object created in "
+ "a different engine");
+ return;
+ }
JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this);
JSC::JSValue jscObject = QScript::scriptEngineFromExec(frame)->scriptValueToJSCValue(object);
frame->setScopeChain(frame->scopeChain()->push(JSC::asObject(jscObject)));