summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/script/api/qscriptcontext.cpp2
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp2
2 files changed, 1 insertions, 3 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index c286a70..9ac0dc8 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -476,7 +476,7 @@ void QScriptContext::setThisObject(const QScriptValue &thisObject)
return;
}
if (d->frame == d->engine->globalExec()) {
- qWarning("QScriptContext::setThisObject(): setting this-object of global context is not supported");
+ engine()->setGlobalObject(thisObject);
return;
}
JSC::JSValue jscThisObject = d->engine->scriptValueToJSCValue(thisObject);
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index 524fff2..8b3d1d7 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -286,10 +286,8 @@ void tst_QScriptContext::thisObject()
{
QScriptValue obj = eng.newObject();
eng.currentContext()->setThisObject(obj);
- QEXPECT_FAIL("", "Setting this-object of global context doesn't work", Continue);
QVERIFY(eng.currentContext()->thisObject().equals(obj));
eng.currentContext()->setThisObject(QScriptValue());
- QEXPECT_FAIL("", "Setting this-object of global context doesn't work", Continue);
QVERIFY(eng.currentContext()->thisObject().equals(obj));
QScriptEngine eng2;