diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-08-12 12:17:46 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-08-12 12:25:41 (GMT) |
commit | 2c3f19a646da948f2f40a79e4a5df8f234398bee (patch) | |
tree | f277ed1b533dd6128f006ec3776ef1b73d5cba6f | |
parent | 8eeeebafaa66843eb17fc0d0e60154b1de07e183 (diff) | |
download | Qt-2c3f19a646da948f2f40a79e4a5df8f234398bee.zip Qt-2c3f19a646da948f2f40a79e4a5df8f234398bee.tar.gz Qt-2c3f19a646da948f2f40a79e4a5df8f234398bee.tar.bz2 |
Move JSC::Debugger's events calls from JSC::evaluate() to
QSCriptEngine::evaluate()
Fix broken behavior after bad integration with
538153994cacc4613aef1eb8ef77e501be7f5a88 commit
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp | 23 | ||||
-rw-r--r-- | src/script/api/qscriptengine.cpp | 32 |
2 files changed, 31 insertions, 24 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp index 92f82bf..04c9a2e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp @@ -60,25 +60,12 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s JSLock lock(exec); intptr_t sourceId = source.provider()->asID(); -#ifdef QT_BUILD_SCRIPT_LIB - Debugger* debugger = exec->lexicalGlobalObject()->debugger(); - exec->globalData().scriptpool->startEvaluating(source); - if (debugger) - debugger->evaluateStart(sourceId); -#endif int errLine; UString errMsg; RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); if (!programNode) { JSValue error = Error::create(exec, SyntaxError, errMsg, errLine, sourceId, source.provider()->url()); -#ifdef QT_BUILD_SCRIPT_LIB - if (debugger) { - debugger->exceptionThrow(DebuggerCallFrame(exec, error), sourceId, false); - debugger->evaluateStop(error, sourceId); - } - exec->globalData().scriptpool->stopEvaluating(source); -#endif return Completion(Throw, error); } @@ -88,21 +75,11 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s JSValue result = exec->interpreter()->execute(programNode.get(), exec, scopeChain.node(), thisObj, &exception); if (exception) { -#ifdef QT_BUILD_SCRIPT_LIB - if (debugger) - debugger->evaluateStop(exception, sourceId); - exec->globalData().scriptpool->stopEvaluating(source); -#endif if (exception.isObject() && asObject(exception)->isWatchdogException()) return Completion(Interrupted, exception); return Completion(Throw, exception); } -#ifdef QT_BUILD_SCRIPT_LIB - if (debugger) - debugger->evaluateStop(result, sourceId); - exec->globalData().scriptpool->stopEvaluating(source); -#endif return Completion(Normal, result); } diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 8cab92c..f59cd99 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -61,7 +61,7 @@ #include "Interpreter.h" #include "DateConstructor.h" #include "RegExpConstructor.h" -#include "Completion.h" + #include "PrototypeFunction.h" #include "InitializeThreading.h" #include "ObjectPrototype.h" @@ -2164,6 +2164,14 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file JSC::ExecState* exec = d->currentFrame; JSC::SourceCode source = JSC::makeSource(jscProgram, jscFileName, lineNumber); +#ifdef QT_BUILD_SCRIPT_LIB + intptr_t sourceId = source.provider()->asID(); + JSC::Debugger* debugger = exec->lexicalGlobalObject()->debugger(); + exec->globalData().scriptpool->startEvaluating(source); + if (debugger) + debugger->evaluateStart(sourceId); +#endif + exec->clearException(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); @@ -2173,6 +2181,13 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file if (!evalNode) { JSC::JSValue exceptionValue = JSC::Error::create(exec, JSC::SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0); exec->setException(exceptionValue); +#ifdef QT_BUILD_SCRIPT_LIB + if (debugger) { + debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, exceptionValue), sourceId, false); + debugger->evaluateStop(exceptionValue, sourceId); + } + exec->globalData().scriptpool->stopEvaluating(source); +#endif return d->scriptValueFromJSCValue(exceptionValue); } @@ -2185,14 +2200,29 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file if (d->timeoutChecker()->shouldAbort()) { if (d->abortResult.isError()) exec->setException(d->scriptValueToJSCValue(d->abortResult)); +#ifdef QT_BUILD_SCRIPT_LIB + if (debugger) + debugger->evaluateStop(d->scriptValueToJSCValue(d->abortResult), sourceId); + exec->globalData().scriptpool->stopEvaluating(source); +#endif return d->abortResult; } if (exceptionValue) { exec->setException(exceptionValue); +#ifdef QT_BUILD_SCRIPT_LIB + if (debugger) + debugger->evaluateStop(exceptionValue, sourceId); + exec->globalData().scriptpool->stopEvaluating(source); +#endif return d->scriptValueFromJSCValue(exceptionValue); } +#ifdef QT_BUILD_SCRIPT_LIB + if (debugger) + debugger->evaluateStop(result, sourceId); + exec->globalData().scriptpool->stopEvaluating(source); +#endif Q_ASSERT(!exec->hadException()); return d->scriptValueFromJSCValue(result); } |