include files in the caller's context
svn path=/trunk/KDE/kdebase/runtime/; revision=1075353
This commit is contained in:
parent
049da47b89
commit
cfb3f78aee
@ -74,7 +74,17 @@ bool ScriptEnv::include(const QString &path)
|
|||||||
QString script = file.readAll();
|
QString script = file.readAll();
|
||||||
//kDebug() << "Script says" << script;
|
//kDebug() << "Script says" << script;
|
||||||
|
|
||||||
evaluate(script);
|
// change the context to the parent context so that the include is actually
|
||||||
|
// executed in the same context as the caller; seems to be what javascript
|
||||||
|
// coders expect :)
|
||||||
|
QScriptContext *ctx = currentContext();
|
||||||
|
if (ctx && ctx->parentContext()) {
|
||||||
|
ctx->setActivationObject(ctx->parentContext()->activationObject());
|
||||||
|
ctx->setThisObject(ctx->parentContext()->thisObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
evaluate(script, path);
|
||||||
|
|
||||||
if (hasUncaughtException()) {
|
if (hasUncaughtException()) {
|
||||||
emit reportError(this, true);
|
emit reportError(this, true);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user