[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdebase/runtime/plasma/scriptengines/javascript
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-01-15 23:18:09
Message-ID: 1263597489.615465.26803.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1075375 by aseigo:
include files in the caller's context
M +10 -1 simplejavascriptapplet.cpp
--- branches/KDE/4.4/kdebase/runtime/plasma/scriptengines/javascript/simplejavascriptapplet.cpp \
#1075374:1075375 @@ -281,7 +281,16 @@
QString script = file.readAll();
//kDebug() << "Script says" << script;
- m_engine->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 = m_engine->currentContext();
+ if (ctx && ctx->parentContext()) {
+ ctx->setActivationObject(ctx->parentContext()->activationObject());
+ ctx->setThisObject(ctx->parentContext()->thisObject());
+ }
+
+ m_engine->evaluate(script, path);
if (m_engine->hasUncaughtException()) {
reportError(m_engine, true);
return false;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic