diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-16 14:51:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-17 10:29:44 +0000 |
commit | 61447075954aab99b3abc9c78294e5966ae3b6ce (patch) | |
tree | 68192e06f529b2f2613d2541ea6063fa6fcba8ec /src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp | |
parent | 80b5f8c2f448be574e731e5d371c38b84578f5c3 (diff) |
Pass "this" object when evaluating debug jobs
We have to explicitly specify the "this" object on QV4::Function::call,
otherwise it will assume undefined or the QML global object.
Task-number: QTBUG-66942
Change-Id: I1af7742b4fee1b49e9760a413834daf3edb15d74
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index 5b049ab521..7950d21612 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -112,8 +112,14 @@ void JavaScriptJob::run() script.inheritContext = true; script.parse(); QV4::ScopedValue result(scope); - if (!scope.engine->hasException) - result = script.run(); + if (!scope.engine->hasException) { + if (frame) { + QV4::ScopedValue thisObject(scope, frame->thisObject()); + result = script.run(thisObject); + } else { + result = script.run(); + } + } if (scope.engine->hasException) { result = scope.engine->catchException(); resultIsException = true; |