diff options
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
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); } |