aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-08-17 20:09:49 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-08-17 20:09:49 +0200
commit9c9fca5e27bd91da1ea07bebd7569049493c5ccf (patch)
treedd3b49b40ed01cad1c2cdc206ec73271bca6e942
parent94e337fa95425d259e81b4d21f4d0853108553bd (diff)
parent668ccf18dc8d5ddf403667f19a5b08f2b7c18639 (diff)
Merge dev into 5.6
-rw-r--r--src/imports/testlib/TestCase.qml9
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp250
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp5
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h1
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp1
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h14
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp13
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h1
-rw-r--r--src/qml/compiler/qv4isel_p.cpp14
-rw-r--r--src/qml/compiler/qv4isel_p.h1
-rw-r--r--src/qml/compiler/qv4jsir.cpp12
-rw-r--r--src/qml/compiler/qv4jsir_p.h20
-rw-r--r--src/qml/compiler/qv4ssa.cpp6
-rw-r--r--src/qml/debugger/qqmldebugconnector.cpp12
-rw-r--r--src/qml/debugger/qqmldebugconnector_p.h1
-rw-r--r--src/qml/jit/qv4isel_masm.cpp7
-rw-r--r--src/qml/jit/qv4isel_masm_p.h1
-rw-r--r--src/qml/jit/qv4regalloc.cpp6
-rw-r--r--src/qml/jsruntime/qv4context.cpp11
-rw-r--r--src/qml/jsruntime/qv4context_p.h6
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp6
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp23
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h3
-rw-r--r--src/qml/jsruntime/qv4value_p.h10
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp8
-rw-r--r--src/qml/memory/qv4mm.cpp1
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp32
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h2
-rw-r--r--src/qml/qml/qqmldirparser.cpp26
-rw-r--r--src/qml/qml/qqmlengine.cpp2
-rw-r--r--src/qml/qml/qqmlglobal.cpp4
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp4
-rw-r--r--src/qml/types/qqmllistmodel.cpp6
-rw-r--r--src/qmltest/quicktestevent.cpp19
-rw-r--r--src/qmltest/quicktestevent_p.h1
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp96
-rw-r--r--tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp42
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp26
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp39
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp81
-rw-r--r--tools/qml/main.cpp6
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp3
47 files changed, 418 insertions, 427 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 4c48611e79..8bedad40e9 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -876,6 +876,9 @@ Item {
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
+ The event will be sent to the TestCase window or, in case of multiple windows,
+ to the current active window. See \l QGuiApplication::focusWindow() for more details.
+
\b{Note:} At some point you should release the key using keyRelease().
\sa keyRelease(), keyClick()
@@ -901,6 +904,9 @@ Item {
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
+ The event will be sent to the TestCase window or, in case of multiple windows,
+ to the current active window. See \l QGuiApplication::focusWindow() for more details.
+
\sa keyPress(), keyClick()
*/
function keyRelease(key, modifiers, delay) {
@@ -924,6 +930,9 @@ Item {
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
+ The event will be sent to the TestCase window or, in case of multiple windows,
+ to the current active window. See \l QGuiApplication::focusWindow() for more details.
+
\sa keyPress(), keyRelease()
*/
function keyClick(key, modifiers, delay) {
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
index 1459ab8759..1cfebea03c 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
@@ -80,7 +80,43 @@ Q_QML_IMPORT_DEBUG_PLUGIN(QLocalClientConnectionFactory)
const int protocolVersion = 1;
-class QQmlDebugServerThread;
+class QQmlDebugServerImpl;
+class QQmlDebugServerThread : public QThread
+{
+public:
+ QQmlDebugServerThread() : m_server(0), m_portFrom(-1), m_portTo(-1) {}
+
+ void setServer(QQmlDebugServerImpl *server)
+ {
+ m_server = server;
+ }
+
+ void setPortRange(int portFrom, int portTo, const QString &hostAddress)
+ {
+ m_pluginName = QLatin1String("QTcpServerConnection");
+ m_portFrom = portFrom;
+ m_portTo = portTo;
+ m_hostAddress = hostAddress;
+ }
+
+ void setFileName(const QString &fileName)
+ {
+ m_pluginName = QLatin1String("QLocalClientConnection");
+ m_fileName = fileName;
+ }
+
+ void run();
+
+private:
+ QQmlDebugServerImpl *m_server;
+ QString m_pluginName;
+ int m_portFrom;
+ int m_portTo;
+ bool m_block;
+ QString m_hostAddress;
+ QString m_fileName;
+};
+
class QQmlDebugServerImpl : public QQmlDebugServer
{
Q_OBJECT
@@ -100,9 +136,7 @@ public:
bool open(const QVariantHash &configuration);
void setDevice(QIODevice *socket);
- template<class Action>
- bool enable(Action action);
- bool enableFromArguments();
+ void parseArguments();
static void cleanup();
@@ -116,8 +150,6 @@ private slots:
void invalidPacket();
private:
- friend struct StartTcpServerAction;
- friend struct ConnectToLocalAction;
friend class QQmlDebugServerThread;
friend class QQmlDebugServerFactory;
@@ -135,8 +167,6 @@ private:
QSharedPointer<QWaitCondition> condition;
};
- bool init(const QString &pluginName, bool block);
-
bool canSendMessage(const QString &name);
void doSendMessage(const QString &name, const QByteArray &message);
@@ -150,80 +180,11 @@ private:
QMutex m_helloMutex;
QWaitCondition m_helloCondition;
- QQmlDebugServerThread *m_thread;
+ QQmlDebugServerThread m_thread;
QPacketProtocol *m_protocol;
QAtomicInt m_changeServiceStateCalls;
};
-class QQmlDebugServerThread : public QThread
-{
-public:
- QQmlDebugServerThread(QQmlDebugServerImpl *server) :
- m_server(server), m_portFrom(-1), m_portTo(-1), m_block(false) {}
-
- void setPluginName(const QString &pluginName) {
- m_pluginName = pluginName;
- }
-
- void setPortRange(int portFrom, int portTo, bool block, const QString &hostAddress) {
- m_portFrom = portFrom;
- m_portTo = portTo;
- m_block = block;
- m_hostAddress = hostAddress;
- }
-
- void setFileName(const QString &fileName, bool block)
- {
- m_fileName = fileName;
- m_block = block;
- }
-
- void run();
-
-private:
- QQmlDebugServerImpl *m_server;
- QString m_pluginName;
- int m_portFrom;
- int m_portTo;
- bool m_block;
- QString m_hostAddress;
- QString m_fileName;
-};
-
-struct StartTcpServerAction {
- int portFrom;
- int portTo;
- bool block;
- QString hostAddress;
-
- StartTcpServerAction(int portFrom, int portTo, bool block, const QString &hostAddress) :
- portFrom(portFrom), portTo(portTo), block(block), hostAddress(hostAddress) {}
-
- bool operator()(QQmlDebugServerImpl *d)
- {
- if (!d->init(QLatin1String("QTcpServerConnection"), block))
- return false;
- d->m_thread->setPortRange(portFrom, portTo == -1 ? portFrom : portTo, block, hostAddress);
- return true;
- }
-};
-
-struct ConnectToLocalAction {
- QString fileName;
- bool block;
-
- ConnectToLocalAction(const QString &fileName, bool block) :
- fileName(fileName), block(block) {}
-
- bool operator()(QQmlDebugServerImpl *d)
- {
- if (!d->init(QLatin1String("QLocalClientConnection"), block))
- return false;
- d->m_thread->setFileName(fileName, block);
- return true;
- }
-};
-
void QQmlDebugServerImpl::cleanup()
{
QQmlDebugServerImpl *server = static_cast<QQmlDebugServerImpl *>(
@@ -247,14 +208,9 @@ void QQmlDebugServerImpl::cleanup()
while (!server->m_changeServiceStateCalls.testAndSetOrdered(0, 0))
loop.processEvents();
- // Stop the thread while the application is still there. Copy here as the thread will set itself
- // to 0 when it stops. It will also do deleteLater, but as long as we don't allow the GUI
- // thread's event loop to run we're safe from that.
- QThread *threadCopy = server->m_thread;
- if (threadCopy) {
- threadCopy->exit();
- threadCopy->wait();
- }
+ // Stop the thread while the application is still there.
+ server->m_thread.exit();
+ server->m_thread.wait();
}
void QQmlDebugServerThread::run()
@@ -265,12 +221,13 @@ void QQmlDebugServerThread::run()
connection->setServer(m_server);
if (m_fileName.isEmpty()) {
- if (!connection->setPortRange(m_portFrom, m_portTo, m_block, m_hostAddress)) {
+ if (!connection->setPortRange(m_portFrom, m_portTo, m_server->blockingMode(),
+ m_hostAddress)) {
delete connection;
return;
}
} else {
- if (!connection->setFileName(m_fileName, m_block)) {
+ if (!connection->setFileName(m_fileName, m_server->blockingMode())) {
delete connection;
return;
}
@@ -282,7 +239,7 @@ void QQmlDebugServerThread::run()
m_server->m_helloCondition.wakeAll();
}
- if (m_block)
+ if (m_server->blockingMode())
connection->waitForConnection();
} else {
qWarning() << "QML Debugger: Couldn't load plugin" << m_pluginName;
@@ -309,65 +266,65 @@ static void cleanupOnShutdown()
QQmlDebugServerImpl::cleanup();
}
-bool QQmlDebugServerImpl::init(const QString &pluginName, bool block)
+QQmlDebugServerImpl::QQmlDebugServerImpl() :
+ m_connection(0),
+ m_gotHello(false),
+ m_blockingMode(false)
{
- if (m_thread)
- return false;
static bool postRoutineAdded = false;
if (!postRoutineAdded) {
qAddPostRoutine(cleanupOnShutdown);
postRoutineAdded = true;
}
- m_thread = new QQmlDebugServerThread(this);
- moveToThread(m_thread);
-
- // Remove the thread immmediately when it finishes, so that we don't have to wait for the event
- // loop to signal that.
- QObject::connect(m_thread, SIGNAL(finished()), this, SLOT(removeThread()), Qt::DirectConnection);
-
- m_thread->setObjectName(QStringLiteral("QQmlDebugServerThread"));
- m_thread->setPluginName(pluginName);
- m_blockingMode = block;
- return true;
-}
-
-QQmlDebugServerImpl::QQmlDebugServerImpl() :
- m_connection(0),
- m_gotHello(false),
- m_blockingMode(false),
- m_thread(0)
-{
// used in sendMessages
qRegisterMetaType<QList<QByteArray> >("QList<QByteArray>");
// used in changeServiceState
qRegisterMetaType<QQmlDebugService::State>("QQmlDebugService::State");
+
+ m_thread.setServer(this);
+ moveToThread(&m_thread);
+
+ // Remove the thread immmediately when it finishes, so that we don't have to wait for the
+ // event loop to signal that.
+ QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(removeThread()),
+ Qt::DirectConnection);
+ m_thread.setObjectName(QStringLiteral("QQmlDebugServerThread"));
+ parseArguments();
}
bool QQmlDebugServerImpl::open(const QVariantHash &configuration = QVariantHash())
{
- if (configuration.isEmpty()) {
- return enableFromArguments();
- } if (configuration.contains(QLatin1String("portFrom"))) {
- return enable(StartTcpServerAction(
- configuration[QLatin1String("portFrom")].toInt(),
- configuration[QLatin1String("portTo")].toInt(),
- configuration[QLatin1String("block")].toBool(),
- configuration[QLatin1String("hostAddress")].toString()));
- } else if (configuration.contains(QLatin1String("fileName"))) {
- return enable(ConnectToLocalAction(configuration[QLatin1String("fileName")].toString(),
- configuration[QLatin1String("block")].toBool()));
+ if (m_thread.isRunning())
+ return false;
+ if (!configuration.isEmpty()) {
+ m_blockingMode = configuration[QLatin1String("block")].toBool();
+ if (configuration.contains(QLatin1String("portFrom"))) {
+ int portFrom = configuration[QLatin1String("portFrom")].toInt();
+ int portTo = configuration[QLatin1String("portTo")].toInt();
+ m_thread.setPortRange(portFrom, portTo == -1 ? portFrom : portTo,
+ configuration[QLatin1String("hostAddress")].toString());
+ } else if (configuration.contains(QLatin1String("fileName"))) {
+ m_thread.setFileName(configuration[QLatin1String("fileName")].toString());
+ } else {
+ return false;
+ }
}
- return false;
+ QMutexLocker locker(&m_helloMutex);
+ m_thread.start();
+ m_helloCondition.wait(&m_helloMutex); // wait for connection
+ if (m_blockingMode && !m_gotHello)
+ m_helloCondition.wait(&m_helloMutex); // wait for hello
+ return true;
}
-bool QQmlDebugServerImpl::enableFromArguments()
+void QQmlDebugServerImpl::parseArguments()
{
// format: qmljsdebugger=port:<port_from>[,port_to],host:<ip address>][,block]
const QString args = commandLineArguments();
if (args.isEmpty())
- return false; // Manual initialization, through QQmlDebugServer::open()
+ return; // Manual initialization, through QQmlDebugServer::open()
// ### remove port definition when protocol is changed
int portFrom = 0;
@@ -376,6 +333,7 @@ bool QQmlDebugServerImpl::enableFromArguments()
bool ok = false;
QString hostAddress;
QString fileName;
+ QStringList services;
const QStringList lstjsDebugArguments = args.split(QLatin1Char(','));
QStringList::const_iterator argsItEnd = lstjsDebugArguments.cend();
@@ -404,6 +362,10 @@ bool QQmlDebugServerImpl::enableFromArguments()
} else if (strArgument.startsWith(QLatin1String("file:"))) {
fileName = strArgument.mid(5);
ok = !fileName.isEmpty();
+ } else if (strArgument.startsWith(QLatin1String("services:"))) {
+ services.append(strArgument.mid(9));
+ } else if (!services.isEmpty()) {
+ services.append(strArgument);
} else {
qWarning() << QString::fromLatin1("QML Debugger: Invalid argument '%1' "
"detected. Ignoring the same.")
@@ -412,16 +374,17 @@ bool QQmlDebugServerImpl::enableFromArguments()
}
if (ok) {
+ setServices(services);
+ m_blockingMode = block;
if (!fileName.isEmpty())
- return enable(ConnectToLocalAction(fileName, block));
+ m_thread.setFileName(fileName);
else
- return enable(StartTcpServerAction(portFrom, portTo, block, hostAddress));
+ m_thread.setPortRange(portFrom, portTo, hostAddress);
} else {
qWarning() << QString::fromLatin1("QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
"Format is qmljsdebugger=port:<port_from>[,port_to],host:"
"<ip address>][,block]").arg(args);
}
- return false;
}
void QQmlDebugServerImpl::receiveMessage()
@@ -550,14 +513,10 @@ void QQmlDebugServerImpl::changeServiceState(const QString &serviceName,
void QQmlDebugServerImpl::removeThread()
{
- Q_ASSERT(m_thread->isFinished());
+ Q_ASSERT(m_thread.isFinished());
Q_ASSERT(QThread::currentThread() == thread());
- QThread *parentThread = m_thread->thread();
-
- // We cannot delete it right away as it will access its data after the finished() signal.
- m_thread->deleteLater();
- m_thread = 0;
+ QThread *parentThread = m_thread.thread();
delete m_connection;
m_connection = 0;
@@ -574,7 +533,7 @@ QQmlDebugService *QQmlDebugServerImpl::service(const QString &name) const
void QQmlDebugServerImpl::addEngine(QQmlEngine *engine)
{
// to be executed outside of debugger thread
- Q_ASSERT(QThread::currentThread() != m_thread);
+ Q_ASSERT(QThread::currentThread() != &m_thread);
QMutexLocker locker(&m_helloMutex);
foreach (QQmlDebugService *service, m_plugins)
@@ -589,7 +548,7 @@ void QQmlDebugServerImpl::addEngine(QQmlEngine *engine)
void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine)
{
// to be executed outside of debugger thread
- Q_ASSERT(QThread::currentThread() != m_thread);
+ Q_ASSERT(QThread::currentThread() != &m_thread);
QMutexLocker locker(&m_helloMutex);
foreach (QQmlDebugService *service, m_plugins)
@@ -604,7 +563,7 @@ void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine)
bool QQmlDebugServerImpl::addService(const QString &name, QQmlDebugService *service)
{
// to be executed before thread starts
- Q_ASSERT(!m_thread);
+ Q_ASSERT(!m_thread.isRunning());
if (!service || m_plugins.contains(name))
return false;
@@ -628,7 +587,7 @@ bool QQmlDebugServerImpl::addService(const QString &name, QQmlDebugService *serv
bool QQmlDebugServerImpl::removeService(const QString &name)
{
// to be executed after thread ends
- Q_ASSERT(!m_thread);
+ Q_ASSERT(!m_thread.isRunning());
QQmlDebugService *service = m_plugins.value(name);
if (!service)
@@ -688,21 +647,6 @@ void QQmlDebugServerImpl::sendMessages(const QString &name, const QList<QByteArr
}
}
-template<class Action>
-bool QQmlDebugServerImpl::enable(Action action)
-{
- if (m_thread)
- return false;
- if (!action(this))
- return false;
- QMutexLocker locker(&m_helloMutex);
- m_thread->start();
- m_helloCondition.wait(&m_helloMutex); // wait for connection
- if (m_blockingMode && !m_gotHello)
- m_helloCondition.wait(&m_helloMutex); // wait for hello
- return true;
-}
-
void QQmlDebugServerImpl::wakeEngine(QQmlEngine *engine)
{
// to be executed in debugger thread
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 079ab95f00..4b1e3601dc 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1458,7 +1458,6 @@ JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, QV4::IR
, _scopeObject(0)
, _qmlContextTemp(-1)
, _importedScriptsTemp(-1)
- , _idArrayTemp(-1)
{
_module = jsModule;
_module->setFileName(fileName);
@@ -1765,14 +1764,12 @@ void JSCodeGen::beginFunctionBodyHook()
{
_qmlContextTemp = _block->newTemp();
_importedScriptsTemp = _block->newTemp();
- _idArrayTemp = _block->newTemp();
#ifndef V4_BOOTSTRAP
QV4::IR::Temp *temp = _block->TEMP(_qmlContextTemp);
move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context, 0, 0));
move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
- move(_block->TEMP(_idArrayTemp), _block->NAME(QV4::IR::Name::builtin_qml_id_array, 0, 0));
#endif
}
@@ -1798,7 +1795,7 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
foreach (const IdMapping &mapping, _idObjects)
if (name == mapping.name) {
_function->idObjectDependencies.insert(mapping.idIndex);
- QV4::IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(QV4::IR::SInt32Type, mapping.idIndex));
+ QV4::IR::Expr *s = _block->MEMBER(_block->TEMP(_qmlContextTemp), _function->newString(name), 0, QV4::IR::Member::MemberOfIdObjectsArray, mapping.idIndex);
QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
_block->MOVE(result, s);
result = _block->TEMP(result->index);
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 8d8978d947..5617912081 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -497,7 +497,6 @@ private:
QQmlPropertyCache *_scopeObject;
int _qmlContextTemp;
int _importedScriptsTemp;
- int _idArrayTemp;
};
} // namespace QmlIR
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index cf37806d7c..911be238b9 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -2624,7 +2624,6 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(QV4::IR::Move
if (QV4::IR::Name *n = move->source->asName()) {
if (n->builtin == QV4::IR::Name::builtin_qml_context
- || n->builtin == QV4::IR::Name::builtin_qml_id_array
|| n->builtin == QV4::IR::Name::builtin_qml_imported_scripts_object) {
// these are free of side-effects
return;
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 886ff99ce7..6839c7f609 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -68,6 +68,7 @@ QT_BEGIN_NAMESPACE
F(StoreContextObjectProperty, storeContextObjectProperty) \
F(LoadScopeObjectProperty, loadScopeObjectProperty) \
F(LoadContextObjectProperty, loadContextObjectProperty) \
+ F(LoadIdObject, loadIdObject) \
F(LoadAttachedQObjectProperty, loadAttachedQObjectProperty) \
F(LoadSingletonQObjectProperty, loadQObjectProperty) \
F(Push, push) \
@@ -132,7 +133,6 @@ QT_BEGIN_NAMESPACE
F(BinopContext, binopContext) \
F(LoadThis, loadThis) \
F(LoadQmlContext, loadQmlContext) \
- F(LoadQmlIdArray, loadQmlIdArray) \
F(LoadQmlImportedScripts, loadQmlImportedScripts) \
F(LoadQmlSingleton, loadQmlSingleton)
@@ -310,6 +310,12 @@ union Instr
Param base;
Param result;
};
+ struct instr_loadIdObject {
+ MOTH_INSTR_HEADER
+ int index;
+ Param base;
+ Param result;
+ };
struct instr_loadQObjectProperty {
MOTH_INSTR_HEADER
int propertyIndex;
@@ -733,10 +739,6 @@ union Instr
MOTH_INSTR_HEADER
Param result;
};
- struct instr_loadQmlIdArray {
- MOTH_INSTR_HEADER
- Param result;
- };
struct instr_loadQmlImportedScripts {
MOTH_INSTR_HEADER
Param result;
@@ -768,6 +770,7 @@ union Instr
instr_getLookup getLookup;
instr_loadScopeObjectProperty loadScopeObjectProperty;
instr_loadContextObjectProperty loadContextObjectProperty;
+ instr_loadIdObject loadIdObject;
instr_loadQObjectProperty loadQObjectProperty;
instr_loadAttachedQObjectProperty loadAttachedQObjectProperty;
instr_storeProperty storeProperty;
@@ -837,7 +840,6 @@ union Instr
instr_binopContext binopContext;
instr_loadThis loadThis;
instr_loadQmlContext loadQmlContext;
- instr_loadQmlIdArray loadQmlIdArray;
instr_loadQmlImportedScripts loadQmlImportedScripts;
instr_loadQmlSingleton loadQmlSingleton;
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 4830f01152..ede1e6938f 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -595,13 +595,6 @@ void InstructionSelection::loadQmlContext(IR::Expr *e)
addInstruction(load);
}
-void InstructionSelection::loadQmlIdArray(IR::Expr *e)
-{
- Instruction::LoadQmlIdArray load;
- load.result = getResultParam(e);
- addInstruction(load);
-}
-
void InstructionSelection::loadQmlImportedScripts(IR::Expr *e)
{
Instruction::LoadQmlImportedScripts load;
@@ -752,6 +745,12 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::M
load.propertyIndex = index;
load.result = getResultParam(target);
addInstruction(load);
+ } else if (kind == IR::Member::MemberOfIdObjectsArray) {
+ Instruction::LoadIdObject load;
+ load.base = getParam(source);
+ load.index = index;
+ load.result = getResultParam(target);
+ addInstruction(load);
} else {
Q_ASSERT(false);
}
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 64e12489ca..ac1eaba740 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -104,7 +104,6 @@ protected:
virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result);
virtual void loadThisObject(IR::Expr *e);
virtual void loadQmlContext(IR::Expr *e);
- virtual void loadQmlIdArray(IR::Expr *e);
virtual void loadQmlImportedScripts(IR::Expr *e);
virtual void loadQmlSingleton(const QString &name, IR::Expr *e);
virtual void loadConst(IR::Const *sourceConst, IR::Expr *e);
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 4ed321b006..9d172b1223 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -93,8 +93,6 @@ void IRDecoder::visitMove(IR::Move *s)
loadThisObject(s->target);
else if (n->builtin == IR::Name::builtin_qml_context)
loadQmlContext(s->target);
- else if (n->builtin == IR::Name::builtin_qml_id_array)
- loadQmlIdArray(s->target);
else if (n->builtin == IR::Name::builtin_qml_imported_scripts_object)
loadQmlImportedScripts(s->target);
else if (n->qmlSingleton)
@@ -138,8 +136,8 @@ void IRDecoder::visitMove(IR::Move *s)
#else
bool captureRequired = true;
- Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
- const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
+ Q_ASSERT(m->kind != IR::Member::MemberOfEnum && m->kind != IR::Member::MemberOfIdObjectsArray);
+ const int attachedPropertiesId = m->attachedPropertiesId;
const bool isSingletonProperty = m->kind == IR::Member::MemberOfSingletonObject;
if (_function && attachedPropertiesId == 0 && !m->property->isConstant()) {
@@ -158,6 +156,9 @@ void IRDecoder::visitMove(IR::Move *s)
getQObjectProperty(m->base, m->property->coreIndex, captureRequired, isSingletonProperty, attachedPropertiesId, s->target);
#endif // V4_BOOTSTRAP
return;
+ } else if (m->kind == IR::Member::MemberOfIdObjectsArray) {
+ getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->idIndex, s->target);
+ return;
} else if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) {
getProperty(m->base, *m->name, s->target);
return;
@@ -177,6 +178,7 @@ void IRDecoder::visitMove(IR::Move *s)
return;
} else if (Member *member = c->base->asMember()) {
#ifndef V4_BOOTSTRAP
+ Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray);
if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) {
callQmlContextProperty(member->base, (IR::Member::MemberKind)member->kind, member->property->coreIndex, c->args, s->target);
return;
@@ -200,7 +202,8 @@ void IRDecoder::visitMove(IR::Move *s)
if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) {
if (s->source->asTemp() || s->source->asConst() || s->source->asArgLocal()) {
Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
- const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
+ Q_ASSERT(m->kind != IR::Member::MemberOfIdObjectsArray);
+ const int attachedPropertiesId = m->attachedPropertiesId;
if (m->property && attachedPropertiesId == 0) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
@@ -251,6 +254,7 @@ void IRDecoder::visitExp(IR::Exp *s)
} else if (Member *member = c->base->asMember()) {
Q_ASSERT(member->base->asTemp() || member->base->asArgLocal());
#ifndef V4_BOOTSTRAP
+ Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray);
if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) {
callQmlContextProperty(member->base, (IR::Member::MemberKind)member->kind, member->property->coreIndex, c->args, 0);
return;
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index 80040da185..2b8aa7eb33 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -138,7 +138,6 @@ public: // to implement by subclasses:
virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) = 0;
virtual void loadThisObject(IR::Expr *target) = 0;
virtual void loadQmlContext(IR::Expr *target) = 0;
- virtual void loadQmlIdArray(IR::Expr *target) = 0;
virtual void loadQmlImportedScripts(IR::Expr *target) = 0;
virtual void loadQmlSingleton(const QString &name, IR::Expr *target) = 0;
virtual void loadConst(IR::Const *sourceConst, IR::Expr *target) = 0;
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index 841a1aefcc..98b53c6b3b 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -343,8 +343,6 @@ const char *builtin_to_string(Name::Builtin b)
return "builtin_convert_this_to_object";
case IR::Name::builtin_qml_context:
return "builtin_qml_context";
- case IR::Name::builtin_qml_id_array:
- return "builtin_qml_id_array";
case IR::Name::builtin_qml_imported_scripts_object:
return "builtin_qml_imported_scripts_object";
}
@@ -933,7 +931,7 @@ void CloneExpr::visitSubscript(Subscript *e)
void CloneExpr::visitMember(Member *e)
{
Expr *clonedBase = clone(e->base);
- cloned = block->MEMBER(clonedBase, e->name, e->property, e->kind, e->attachedPropertiesIdOrEnumValue);
+ cloned = block->MEMBER(clonedBase, e->name, e->property, e->kind, e->idIndex);
}
IRPrinter::IRPrinter(QTextStream *out)
@@ -1237,9 +1235,9 @@ void IRPrinter::visitSubscript(Subscript *e)
void IRPrinter::visitMember(Member *e)
{
- if (e->kind != Member::MemberOfEnum
- && e->attachedPropertiesIdOrEnumValue != 0 && !e->base->asTemp())
- *out << "[[attached property from " << e->attachedPropertiesIdOrEnumValue << "]]";
+ if (e->kind != Member::MemberOfEnum && e->kind != Member::MemberOfIdObjectsArray
+ && e->attachedPropertiesId != 0 && !e->base->asTemp())
+ *out << "[[attached property from " << e->attachedPropertiesId << "]]";
else
e->base->accept(this);
*out << '.' << *e->name;
@@ -1248,6 +1246,8 @@ void IRPrinter::visitMember(Member *e)
*out << " (meta-property " << e->property->coreIndex
<< " <" << QMetaType::typeName(e->property->propType)
<< ">)";
+ else if (e->kind == Member::MemberOfIdObjectsArray)
+ *out << "(id object " << e->idIndex << ")";
#endif
}
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index a4fb5246d0..568ded5337 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -338,7 +338,6 @@ struct Name: Expr {
builtin_setup_argument_object,
builtin_convert_this_to_object,
builtin_qml_context,
- builtin_qml_id_array,
builtin_qml_imported_scripts_object
};
@@ -557,13 +556,18 @@ struct Member: Expr {
MemberOfEnum,
MemberOfQmlScopeObject,
MemberOfQmlContextObject,
- MemberOfSingletonObject
+ MemberOfIdObjectsArray,
+ MemberOfSingletonObject,
};
Expr *base;
const QString *name;
QQmlPropertyData *property;
- int attachedPropertiesIdOrEnumValue; // depending on kind
+ union { // depending on kind
+ int attachedPropertiesId;
+ int enumValue;
+ int idIndex;
+ };
uchar freeOfSideEffects : 1;
// This is set for example for for QObject properties. All sorts of extra behavior
@@ -576,20 +580,20 @@ struct Member: Expr {
void setEnumValue(int value) {
kind = MemberOfEnum;
- attachedPropertiesIdOrEnumValue = value;
+ enumValue = value;
}
void setAttachedPropertiesId(int id) {
- Q_ASSERT(kind != MemberOfEnum);
- attachedPropertiesIdOrEnumValue = id;
+ Q_ASSERT(kind != MemberOfEnum && kind != MemberOfIdObjectsArray);
+ attachedPropertiesId = id;
}
- void init(Expr *base, const QString *name, QQmlPropertyData *property = 0, uchar kind = UnspecifiedMember, int attachedPropertiesIdOrEnumValue = 0)
+ void init(Expr *base, const QString *name, QQmlPropertyData *property = 0, uchar kind = UnspecifiedMember, int index = 0)
{
this->base = base;
this->name = name;
this->property = property;
- this->attachedPropertiesIdOrEnumValue = attachedPropertiesIdOrEnumValue;
+ this->idIndex = index;
this->freeOfSideEffects = false;
this->inhibitTypeConversionOnWrite = property != 0;
this->kind = kind;
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index e61a602e64..62e661c98a 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -3912,7 +3912,7 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
QString name;
if (f->name) name = *f->name;
- else name = QString::fromLatin1("%1").arg((unsigned long long)f);
+ else name = QStringLiteral("%1").arg((unsigned long long)f);
qout << "digraph \"" << name << "\" { ordering=out;\n";
foreach (LoopDetection::LoopInfo *l, loops) {
@@ -4020,14 +4020,14 @@ void optimizeSSA(StatementWorklist &W, DefUses &defUses, DominatorTree &df)
if (Member *member = m->source->asMember()) {
if (member->kind == Member::MemberOfEnum) {
Const *c = function->New<Const>();
- const int enumValue = member->attachedPropertiesIdOrEnumValue;
+ const int enumValue = member->enumValue;
c->init(SInt32Type, enumValue);
replaceUses(targetTemp, c, W);
defUses.removeDef(*targetTemp);
W.remove(s);
defUses.removeUse(s, *member->base->asTemp());
continue;
- } else if (member->attachedPropertiesIdOrEnumValue != 0 && member->property && member->base->asTemp()) {
+ } else if (member->kind != IR::Member::MemberOfIdObjectsArray && member->attachedPropertiesId != 0 && member->property && member->base->asTemp()) {
// Attached properties have no dependency on their base. Isel doesn't
// need it and we can eliminate the temp used to initialize it.
defUses.removeUse(s, *member->base->asTemp());
diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp
index 393185bf0d..8de734fa68 100644
--- a/src/qml/debugger/qqmldebugconnector.cpp
+++ b/src/qml/debugger/qqmldebugconnector.cpp
@@ -56,6 +56,7 @@ Q_QML_IMPORT_DEBUG_PLUGIN(QQmlDebuggerServiceFactory)
struct QQmlDebugConnectorParams {
QString pluginKey;
+ QStringList services;
QString arguments;
QQmlDebugConnector *instance;
@@ -83,6 +84,13 @@ void QQmlDebugConnector::setPluginKey(const QString &key)
}
}
+void QQmlDebugConnector::setServices(const QStringList &services)
+{
+ QQmlDebugConnectorParams *params = qmlDebugConnectorParams();
+ if (params)
+ params->services = services;
+}
+
QString QQmlDebugConnector::commandLineArguments()
{
QQmlDebugConnectorParams *params = qmlDebugConnectorParams();
@@ -119,7 +127,9 @@ QQmlDebugConnector *QQmlDebugConnector::instance()
foreach (const QJsonObject &object, metaDataForQQmlDebugService()) {
foreach (const QJsonValue &key, object.value(QLatin1String("MetaData")).toObject()
.value(QLatin1String("Keys")).toArray()) {
- loadQQmlDebugService(key.toString());
+ QString keyString = key.toString();
+ if (params->services.isEmpty() || params->services.contains(keyString))
+ loadQQmlDebugService(keyString);
}
}
}
diff --git a/src/qml/debugger/qqmldebugconnector_p.h b/src/qml/debugger/qqmldebugconnector_p.h
index 02e94811a6..f5f5a87b56 100644
--- a/src/qml/debugger/qqmldebugconnector_p.h
+++ b/src/qml/debugger/qqmldebugconnector_p.h
@@ -58,6 +58,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDebugConnector : public QObject
Q_OBJECT
public:
static void setPluginKey(const QString &key);
+ static void setServices(const QStringList &services);
static QQmlDebugConnector *instance();
virtual bool blockingMode() const = 0;
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 4bf2753ae4..acead2088b 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -579,11 +579,6 @@ void InstructionSelection::loadQmlContext(IR::Expr *temp)
generateFunctionCall(temp, Runtime::getQmlContext, Assembler::EngineRegister);
}
-void InstructionSelection::loadQmlIdArray(IR::Expr *temp)
-{
- generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::EngineRegister);
-}
-
void InstructionSelection::loadQmlImportedScripts(IR::Expr *temp)
{
generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::EngineRegister);
@@ -681,6 +676,8 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::Mem
generateFunctionCall(target, Runtime::getQmlScopeObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
else if (kind == IR::Member::MemberOfQmlContextObject)
generateFunctionCall(target, Runtime::getQmlContextObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
+ else if (kind == IR::Member::MemberOfIdObjectsArray)
+ generateFunctionCall(target, Runtime::getQmlIdObject, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
else
Q_ASSERT(false);
}
diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h
index 61aeb2025f..6e842f5fb4 100644
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -97,7 +97,6 @@ protected:
virtual void convertType(IR::Expr *source, IR::Expr *target);
virtual void loadThisObject(IR::Expr *temp);
virtual void loadQmlContext(IR::Expr *target);
- virtual void loadQmlIdArray(IR::Expr *target);
virtual void loadQmlImportedScripts(IR::Expr *target);
virtual void loadQmlSingleton(const QString &name, IR::Expr *target);
virtual void loadConst(IR::Const *sourceConst, IR::Expr *target);
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 2d85d2ccc4..b9178c0ea0 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -437,12 +437,6 @@ protected: // IRDecoder
addCall();
}
- virtual void loadQmlIdArray(IR::Expr *temp)
- {
- addDef(temp);
- addCall();
- }
-
virtual void loadQmlImportedScripts(IR::Expr *temp)
{
addDef(temp);
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 667ea7025a..f50c5ab017 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -549,3 +549,14 @@ Heap::FunctionObject *ExecutionContext::getFunctionObject() const
return 0;
}
+
+
+QObject *QmlContext::qmlScope() const
+{
+ return d()->qml->scopeObject;
+}
+
+QQmlContextData *QmlContext::qmlContext() const
+{
+ return d()->qml->context;
+}
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 1e051ed850..2667bbe0b2 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -38,6 +38,9 @@
QT_BEGIN_NAMESPACE
+class QQmlContextData;
+class QObject;
+
namespace QV4 {
namespace CompiledData {
@@ -218,6 +221,9 @@ struct WithContext : public ExecutionContext
struct QmlContext : public ExecutionContext
{
V4_MANAGED(QmlContext, ExecutionContext)
+
+ QObject *qmlScope() const;
+ QQmlContextData *qmlContext() const;
};
inline CallContext *ExecutionContext::asCallContext()
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index 3c0a05483c..a6c2a25b91 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -361,11 +361,11 @@ ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
ScopedValue name(scope, o->get(ctx->d()->engine->id_name()));
QString qname;
if (name->isUndefined())
- qname = QString::fromLatin1("Error");
+ qname = QStringLiteral("Error");
else
qname = name->toQString();
- ScopedString s(scope, ctx->d()->engine->newString(QString::fromLatin1("message")));
+ ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("message")));
ScopedValue message(scope, o->get(s));
QString qmessage;
if (!message->isUndefined())
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 36b83090e1..096fe9fb4c 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -124,7 +124,7 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
if (ctx->argc() && !ctx->args()[0].isUndefined()) {
int radix = ctx->args()[0].toInt32();
if (radix < 2 || radix > 36)
- return ctx->engine()->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
+ return ctx->engine()->throwError(QStringLiteral("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
if (std::isnan(num)) {
@@ -202,7 +202,7 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
QString str;
if (std::isnan(v))
- str = QString::fromLatin1("NaN");
+ str = QStringLiteral("NaN");
else if (qIsInf(v))
str = QString::fromLatin1(v < 0 ? "-Infinity" : "Infinity");
else if (v < 1.e21) {
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 41483e9ef5..1edf76e2de 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -392,7 +392,7 @@ ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
} else {
ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ctx->thisObject()));
QString className = obj->className();
- return ctx->d()->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
+ return ctx->d()->engine->newString(QStringLiteral("[object %1]").arg(className))->asReturnedValue();
}
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 31abab2e2f..529703bda4 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -835,7 +835,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
QQmlError error = v4->catchExceptionAsQmlError();
if (error.description().isEmpty()) {
QV4::ScopedString name(scope, f->name());
- error.setDescription(QString::fromLatin1("Unknown exception occurred during evaluation of connected function: %1").arg(name->toQString()));
+ error.setDescription(QStringLiteral("Unknown exception occurred during evaluation of connected function: %1").arg(name->toQString()));
}
if (QQmlEngine *qmlEngine = v4->qmlEngine()) {
QQmlEnginePrivate::get(qmlEngine)->warning(error);
@@ -1371,7 +1371,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
if (returnType == QMetaType::UnknownType) {
QString typeName = QString::fromLatin1(unknownTypeError);
- QString error = QString::fromLatin1("Unknown method return type: %1").arg(typeName);
+ QString error = QStringLiteral("Unknown method return type: %1").arg(typeName);
return engine->throwError(error);
}
@@ -1384,7 +1384,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
if (!args) {
QString typeName = QString::fromLatin1(unknownTypeError);
- QString error = QString::fromLatin1("Unknown method parameter type: %1").arg(typeName);
+ QString error = QStringLiteral("Unknown method parameter type: %1").arg(typeName);
return engine->throwError(error);
}
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index e9311cf7f3..089922d03e 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -47,6 +47,8 @@
#include "qv4scopedvalue_p.h"
#include <private/qqmlcontextwrapper_p.h>
#include <private/qqmltypewrapper_p.h>
+#include <private/qqmlengine_p.h>
+#include <private/qqmljavascriptexpression_p.h>
#include "qv4qobjectwrapper_p.h"
#include <private/qv8engine_p.h>
#endif
@@ -1361,12 +1363,6 @@ ReturnedValue Runtime::regexpLiteral(ExecutionEngine *engine, int id)
return engine->currentContext()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
-ReturnedValue Runtime::getQmlIdArray(NoThrowEngine *engine)
-{
- Q_ASSERT(engine->qmlContextObject());
- return engine->qmlContextObject()->asReturnedValue();
-}
-
ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired)
{
Scope scope(engine);
@@ -1411,6 +1407,21 @@ ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionEngine *engine, c
return QV4::QObjectWrapper::getProperty(scope.engine, wrapper->singletonObject(), propertyIndex, captureRequired);
}
+ReturnedValue Runtime::getQmlIdObject(ExecutionEngine *engine, const Value &c, uint index)
+{
+ Scope scope(engine);
+ const QmlContext &qmlContext = static_cast<const QmlContext &>(c);
+ QQmlContextData *context = qmlContext.d()->qml->context;
+ if (!context || index >= (uint)context->idValueCount)
+ return Encode::undefined();
+
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+ if (ep && ep->propertyCapture)
+ ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
+
+ return QObjectWrapper::wrap(engine, context->idValues[index].data());
+}
+
void Runtime::setQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value)
{
const QmlContext &c = static_cast<const QmlContext &>(context);
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index cdf7f018ff..f597e4b2e3 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -210,7 +210,6 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
// qml
static ReturnedValue getQmlContext(NoThrowEngine *engine);
- static ReturnedValue getQmlIdArray(NoThrowEngine *engine);
static ReturnedValue getQmlImportedScripts(NoThrowEngine *engine);
static ReturnedValue getQmlSingleton(NoThrowEngine *engine, int nameIndex);
static ReturnedValue getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex);
@@ -218,6 +217,8 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
static ReturnedValue getQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex);
static ReturnedValue getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
static ReturnedValue getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
+ static ReturnedValue getQmlIdObject(ExecutionEngine *engine, const Value &context, uint index);
+
static void setQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value);
static void setQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value);
static void setQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value);
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 3aa1a6df39..c0420a38db 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -39,16 +39,6 @@
#include "qv4global_p.h"
#include <private/qv4heap_p.h>
-#ifndef Q_ALWAYS_INLINE
-#if defined(Q_CC_GNU)
-# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
-#elif defined(Q_CC_MSVC)
-# define Q_ALWAYS_INLINE __forceinline
-#else
-# define Q_ALWAYS_INLINE inline
-#endif
-#endif // Q_ALWAYS_INLINE
-
QT_BEGIN_NAMESPACE
namespace QV4 {
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index c919d24461..f9e26efe71 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -129,7 +129,7 @@ QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
return Encode::undefined();
QString result = o->d()->data.toString();
if (result.isEmpty() && !o->d()->data.canConvert(QVariant::String))
- result = QString::fromLatin1("QVariant(%0)").arg(QString::fromLatin1(o->d()->data.typeName()));
+ result = QStringLiteral("QVariant(%0)").arg(QString::fromLatin1(o->d()->data.typeName()));
return Encode(ctx->d()->engine->newString(result));
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 7caebe33b6..d0ae44ccea 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -531,6 +531,10 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
STOREVALUE(instr.result, Runtime::getQmlContextObjectProperty(engine, VALUE(instr.base), instr.propertyIndex));
MOTH_END_INSTR(LoadContextObjectProperty)
+ MOTH_BEGIN_INSTR(LoadIdObject)
+ STOREVALUE(instr.result, Runtime::getQmlIdObject(engine, VALUE(instr.base), instr.index));
+ MOTH_END_INSTR(LoadIdObject)
+
MOTH_BEGIN_INSTR(LoadAttachedQObjectProperty)
STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(engine, instr.attachedPropertiesId, instr.propertyIndex));
MOTH_END_INSTR(LoadAttachedQObjectProperty)
@@ -907,10 +911,6 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
VALUE(instr.result) = Runtime::getQmlContext(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlContext)
- MOTH_BEGIN_INSTR(LoadQmlIdArray)
- VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowEngine*>(engine));
- MOTH_END_INSTR(LoadQmlIdArray)
-
MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlImportedScripts)
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 24be663ed7..03e78df91a 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -275,7 +275,6 @@ Heap::Base *MemoryManager::allocData(std::size_t size)
Q_V4_PROFILE_ALLOC(m_d->engine, allocSize, Profiling::HeapPage),
OSAllocator::JSGCHeapPages);
m_d->heapChunks.append(allocation);
- std::sort(m_d->heapChunks.begin(), m_d->heapChunks.end());
header = reinterpret_cast<Data::ChunkHeader *>(allocation.base());
header->itemSize = int(size);
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index fd85b64ad1..23084fb202 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -336,8 +336,8 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C
return;
QV4::Scope scope(engine);
- QV4::Scoped<QmlContextWrapper> contextWrapper(scope, engine->qmlContextObject());
- QQmlContextData *qmlContext = contextWrapper->getContext();
+ QV4::Scoped<QmlContext> context(scope, engine->qmlContext());
+ QQmlContextData *qmlContext = context->qmlContext();
const quint32 *idObjectDependency = compiledFunction->qmlIdObjectDependencyTable();
const int idObjectDependencyCount = compiledFunction->nDependingIdObjects;
@@ -355,7 +355,7 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C
capture->captureProperty(qmlContext->contextObject, propertyIndex, notifyIndex);
}
- QObject *scopeObject = contextWrapper->getScopeObject();
+ QObject *scopeObject = context->qmlScope();
const quint32 *scopePropertyDependency = compiledFunction->qmlScopePropertiesDependencyTable();
const int scopePropertyDependencyCount = compiledFunction->nDependingScopeProperties;
for (int i = 0; i < scopePropertyDependencyCount; ++i) {
@@ -387,30 +387,4 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(ExecutionEngine *v4, String
return QJSValuePrivate::convertedToValue(engine(), siinfo->scriptApi(e));
}
-ReturnedValue QmlContextWrapper::getIndexed(const Managed *m, uint index, bool *hasProperty)
-{
- const QV4::QmlContextWrapper *This = static_cast<const QV4::QmlContextWrapper *>(m);
- Scope scope(This->engine());
- QQmlContextData *context = This->getContext();
- if (!context) {
- if (hasProperty)
- *hasProperty = false;
- return Encode::undefined();
- }
- if (index >= (uint)context->idValueCount) {
- if (hasProperty)
- *hasProperty = false;
- return Encode::undefined();
- }
-
- if (hasProperty)
- *hasProperty = true;
-
- QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0;
- if (ep && ep->propertyCapture)
- ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
-
- return QObjectWrapper::wrap(This->engine(), context->idValues[index].data());
-}
-
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index e806077326..7b5d3216df 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -102,8 +102,6 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
static void registerQmlDependencies(ExecutionEngine *context, const CompiledData::Function *compiledFunction);
ReturnedValue qmlSingletonWrapper(ExecutionEngine *e, String *name);
-
- static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty);
};
}
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index a45152e0a0..57b50733ea 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -146,7 +146,7 @@ bool QQmlDirParser::parse(const QString &source)
if (invalidLine) {
reportError(lineNumber, 0,
- QString::fromLatin1("invalid qmldir directive contains too many tokens"));
+ QStringLiteral("invalid qmldir directive contains too many tokens"));
continue;
} else if (sectionCount == 0) {
continue; // no sections, no party.
@@ -154,17 +154,17 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("module")) {
if (sectionCount != 2) {
reportError(lineNumber, 0,
- QString::fromLatin1("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1));
continue;
}
if (!_typeNamespace.isEmpty()) {
reportError(lineNumber, 0,
- QString::fromLatin1("only one module identifier directive may be defined in a qmldir file"));
+ QStringLiteral("only one module identifier directive may be defined in a qmldir file"));
continue;
}
if (!firstLine) {
reportError(lineNumber, 0,
- QString::fromLatin1("module identifier directive must be the first directive in a qmldir file"));
+ QStringLiteral("module identifier directive must be the first directive in a qmldir file"));
continue;
}
@@ -173,7 +173,7 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("plugin")) {
if (sectionCount < 2 || sectionCount > 3) {
reportError(lineNumber, 0,
- QString::fromLatin1("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1));
continue;
}
@@ -185,7 +185,7 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("internal")) {
if (sectionCount != 3) {
reportError(lineNumber, 0,
- QString::fromLatin1("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1));
continue;
}
Component entry(sections[1], sections[2], -1, -1);
@@ -194,7 +194,7 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("singleton")) {
if (sectionCount < 3 || sectionCount > 4) {
reportError(lineNumber, 0,
- QString::fromLatin1("singleton types require 2 or 3 arguments, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("singleton types require 2 or 3 arguments, but %1 were provided").arg(sectionCount - 1));
continue;
} else if (sectionCount == 3) {
// handle qmldir directory listing case where singleton is defined in the following pattern:
@@ -218,7 +218,7 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("typeinfo")) {
if (sectionCount != 2) {
reportError(lineNumber, 0,
- QString::fromLatin1("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1));
continue;
}
#ifdef QT_CREATOR
@@ -228,13 +228,13 @@ bool QQmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("designersupported")) {
if (sectionCount != 1)
- reportError(lineNumber, 0, QString::fromLatin1("designersupported does not expect any argument"));
+ reportError(lineNumber, 0, QStringLiteral("designersupported does not expect any argument"));
else
_designerSupported = true;
} else if (sections[0] == QLatin1String("depends")) {
if (sectionCount != 3) {
reportError(lineNumber, 0,
- QString::fromLatin1("depends requires 2 arguments, but %1 were provided").arg(sectionCount - 1));
+ QStringLiteral("depends requires 2 arguments, but %1 were provided").arg(sectionCount - 1));
continue;
}
@@ -268,7 +268,7 @@ bool QQmlDirParser::parse(const QString &source)
}
} else {
reportError(lineNumber, 0,
- QString::fromLatin1("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount));
+ QStringLiteral("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount));
}
firstLine = false;
@@ -364,14 +364,14 @@ bool QQmlDirParser::designerSupported() const
QDebug &operator<< (QDebug &debug, const QQmlDirParser::Component &component)
{
- const QString output = QString::fromLatin1("{%1 %2.%3}").
+ const QString output = QStringLiteral("{%1 %2.%3}").
arg(component.typeName).arg(component.majorVersion).arg(component.minorVersion);
return debug << qPrintable(output);
}
QDebug &operator<< (QDebug &debug, const QQmlDirParser::Script &script)
{
- const QString output = QString::fromLatin1("{%1 %2.%3}").
+ const QString output = QStringLiteral("{%1 %2.%3}").
arg(script.nameSpace).arg(script.majorVersion).arg(script.minorVersion);
return debug << qPrintable(output);
}
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index df5f50644c..70c682dedd 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1638,7 +1638,7 @@ void QQmlData::destroyed(QObject *object)
if (location.sourceFile.isEmpty())
location.sourceFile = QStringLiteral("<Unknown File>");
locationString.append(location.sourceFile);
- locationString.append(QString::fromLatin1(":%0: ").arg(location.line));
+ locationString.append(QStringLiteral(":%0: ").arg(location.line));
QString source = expr->expression();
if (source.size() > 100) {
source.truncate(96);
diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp
index d904242f93..0a2f4079c2 100644
--- a/src/qml/qml/qqmlglobal.cpp
+++ b/src/qml/qml/qqmlglobal.cpp
@@ -359,7 +359,7 @@ QObject *QQmlGuiProvider::inputMethod()
{
// We don't have any input method code by default
QObject *o = new QObject();
- o->setObjectName(QString::fromLatin1("No inputMethod available"));
+ o->setObjectName(QStringLiteral("No inputMethod available"));
QQmlEngine::setObjectOwnership(o, QQmlEngine::JavaScriptOwnership);
return o;
}
@@ -368,7 +368,7 @@ QObject *QQmlGuiProvider::inputMethod()
QObject *QQmlGuiProvider::styleHints()
{
QObject *o = new QObject();
- o->setObjectName(QString::fromLatin1("No styleHints available"));
+ o->setObjectName(QStringLiteral("No styleHints available"));
QQmlEngine::setObjectOwnership(o, QQmlEngine::JavaScriptOwnership);
return o;
}
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index c0e3b4129b..ce86fd3923 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1355,12 +1355,12 @@ static QString jsStack(QV4::ExecutionEngine *engine) {
QString stackFrame;
if (frame.column >= 0)
- stackFrame = QString::fromLatin1("%1 (%2:%3:%4)").arg(frame.function,
+ stackFrame = QStringLiteral("%1 (%2:%3:%4)").arg(frame.function,
frame.source,
QString::number(frame.line),
QString::number(frame.column));
else
- stackFrame = QString::fromLatin1("%1 (%2:%3)").arg(frame.function,
+ stackFrame = QStringLiteral("%1 (%2:%3)").arg(frame.function,
frame.source,
QString::number(frame.line));
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 6fc0e4a9d8..de46020ad8 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -88,7 +88,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QString &key, Role::Da
if (node) {
const Role &r = *node->value;
if (type != r.type)
- qmlInfo(0) << QString::fromLatin1("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
+ qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
return r;
}
@@ -101,7 +101,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(QV4::String *key, Role::Data
if (node) {
const Role &r = *node->value;
if (type != r.type)
- qmlInfo(0) << QString::fromLatin1("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
+ qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
return r;
}
@@ -1185,7 +1185,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d
}
roleIndex = setListProperty(role, subModel);
} else {
- qmlInfo(0) << QString::fromLatin1("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
+ qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
}
} else if (d.isBoolean()) {
roleIndex = setBoolProperty(role, d.booleanValue());
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 237bbe76e9..cfa80c4f19 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -50,7 +50,7 @@ QuickTestEvent::~QuickTestEvent()
bool QuickTestEvent::keyPress(int key, int modifiers, int delay)
{
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyPress(window, Qt::Key(key), Qt::KeyboardModifiers(modifiers), delay);
@@ -59,7 +59,7 @@ bool QuickTestEvent::keyPress(int key, int modifiers, int delay)
bool QuickTestEvent::keyRelease(int key, int modifiers, int delay)
{
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyRelease(window, Qt::Key(key), Qt::KeyboardModifiers(modifiers), delay);
@@ -68,7 +68,7 @@ bool QuickTestEvent::keyRelease(int key, int modifiers, int delay)
bool QuickTestEvent::keyClick(int key, int modifiers, int delay)
{
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyClick(window, Qt::Key(key), Qt::KeyboardModifiers(modifiers), delay);
@@ -78,7 +78,7 @@ bool QuickTestEvent::keyClick(int key, int modifiers, int delay)
bool QuickTestEvent::keyPressChar(const QString &character, int modifiers, int delay)
{
QTEST_ASSERT(character.length() == 1);
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyPress(window, character[0].toLatin1(), Qt::KeyboardModifiers(modifiers), delay);
@@ -88,7 +88,7 @@ bool QuickTestEvent::keyPressChar(const QString &character, int modifiers, int d
bool QuickTestEvent::keyReleaseChar(const QString &character, int modifiers, int delay)
{
QTEST_ASSERT(character.length() == 1);
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyRelease(window, character[0].toLatin1(), Qt::KeyboardModifiers(modifiers), delay);
@@ -98,7 +98,7 @@ bool QuickTestEvent::keyReleaseChar(const QString &character, int modifiers, int
bool QuickTestEvent::keyClickChar(const QString &character, int modifiers, int delay)
{
QTEST_ASSERT(character.length() == 1);
- QWindow *window = eventWindow();
+ QWindow *window = activeWindow();
if (!window)
return false;
QTest::keyClick(window, character[0].toLatin1(), Qt::KeyboardModifiers(modifiers), delay);
@@ -316,4 +316,11 @@ QWindow *QuickTestEvent::eventWindow(QObject *item)
return 0;
}
+QWindow *QuickTestEvent::activeWindow()
+{
+ if (QWindow *window = QGuiApplication::focusWindow())
+ return window;
+ return eventWindow();
+}
+
QT_END_NAMESPACE
diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h
index e11674f66a..338464c6b3 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/qmltest/quicktestevent_p.h
@@ -74,6 +74,7 @@ public Q_SLOTS:
private:
QWindow *eventWindow(QObject *item = 0);
+ QWindow *activeWindow();
};
QT_END_NAMESPACE
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index ed424b5a67..7dbe35807d 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -120,6 +120,8 @@ const char *UNCAUGHT = "uncaught";
const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
+const char *BLOCKRESTRICTEDMODE = "-qmljsdebugger=port:3771,3800,block,services:V8Debugger";
+const char *NORMALRESTRICTEDMODE = "-qmljsdebugger=port:3771,3800,services:V8Debugger";
const char *TEST_QMLFILE = "test.qml";
const char *TEST_JSFILE = "test.js";
const char *TIMER_QMLFILE = "timer.qml";
@@ -157,7 +159,8 @@ class tst_QQmlDebugJS : public QQmlDataTest
{
Q_OBJECT
- bool init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true);
+ void init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true,
+ bool restrictServices = false);
private slots:
void initTestCase();
@@ -165,6 +168,7 @@ private slots:
void cleanup();
+ void connect_data();
void connect();
void interrupt();
void getVersion();
@@ -822,33 +826,29 @@ void tst_QQmlDebugJS::cleanupTestCase()
// qDebug() << "Time Elapsed:" << t.elapsed();
}
-bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
+void tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode, bool restrictServices)
{
connection = new QQmlDebugConnection();
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
client = new QJSDebugClient(connection);
+ const char *args = 0;
if (blockMode)
- process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
+ args = restrictServices ? BLOCKRESTRICTEDMODE : BLOCKMODE;
else
- process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
+ args = restrictServices ? NORMALRESTRICTEDMODE : NORMALMODE;
- if (!process->waitForSessionStart()) {
- qDebug() << "could not launch application, or did not get 'Waiting for connection'.";
- return false;
- }
+ process->start(QStringList() << QLatin1String(args) << testFile(qmlFile));
+
+ QVERIFY(process->waitForSessionStart());
const int port = process->debugPort();
connection->connectToHost("127.0.0.1", port);
- if (!connection->waitForConnected()) {
- qDebug() << "could not connect to host!";
- return false;
- }
+ QVERIFY(connection->waitForConnected());
- if (client->state() == QQmlDebugClient::Enabled)
- return true;
- return QQmlDebugTest::waitForSignal(client, SIGNAL(enabled()));
+ if (client->state() != QQmlDebugClient::Enabled)
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(enabled())));
}
void tst_QQmlDebugJS::cleanup()
@@ -874,11 +874,21 @@ void tst_QQmlDebugJS::cleanup()
connection = 0;
}
-void tst_QQmlDebugJS::connect()
+void tst_QQmlDebugJS::connect_data()
{
- //void connect()
+ QTest::addColumn<bool>("blockMode");
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("normal/unrestricted") << false << false;
+ QTest::newRow("block/unrestricted") << true << false;
+ QTest::newRow("normal/restricted") << false << true;
+ QTest::newRow("block/restricted") << true << true;
+}
- QVERIFY(init());
+void tst_QQmlDebugJS::connect()
+{
+ QFETCH(bool, blockMode);
+ QFETCH(bool, restrictMode);
+ init(QString(TEST_QMLFILE), blockMode, restrictMode);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
}
@@ -887,7 +897,7 @@ void tst_QQmlDebugJS::interrupt()
{
//void connect()
- QVERIFY(init());
+ init();
client->connect();
client->interrupt();
@@ -898,7 +908,7 @@ void tst_QQmlDebugJS::getVersion()
{
//void version()
- QVERIFY(init());
+ init();
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
@@ -923,7 +933,7 @@ void tst_QQmlDebugJS::disconnect()
{
//void disconnect()
- QVERIFY(init());
+ init();
client->connect();
client->disconnect();
@@ -935,7 +945,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted()
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -955,7 +965,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 39;
- QVERIFY(init(CREATECOMPONENT_QMLFILE));
+ init(CREATECOMPONENT_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -973,7 +983,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback()
{
int sourceLine = 40;
- QVERIFY(init(TIMER_QMLFILE));
+ init(TIMER_QMLFILE);
client->connect();
//We can set the breakpoint after connect() here because the timer is repeating and if we miss
@@ -995,7 +1005,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile()
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 35;
- QVERIFY(init(LOADJSFILE_QMLFILE));
+ init(LOADJSFILE_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
client->connect();
@@ -1016,7 +1026,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnComment()
int sourceLine = 39;
int actualLine = 41;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1038,7 +1048,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine()
int sourceLine = 40;
int actualLine = 41;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1059,7 +1069,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
int sourceLine = 44;
- QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+ init(BREAKPOINTRELOCATION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1078,7 +1088,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
int out = 10;
int sourceLine = 42;
- QVERIFY(init(CONDITION_QMLFILE));
+ init(CONDITION_QMLFILE);
client->connect();
//The breakpoint is in a timer loop so we can set it after connect().
@@ -1112,7 +1122,7 @@ void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
void tst_QQmlDebugJS::setBreakpointInScriptThatQuits()
{
- QVERIFY(init(QUIT_QMLFILE));
+ init(QUIT_QMLFILE);
int sourceLine = 41;
@@ -1153,7 +1163,7 @@ void tst_QQmlDebugJS::setBreakpointOnEvent()
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
- QVERIFY(init(TIMER_QMLFILE));
+ init(TIMER_QMLFILE);
client->setBreakpoint(QLatin1String(EVENT), QLatin1String("triggered"), -1, -1, true);
client->connect();
@@ -1174,7 +1184,7 @@ void tst_QQmlDebugJS::clearBreakpoint()
int sourceLine1 = 42;
int sourceLine2 = 43;
- QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
+ init(CHANGEBREAKPOINT_QMLFILE);
client->connect();
//The breakpoints are in a timer loop so we can set them after connect().
@@ -1219,7 +1229,7 @@ void tst_QQmlDebugJS::setExceptionBreak()
{
//void setExceptionBreak(QString type, bool enabled = false);
- QVERIFY(init(EXCEPTION_QMLFILE));
+ init(EXCEPTION_QMLFILE);
client->setExceptionBreak(QJSDebugClient::All,true);
client->connect();
QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
@@ -1230,7 +1240,7 @@ void tst_QQmlDebugJS::stepNext()
//void continueDebugging(StepAction stepAction, int stepCount = 1);
int sourceLine = 42;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1254,7 +1264,7 @@ void tst_QQmlDebugJS::stepIn()
int sourceLine = 46;
int actualLine = 42;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true);
client->connect();
@@ -1278,7 +1288,7 @@ void tst_QQmlDebugJS::stepOut()
int sourceLine = 42;
int actualLine = 46;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1302,7 +1312,7 @@ void tst_QQmlDebugJS::continueDebugging()
int sourceLine1 = 46;
int sourceLine2 = 43;
- QVERIFY(init(STEPACTION_QMLFILE));
+ init(STEPACTION_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true);
@@ -1326,7 +1336,7 @@ void tst_QQmlDebugJS::backtrace()
//void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1341,7 +1351,7 @@ void tst_QQmlDebugJS::getFrameDetails()
//void frame(int number = -1);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1356,7 +1366,7 @@ void tst_QQmlDebugJS::getScopeDetails()
//void scope(int number = -1, int frameNumber = -1);
int sourceLine = 39;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1371,7 +1381,7 @@ void tst_QQmlDebugJS::evaluateInGlobalScope()
{
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
- QVERIFY(init());
+ init();
client->connect();
client->evaluate(QLatin1String("console.log('Hello World')"), true);
@@ -1393,7 +1403,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
//void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
int sourceLine = 47;
- QVERIFY(init(ONCOMPLETED_QMLFILE));
+ init(ONCOMPLETED_QMLFILE);
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
client->connect();
@@ -1427,7 +1437,7 @@ void tst_QQmlDebugJS::getScripts()
{
//void scripts(int types = -1, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
- QVERIFY(init());
+ init();
client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QString(TEST_QMLFILE), 40, -1, true);
client->connect();
diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
index f6cf9dae60..11fa56d710 100644
--- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
+++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
@@ -103,12 +103,15 @@ private:
QQmlDebugConnection *m_connection;
QQmlEngineControlClient *m_client;
- void connect(const QString &testFile);
+ void connect(const QString &testFile, bool restrictServices);
+ void engine_data();
private slots:
void cleanup();
+ void startEngine_data();
void startEngine();
+ void stopEngine_data();
void stopEngine();
};
@@ -148,11 +151,13 @@ void QQmlEngineControlClient::messageReceived(const QByteArray &message)
QVERIFY(stream.atEnd());
}
-void tst_QQmlEngineControl::connect(const QString &testFile)
+void tst_QQmlEngineControl::connect(const QString &testFile, bool restrictServices)
{
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:EngineControl") : QString());
arguments << QQmlDataTest::instance()->testFile(testFile);
@@ -165,6 +170,8 @@ void tst_QQmlEngineControl::connect(const QString &testFile)
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlEngineControl::cleanup()
@@ -183,11 +190,23 @@ void tst_QQmlEngineControl::cleanup()
m_connection = 0;
}
+void tst_QQmlEngineControl::engine_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
+}
+
+void tst_QQmlEngineControl::startEngine_data()
+{
+ engine_data();
+}
+
void tst_QQmlEngineControl::startEngine()
{
- connect("test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+
+ connect("test.qml", restrictMode);
QTRY_VERIFY(!m_client->startingEngines.empty());
m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last());
@@ -196,11 +215,16 @@ void tst_QQmlEngineControl::startEngine()
"No engine start message received in time.");
}
+void tst_QQmlEngineControl::stopEngine_data()
+{
+ engine_data();
+}
+
void tst_QQmlEngineControl::stopEngine()
{
- connect("exit.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+
+ connect("exit.qml", restrictMode);
QTRY_VERIFY(!m_client->startingEngines.empty());
m_client->command(QQmlEngineControlClient::StartWaitingEngine, m_client->startingEngines.last());
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 8d119a30d7..0285bae189 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -61,6 +61,7 @@ public:
private:
+ void init(bool restrictServices);
QmlDebugObjectReference findRootObject();
QQmlDebugProcess *m_process;
@@ -68,9 +69,9 @@ private:
QQmlEngineDebugClient *m_engineDebugClient;
private slots:
- void init();
void cleanup();
+ void connect_data();
void connect();
void clearObjectReferenceHashonReloadQml();
};
@@ -93,9 +94,12 @@ QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject(
}
-void tst_QQmlEngineDebugInspectorIntegration::init()
+void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:QmlDebugger,QmlInspector") :
+ QString());
// ### Still using qmlscene because of QTBUG-33376
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
@@ -108,10 +112,8 @@ void tst_QQmlEngineDebugInspectorIntegration::init()
m_inspectorClient = new QQmlInspectorClient(m_connection);
m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
- const int port = m_process->debugPort();
- m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
- bool ok = m_connection->waitForConnected();
- QVERIFY(ok);
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
+ QVERIFY(m_connection->waitForConnected());
}
void tst_QQmlEngineDebugInspectorIntegration::cleanup()
@@ -125,14 +127,24 @@ void tst_QQmlEngineDebugInspectorIntegration::cleanup()
delete m_inspectorClient;
}
+void tst_QQmlEngineDebugInspectorIntegration::connect_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
+}
+
void tst_QQmlEngineDebugInspectorIntegration::connect()
{
+ QFETCH(bool, restrictMode);
+ init(restrictMode);
QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlEngineDebugInspectorIntegration::clearObjectReferenceHashonReloadQml()
{
+ init(true);
QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
bool success = false;
QmlDebugObjectReference rootObject = findRootObject();
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 2db544d661..bc3220ad8c 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -1225,7 +1225,7 @@ int main(int argc, char *argv[])
char **_argv = new char*[_argc];
for (int i = 0; i < argc; ++i)
_argv[i] = argv[i];
- char arg[] = "-qmljsdebugger=port:3768";
+ char arg[] = "-qmljsdebugger=port:3768,services:QmlDebugger";
_argv[_argc - 1] = arg;
QGuiApplication app(_argc, _argv);
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 3769b1b9c4..70833f5e2c 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -60,7 +60,7 @@ public:
}
private:
- void startQmlsceneProcess(const char *qmlFile);
+ void startQmlsceneProcess(const char *qmlFile, bool restrictMode = true);
private:
QQmlDebugProcess *m_process;
@@ -68,18 +68,20 @@ private:
QQmlInspectorClient *m_client;
private slots:
- void init();
void cleanup();
+ void connect_data();
void connect();
void showAppOnTop();
void reloadQml();
void reloadQmlWindow();
};
-void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
+void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */, bool restrictServices)
{
- const QString argument = "-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block";
+ const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(restrictServices ? QStringLiteral(",services:QmlInspector") : QString());
// ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase)
m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
@@ -87,15 +89,13 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
QVERIFY2(m_process->waitForSessionStart(),
"Could not launch application, or did not get 'Waiting for connection'.");
- QQmlDebugConnection *m_connection = new QQmlDebugConnection();
+ m_connection = new QQmlDebugConnection();
m_client = new QQmlInspectorClient(m_connection);
- const int port = m_process->debugPort();
- m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
-}
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
+ QVERIFY(m_client);
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
-void tst_QQmlInspector::init()
-{
}
void tst_QQmlInspector::cleanup()
@@ -104,16 +104,25 @@ void tst_QQmlInspector::cleanup()
qDebug() << "Process State:" << m_process->state();
qDebug() << "Application Output:" << m_process->output();
}
- delete m_process;
- delete m_connection;
delete m_client;
+ m_client = 0;
+ delete m_connection;
+ m_connection = 0;
+ delete m_process;
+ m_process = 0;
+}
+
+void tst_QQmlInspector::connect_data()
+{
+ QTest::addColumn<bool>("restrictMode");
+ QTest::newRow("unrestricted") << false;
+ QTest::newRow("restricted") << true;
}
void tst_QQmlInspector::connect()
{
- startQmlsceneProcess("qtquick2.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, restrictMode);
+ startQmlsceneProcess("qtquick2.qml", restrictMode);
}
void tst_QQmlInspector::showAppOnTop()
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 744830b55b..0e63e18952 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -197,7 +197,7 @@ private:
CheckAll = CheckMessageType | CheckDetailType | CheckLine | CheckColumn | CheckDataEndsWith
};
- void connect(bool block, const QString &testFile);
+ void connect(bool block, const QString &testFile, bool restrictServices = true);
void checkTraceReceived();
void checkJsHeap();
bool verify(MessageListType type, int expectedPosition, const QQmlProfilerData &expected,
@@ -206,9 +206,8 @@ private:
private slots:
void cleanup();
- void blockingConnectWithTraceEnabled();
- void blockingConnectWithTraceDisabled();
- void nonBlockingConnect();
+ void connect_data();
+ void connect();
void pixmapCacheData();
void scenegraphData();
void profileOnExit();
@@ -357,17 +356,16 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
qmlMessages.append(data);
}
-void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
+void tst_QQmlProfilerService::connect(bool block, const QString &testFile, bool restrictServices)
{
// ### Still using qmlscene due to QTBUG-33377
const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
QStringList arguments;
- if (block)
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
- else
- arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO );
-
- arguments << QQmlDataTest::instance()->testFile(testFile);
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,%2%3%4")
+ .arg(STR_PORT_FROM).arg(STR_PORT_TO)
+ .arg(block ? QStringLiteral(",block") : QString())
+ .arg(restrictServices ? QStringLiteral(",services:CanvasFrameRate") : QString())
+ << QQmlDataTest::instance()->testFile(testFile);
m_process = new QQmlDebugProcess(executable, this);
m_process->start(QStringList() << arguments);
@@ -378,6 +376,8 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
const int port = m_process->debugPort();
m_connection->connectToHost(QLatin1String("127.0.0.1"), port);
+ QVERIFY(m_client);
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
}
void tst_QQmlProfilerService::checkTraceReceived()
@@ -560,37 +560,32 @@ void tst_QQmlProfilerService::cleanup()
m_connection = 0;
}
-void tst_QQmlProfilerService::blockingConnectWithTraceEnabled()
+void tst_QQmlProfilerService::connect_data()
{
- connect(true, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
-
- m_client->setTraceState(true);
- m_client->setTraceState(false);
- checkTraceReceived();
- checkJsHeap();
+ QTest::addColumn<bool>("blockMode");
+ QTest::addColumn<bool>("restrictMode");
+ QTest::addColumn<bool>("traceEnabled");
+ QTest::newRow("normal/unrestricted/disabled") << false << false << false;
+ QTest::newRow("block/unrestricted/disabled") << true << false << false;
+ QTest::newRow("normal/restricted/disabled") << false << true << false;
+ QTest::newRow("block/restricted/disabled") << true << true << false;
+ QTest::newRow("normal/unrestricted/enabled") << false << false << true;
+ QTest::newRow("block/unrestricted/enabled") << true << false << true;
+ QTest::newRow("normal/restricted/enabled") << false << true << true;
+ QTest::newRow("block/restricted/enabled") << true << true << true;
}
-void tst_QQmlProfilerService::blockingConnectWithTraceDisabled()
+void tst_QQmlProfilerService::connect()
{
- connect(true, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ QFETCH(bool, blockMode);
+ QFETCH(bool, restrictMode);
+ QFETCH(bool, traceEnabled);
- m_client->setTraceState(false);
- m_client->setTraceState(true);
- m_client->setTraceState(false);
- checkTraceReceived();
- checkJsHeap();
-}
-
-void tst_QQmlProfilerService::nonBlockingConnect()
-{
- connect(false, "test.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+ connect(blockMode, "test.qml", restrictMode);
+ // if the engine is waiting, then the first message determines if it starts with trace enabled
+ if (!traceEnabled)
+ m_client->setTraceState(false);
m_client->setTraceState(true);
m_client->setTraceState(false);
checkTraceReceived();
@@ -600,8 +595,6 @@ void tst_QQmlProfilerService::nonBlockingConnect()
void tst_QQmlProfilerService::pixmapCacheData()
{
connect(true, "pixmapCacheTest.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
@@ -639,8 +632,6 @@ void tst_QQmlProfilerService::pixmapCacheData()
void tst_QQmlProfilerService::scenegraphData()
{
connect(true, "scenegraphTest.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
@@ -693,8 +684,6 @@ void tst_QQmlProfilerService::scenegraphData()
void tst_QQmlProfilerService::profileOnExit()
{
connect(true, "exit.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
@@ -705,8 +694,6 @@ void tst_QQmlProfilerService::profileOnExit()
void tst_QQmlProfilerService::controlFromJS()
{
connect(true, "controlFromJS.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(false);
checkTraceReceived();
@@ -716,8 +703,6 @@ void tst_QQmlProfilerService::controlFromJS()
void tst_QQmlProfilerService::signalSourceLocation()
{
connect(true, "signalSourceLocation.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
while (!(m_process->output().contains(QLatin1String("500"))))
@@ -741,8 +726,6 @@ void tst_QQmlProfilerService::signalSourceLocation()
void tst_QQmlProfilerService::javascript()
{
connect(true, "javascript.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true);
while (!(m_process->output().contains(QLatin1String("done"))))
@@ -772,8 +755,6 @@ void tst_QQmlProfilerService::javascript()
void tst_QQmlProfilerService::flushInterval()
{
connect(true, "timer.qml");
- QVERIFY(m_client);
- QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
m_client->setTraceState(true, 1);
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 206788c061..c2718de240 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -209,7 +209,7 @@ public Q_SLOTS:
//Will be checked before calling exec()
earlyExit = true;
}
-#ifdef QT_GUI_LIB
+#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
void onOpenGlContextCreated(QOpenGLContext *context);
#endif
};
@@ -231,7 +231,7 @@ void LoadWatcher::contain(QObject *o, const QUrl &containPath)
void LoadWatcher::checkForWindow(QObject *o)
{
-#ifdef QT_GUI_LIB
+#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
if (verboseMode && o->isWindowType() && o->inherits("QQuickWindow")) {
connect(o, SIGNAL(openglContextCreated(QOpenGLContext*)),
this, SLOT(onOpenGlContextCreated(QOpenGLContext*)));
@@ -241,7 +241,7 @@ void LoadWatcher::checkForWindow(QObject *o)
#endif // QT_GUI_LIB
}
-#ifdef QT_GUI_LIB
+#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
void LoadWatcher::onOpenGlContextCreated(QOpenGLContext *context)
{
context->makeCurrent(qobject_cast<QWindow *>(sender()));
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 188373ccc6..1eab1a0a8c 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -476,7 +476,8 @@ void QmlProfilerApplication::run()
if (m_runMode == LaunchMode) {
m_process = new QProcess(this);
QStringList arguments;
- arguments << QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_port);
+ arguments << QString::fromLatin1("-qmljsdebugger=port:%1,block,services:CanvasFrameRate")
+ .arg(m_port);
arguments << m_programArguments;
m_process->setProcessChannelMode(QProcess::MergedChannels);