summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-09-30 15:43:24 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:31:05 +0000
commita0be5222b8695aed31664ab4e8e804632569ed64 (patch)
treefe477e98b7aecd302b2176264046ceac0cfe6236 /Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
parent9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c (diff)
Imported WebKit commit 2730223e8fe1776419fae168986b9e77f55d02d3
Change-Id: I46d453477a779a8db544ffc50d088fa13331da9b Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp')
-rw-r--r--Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
index 2eacc70b0..a46d39050 100644
--- a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
+++ b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
@@ -642,6 +642,7 @@ private Q_SLOTS:
void introspectQtMethods_data();
void introspectQtMethods();
void scriptablePlugin();
+ void exceptionInSlot();
private:
QString evalJS(const QString& s)
@@ -2239,5 +2240,32 @@ void tst_QObjectBridge::scriptablePlugin()
//#endif
}
+class WebPageWithConsoleCapture : public QWebPage
+{
+public:
+ void javaScriptConsoleMessage(const QString &message, int, const QString &)
+ {
+ consoleMessages << message;
+ }
+
+ QStringList consoleMessages;
+};
+
+void tst_QObjectBridge::exceptionInSlot()
+{
+ WebPageWithConsoleCapture page;
+ QWebFrame* frame = page.mainFrame();
+ frame->addToJavaScriptWindowObject("myObject", m_myObject);
+ frame->evaluateJavaScript(
+ "myHandler = function() { window.gotSignal = true; throw 'exception in slot'; };"
+ "myObject.mySignal.connect(myHandler);"
+ "gotSignal = false;"
+ "myObject.mySignal();"
+ );
+ QString ret = frame->evaluateJavaScript("gotSignal").toString();
+ QCOMPARE(ret, sTrue);
+ QCOMPARE(page.consoleMessages, QStringList() << "exception in slot");
+}
+
QTEST_MAIN(tst_QObjectBridge)
#include "tst_qobjectbridge.moc"