summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-13 20:55:03 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-13 20:55:03 (GMT)
commit0dbd8f1b0a6df20e5502bb35e58490a9f99953a7 (patch)
treecf27566f41ea9ebedd166941cfeffe2c4930b094 /src/script
parentac187c6e40d5142a2811be30f0e5035581e14859 (diff)
parentc0e9740fe15b3034091118b593359b4b9b4cbe87 (diff)
downloadQt-0dbd8f1b0a6df20e5502bb35e58490a9f99953a7.zip
Qt-0dbd8f1b0a6df20e5502bb35e58490a9f99953a7.tar.gz
Qt-0dbd8f1b0a6df20e5502bb35e58490a9f99953a7.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix QNX screen initialization tst_qftp: Attempting to reproduce a crash QNAM HTTP: Do not pipeline with WebLogic servers Autotest: update path location on the test server Autotest: update location of fluke.gif on test server Make qsTr work in global scope
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 2422108..ccd3e56 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -41,6 +41,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qmetaobject.h>
+#include "CodeBlock.h"
#include "Error.h"
#include "JSArray.h"
#include "JSLock.h"
@@ -699,9 +700,18 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number");
#ifndef QT_NO_QOBJECT
QString context;
- QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec);
- if (ctx && ctx->parentContext())
- context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName();
+ // The first non-empty source URL in the call stack determines the translation context.
+ {
+ JSC::ExecState *frame = exec->removeHostCallFrameFlag();
+ while (frame) {
+ if (frame->codeBlock() && frame->codeBlock()->source()
+ && !frame->codeBlock()->source()->url().isEmpty()) {
+ context = QFileInfo(frame->codeBlock()->source()->url()).baseName();
+ break;
+ }
+ frame = frame->callerFrame()->removeHostCallFrameFlag();
+ }
+ }
#endif
QString text(args.at(0).toString(exec));
#ifndef QT_NO_QOBJECT