summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
authorJedrzej Nowacki <jedrzej.nowacki@nokia.com>2009-08-12 12:17:46 (GMT)
committerJedrzej Nowacki <jedrzej.nowacki@nokia.com>2009-08-12 12:25:41 (GMT)
commit2c3f19a646da948f2f40a79e4a5df8f234398bee (patch)
treef277ed1b533dd6128f006ec3776ef1b73d5cba6f /src/script/api/qscriptengine.cpp
parent8eeeebafaa66843eb17fc0d0e60154b1de07e183 (diff)
downloadQt-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
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp32
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);
}