summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptcontext.cpp
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-02-28 15:33:14 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-02-28 15:33:14 (GMT)
commita220e7c51c701a81a675a46a76838260527fcc8e (patch)
treea12130be836dba239c22dbd7d2af9db05d0a830c /src/script/api/qscriptcontext.cpp
parenta27bce53b8d629c6eb41804476594abd0c9a482f (diff)
parentf691e052afbc6fef9f2954e7a7915be85a10f473 (diff)
downloadQt-a220e7c51c701a81a675a46a76838260527fcc8e.zip
Qt-a220e7c51c701a81a675a46a76838260527fcc8e.tar.gz
Qt-a220e7c51c701a81a675a46a76838260527fcc8e.tar.bz2
Merge commit 'refs/merge-requests/1113' of git://gitorious.org/qt/qt into merge-requests/1113
Conflicts: doc/src/development/qmake-manual.qdoc
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r--src/script/api/qscriptcontext.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index 2468a46..5454df5 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -268,8 +268,14 @@ QScriptValue QScriptContext::argument(int index) const
QScriptValue QScriptContext::callee() const
{
const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this);
- QScript::APIShim shim(QScript::scriptEngineFromExec(frame));
- return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(frame->callee());
+ QScriptEnginePrivate *eng = QScript::scriptEngineFromExec(frame);
+ QScript::APIShim shim(eng);
+ if (frame->callee() == eng->originalGlobalObject()) {
+ // This is a pushContext()-created context; the callee is a lie.
+ Q_ASSERT(QScriptEnginePrivate::contextFlags(const_cast<JSC::CallFrame*>(frame)) & QScriptEnginePrivate::NativeContext);
+ return QScriptValue();
+ }
+ return eng->scriptValueFromJSCValue(frame->callee());
}
/*!