diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-03-13 16:26:21 +0100 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2018-05-30 12:50:59 +0000 |
commit | c2e341a705b5d0aaf38e42d52e7c0283a3ec7312 (patch) | |
tree | 631479d99f85d4623d0eec240ecfba11cecba70f /tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | |
parent | ea28cff7524bf0409b43c8ba3ede8fe2f7022ae4 (diff) |
Fix segfault in QWebEnginePage::triggerAction
Calling triggerAction for a context-menu-specific action (like
DownloadLinkToDisk), when no context menu exists, will crash.
Change-Id: Ife647b7a7d8ab1a0d9dcb7d3566be130516e6e63
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp')
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 8d0d5c43c..ee2c36012 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -218,6 +218,7 @@ private Q_SLOTS: void dataURLFragment(); void devTools(); void openLinkInDifferentProfile(); + void triggerActionWithoutMenu(); private: static QPoint elementCenter(QWebEnginePage *page, const QString &id); @@ -4402,6 +4403,15 @@ void tst_QWebEnginePage::openLinkInDifferentProfile() QVERIFY(spy2.takeFirst().value(0).toBool()); } +void tst_QWebEnginePage::triggerActionWithoutMenu() +{ + // Calling triggerAction should not crash even when for + // context-menu-specific actions without a context menu. + QWebEngineProfile profile; + QWebEnginePage page(&profile); + page.triggerAction(QWebEnginePage::DownloadLinkToDisk); +} + static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")}; W_QTEST_MAIN(tst_QWebEnginePage, params) |