summaryrefslogtreecommitdiff
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
authorAlexandra Cherdantseva <neluhus.vagus@gmail.com>2019-02-18 14:57:27 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2019-04-17 15:46:36 +0000
commit484e9de6d86d011bd349890cba87a25554b0f672 (patch)
treefbae02a39db4aa73557d9c70ffd120d678c508bb /src/script/api/qscriptengine.cpp
parentba51b7a53420a5de576f6d07b2f4feab5ea4d21a (diff)
downloadqtscript-484e9de6d86d011bd349890cba87a25554b0f672.tar.gz
Fix thisObject() of QScriptable argument for String(), etc
When `String(object)` is evaluated, and `object` is a QObject or some custom object with native prototype, then `object.toString()` will be called with incorrect `this`. This also applies for Number(), Boolean() and other built-in constructors. Change-Id: I0219f0e119c1e29d80e4c0f856421352715e9e6e Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index c5f437b..5bd399f 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2837,7 +2837,7 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
JSC::CallFrame *newCallFrame = exec;
if (callee == 0 //called from public QScriptEngine::pushContext
|| exec->returnPC() == 0 || (contextFlags(exec) & NativeContext) //called from native-native call
- || (exec->codeBlock() && exec->callee() != callee)) { //the interpreter did not build a frame for us.
+ || exec->callee() != callee) { //the interpreter did not build a frame for us.
//We need to check if the Interpreter might have already created a frame for function called from JS.
JSC::Interpreter *interp = exec->interpreter();
JSC::Register *oldEnd = interp->registerFile().end();