From 96b047f0f27674ee402ab3624dbb906346ac1847 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 6 Oct 2009 16:46:43 +0200 Subject: QScriptContext::parentContext: don't skip unessecary frames Calling QScriptValue::call doesn't create a fake frame. We can detect a real fake frame as it does not have a callee. Task-number: QT-2270 Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 2 +- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 863ac30..b1f36be 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -993,7 +993,7 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) { - if (frame && frame->callerFrame()->hasHostCallFrameFlag() + if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee() && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) { //skip the "fake" context created in Interpreter::execute. frame = frame->callerFrame()->removeHostCallFrameFlag(); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 89f8a5cf..a0af214 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -1235,7 +1235,6 @@ void tst_QScriptContext::parentContextCallee_QT2270() QScriptValue fun = engine.evaluate("(function() { return getParentContextCallee(); })"); QVERIFY(fun.isFunction()); QScriptValue callee = fun.call(); - QEXPECT_FAIL("", "QT-2270: Incorrect parentContext() returned for native call", Abort); QVERIFY(callee.equals(fun)); } -- cgit v0.12