diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-27 15:16:34 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-27 15:20:40 (GMT) |
commit | a7d03f13fe84e704e243610af73f7b0a8ab5a340 (patch) | |
tree | f5a6ff26f446226af6afcbbf061eabc46ec40988 /src/script | |
parent | f41b7967b279609d9d4e1a872c92e753f9aefad3 (diff) | |
download | Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.zip Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.tar.gz Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.tar.bz2 |
Fix tst_QScriptValue::call
We have to set the CallFrame correctly in QScriptEngine::evaluate() in
order to ger the 'arguments' object and all the local stuff working.
The code Assert if dynamicGlobalObject is not set, so set it to the
global object.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 3230394..7387078 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2064,10 +2064,13 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file JSC::UString jscProgram = QScript::qtStringToJSCUString(program); JSC::UString jscFileName = QScript::qtStringToJSCUString(fileName); - JSC::ExecState* exec = d->globalObject->globalExec(); // ### use d->currentFrame + JSC::ExecState* exec = d->currentFrame; exec->clearException(); + if (!exec->globalData().dynamicGlobalObject) + exec->globalData().dynamicGlobalObject = d->globalObject; d->uncaughtException = JSC::JSValue(); - JSC::Completion comp = JSC::evaluate(exec, exec->lexicalGlobalObject()->globalScopeChain(), + JSC::ScopeChain scopeChain = JSC::ScopeChain(exec->scopeChain()); + JSC::Completion comp = JSC::evaluate(exec, scopeChain, JSC::makeSource(jscProgram, jscFileName, lineNumber)); if ((comp.complType() == JSC::Normal) || (comp.complType() == JSC::ReturnValue)) { Q_ASSERT(!exec->hadException()); |