From 6701ff310933ec33f9199b53d78299764f646387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Fri, 15 Dec 2017 13:04:02 +0100 Subject: Allow deleting a channel during method invocation A real-life use case is the session restore page in KDE Falkon or, more generally, any kind of closeTab() method exposed to JS in a QWebEnginePage. The approach taken in this patch will only work if the transport can also deal with deletion during a messageReceived signal emission. Alternatively, method invocation could be delayed via the event loop, but this would come with an obvious performance penalty. Change-Id: I2940f61e07c77365f6e3e7cd29463d4cb5b525a6 Reviewed-by: Milian Wolff --- tests/auto/webchannel/tst_webchannel.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/auto/webchannel/tst_webchannel.h') diff --git a/tests/auto/webchannel/tst_webchannel.h b/tests/auto/webchannel/tst_webchannel.h index d2597e5..85a9f39 100644 --- a/tests/auto/webchannel/tst_webchannel.h +++ b/tests/auto/webchannel/tst_webchannel.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -53,10 +54,18 @@ public: emit messageReceived(message, this); } + QVector messagesSent() const + { + return mMessagesSent; + } + public slots: - void sendMessage(const QJsonObject &/*message*/) Q_DECL_OVERRIDE + void sendMessage(const QJsonObject &message) Q_DECL_OVERRIDE { + mMessagesSent.push_back(message); } +private: + QVector mMessagesSent; }; class TestObject : public QObject @@ -296,6 +305,8 @@ private slots: void testPassWrappedObjectBack(); void testInfiniteRecursion(); void testAsyncObject(); + void testDeletionDuringMethodInvocation_data(); + void testDeletionDuringMethodInvocation(); void benchClassInfo(); void benchInitializeClients(); -- cgit v1.2.1