summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/script/api/qscriptcontext.cpp3
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index 689ad66..75ad505 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -619,8 +619,11 @@ QString QScriptContext::toString() const
QString functionName = info.functionName();
if (functionName.isEmpty()) {
if (parentContext()) {
+ const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this);
if (info.functionType() == QScriptContextInfo::ScriptFunction)
result.append(QLatin1String("<anonymous>"));
+ else if(frame->callerFrame()->hasHostCallFrameFlag())
+ result.append(QLatin1String("<eval>"));
else
result.append(QLatin1String("<native>"));
} else {
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index c72594c..2f96ea0 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -586,7 +586,7 @@ void tst_QScriptContext::backtrace_data()
).arg("\\n \\n bt('hey'); \\n");
expected << "<native>('hey') at -1"
- << "<native>() at 3" //### <native> should be <eval>
+ << "<eval>() at 3"
<< "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" //### line number should be 2
<< "<global>() at testfile:4";
@@ -609,7 +609,7 @@ void tst_QScriptContext::backtrace_data()
QStringList expected;
expected << "<native>('m') at -1"
<< "bar(a = 'b') at eval.js:2"
- << "<native>() at eval.js:4" //### should be <eval>
+ << "<eval>() at eval.js:4"
<< QString("<native>('%1', 'eval.js') at -1").arg(eval_code.replace("\\n", "\n"))
<< "foo() at testfile:2"
<< "<global>() at testfile:4";