diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 31 | ||||
-rw-r--r-- | src/script/api/qscriptengine.h | 1 | ||||
-rw-r--r-- | src/script/bridge/qscriptdeclarativeclass.cpp | 33 | ||||
-rw-r--r-- | src/script/bridge/qscriptdeclarativeclass_p.h | 1 |
4 files changed, 35 insertions, 31 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index de759c6..216f325 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1137,7 +1137,7 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) QScriptContext *context = q->currentContext(); while (context) { - JSC::ScopeChainNode *node = ((JSC::ExecState *)context)->scopeChain(); + JSC::ScopeChainNode *node = frameForContext(context)->scopeChain(); JSC::ScopeChainIterator it(node); for (it = node->begin(); it != node->end(); ++it) { JSC::JSObject *object = *it; @@ -2288,35 +2288,6 @@ QScriptContext *QScriptEngine::pushContext() return d->contextForFrame(newFrame); } -/*! - Enters a new execution context and returns the associated - QScriptContext object. - - Once you are done with the context, you should call popContext() to - restore the old context. - - By default, the `this' object of the new context is the Global Object. - The context's \l{QScriptContext::callee()}{callee}() will be invalid. - - Unlike pushContext(), the default scope chain is reset to include - only the global object and the QScriptContext's activation object. - - \sa popContext() -*/ -QScriptContext *QScriptEngine::pushCleanContext() -{ - Q_D(QScriptEngine); - - JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, - JSC::ArgList(), /*callee = */0, false, true); - - if (agent()) - agent()->contextPush(); - - return d->contextForFrame(newFrame); -} - - /*! \internal push a context for a native function. JSC native function doesn't have different stackframe or context. so we need to create one. diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h index de4dc02..7db61e1 100644 --- a/src/script/api/qscriptengine.h +++ b/src/script/api/qscriptengine.h @@ -160,7 +160,6 @@ public: QScriptContext *currentContext() const; QScriptContext *pushContext(); - QScriptContext *pushCleanContext(); void popContext(); bool canEvaluate(const QString &program) const; diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index f0c1c45..b5d9bf5 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -44,6 +44,7 @@ #include "qscriptobject_p.h" #include <QtScript/qscriptstring.h> #include <QtScript/qscriptengine.h> +#include <QtScript/qscriptengineagent.h> #include <private/qscriptengine_p.h> #include <private/qscriptvalue_p.h> #include <private/qscriptqobject_p.h> @@ -217,6 +218,38 @@ QScriptValue QScriptDeclarativeClass::scopeChainValue(QScriptContext *context, i return QScriptValue(); } +/*! + Enters a new execution context and returns the associated + QScriptContext object. + + Once you are done with the context, you should call popContext() to + restore the old context. + + By default, the `this' object of the new context is the Global Object. + The context's \l{QScriptContext::callee()}{callee}() will be invalid. + + Unlike pushContext(), the default scope chain is reset to include + only the global object and the QScriptContext's activation object. + + \sa QScriptEngine::popContext() +*/ +QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine) +{ + if (!engine) + return 0; + + QScriptEnginePrivate *d = QScriptEnginePrivate::get(engine); + + JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, + d->currentFrame->globalData().dynamicGlobalObject, + JSC::ArgList(), /*callee = */0, false, true); + + if (engine->agent()) + engine->agent()->contextPush(); + + return d->contextForFrame(newFrame); +} + QScriptDeclarativeClass::~QScriptDeclarativeClass() { } diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h index 4e06931..d0e653d 100644 --- a/src/script/bridge/qscriptdeclarativeclass_p.h +++ b/src/script/bridge/qscriptdeclarativeclass_p.h @@ -77,6 +77,7 @@ public: static QScriptValue property(const QScriptValue &, const Identifier &); static QScriptValue scopeChainValue(QScriptContext *, int index); + static QScriptContext *pushCleanContext(QScriptEngine *); class Q_SCRIPT_EXPORT PersistentIdentifier { |