diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 1 | ||||
-rw-r--r-- | src/script/api/qscriptengineagent.cpp | 5 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 6 | ||||
-rw-r--r-- | src/script/api/qscriptvalue_p.h | 2 | ||||
-rw-r--r-- | src/script/bridge/qscriptdeclarativeobject.cpp | 4 |
5 files changed, 15 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 6894585..4a18c7d 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -4196,6 +4196,7 @@ void QScriptEngine::setAgent(QScriptEngineAgent *agent) "cannot set agent belonging to different engine"); return; } + QScript::APIShim shim(d); if (d->activeAgent) QScriptEngineAgentPrivate::get(d->activeAgent)->detach(); d->activeAgent = agent; diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 28905e8..c3d1566 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -117,6 +117,8 @@ void QScriptEngineAgentPrivate::attach() if (engine->originalGlobalObject()->debugger()) engine->originalGlobalObject()->setDebugger(0); JSC::Debugger::attach(engine->originalGlobalObject()); + if (!QScriptEnginePrivate::get(engine)->isEvaluating()) + JSC::Debugger::recompileAllJSFunctions(engine->globalData); } void QScriptEngineAgentPrivate::detach() @@ -134,9 +136,12 @@ void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame, void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler) { JSC::CallFrame *oldFrame = engine->currentFrame; + int oldAgentLineNumber = engine->agentLineNumber; engine->currentFrame = frame.callFrame(); QScriptValue value(engine->scriptValueFromJSCValue(frame.exception())); + engine->agentLineNumber = value.property(QLatin1String("lineNumber")).toInt32(); q_ptr->exceptionThrow(sourceID, value, hasHandler); + engine->agentLineNumber = oldAgentLineNumber; engine->currentFrame = oldFrame; engine->setCurrentException(value); }; diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 451d1b0..f6390bb 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1268,6 +1268,7 @@ QDateTime QScriptValue::toDateTime() const Q_D(const QScriptValue); if (!d || !d->engine) return QDateTime(); + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue); } @@ -1284,6 +1285,7 @@ QRegExp QScriptValue::toRegExp() const Q_D(const QScriptValue); if (!d || !d->engine) return QRegExp(); + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue); } #endif // QT_NO_REGEXP @@ -1303,6 +1305,7 @@ QObject *QScriptValue::toQObject() const Q_D(const QScriptValue); if (!d || !d->engine) return 0; + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue); } @@ -1317,6 +1320,7 @@ const QMetaObject *QScriptValue::toQMetaObject() const Q_D(const QScriptValue); if (!d || !d->engine) return 0; + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue); } @@ -1407,6 +1411,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, Q_D(const QScriptValue); if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode)); } @@ -1434,6 +1439,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, "cannot set value created in a different engine"); return; } + QScript::APIShim shim(d->engine); JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value); d->setProperty(arrayIndex, jsValue, flags); } diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 853c6c8..8f286db 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -103,7 +103,7 @@ public: qint64 objectId() { - if ( (type == JavaScriptCore) && (engine) ) + if ( (type == JavaScriptCore) && (engine) && jscValue.isCell() ) return (qint64)jscValue.asCell(); else return -1; diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp index 6e08b83..f330ac0 100644 --- a/src/script/bridge/qscriptdeclarativeobject.cpp +++ b/src/script/bridge/qscriptdeclarativeobject.cpp @@ -88,6 +88,7 @@ void DeclarativeObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptDeclarativeClass::Identifier identifier = (void *)propertyName.ustring().rep(); QScriptDeclarativeClassPrivate *p = QScriptDeclarativeClassPrivate::get(m_class); @@ -144,7 +145,7 @@ JSC::JSValue DeclarativeObjectDelegate::call(JSC::ExecState *exec, JSC::JSObject QScriptDeclarativeClass *scriptClass = static_cast<DeclarativeObjectDelegate*>(delegate)->m_class; QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec); - JSC::ExecState *oldFrame = eng_p->currentFrame; + QScript::SaveFrameHelper saveFrame(eng_p, exec); eng_p->pushContext(exec, thisValue, args, callee); QScriptContext *ctxt = eng_p->contextForFrame(eng_p->currentFrame); @@ -153,7 +154,6 @@ JSC::JSValue DeclarativeObjectDelegate::call(JSC::ExecState *exec, JSC::JSObject scriptClass->call(static_cast<DeclarativeObjectDelegate*>(delegate)->m_object, ctxt); eng_p->popContext(); - eng_p->currentFrame = oldFrame; return (JSC::JSValue &)(result); } |