summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-04-07 10:58:38 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-04-08 16:28:38 +0000
commit9136c16ae640aec8ab393237ce1a1c7f89c8bb1d (patch)
treec59d4b5134ee814a0e22641618a1495b3e35ead4
parentb688719130142e1bee4b7e1c010332dc65e89cb5 (diff)
Avoid HTML encodings in default JS QMessageBox'es5.14
Escape any HTML encodings, as we have no convenient way to set formating to Qt::PlainText. Fixes: QTBUG-83338 Change-Id: I4d8cb05fe643eb018d3e40119c629e7304fe0813 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 850a29a1..7e02130c 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -2345,7 +2345,9 @@ void QWebEnginePage::javaScriptAlert(const QUrl &securityOrigin, const QString &
{
Q_UNUSED(securityOrigin);
#if QT_CONFIG(messagebox)
- QMessageBox::information(view(), QStringLiteral("Javascript Alert - %1").arg(url().toString()), msg);
+ QMessageBox::information(view(),
+ QStringLiteral("Javascript Alert - %1").arg(url().toString()),
+ msg.toHtmlEscaped());
#else
Q_UNUSED(msg);
#endif // QT_CONFIG(messagebox)
@@ -2355,7 +2357,11 @@ bool QWebEnginePage::javaScriptConfirm(const QUrl &securityOrigin, const QString
{
Q_UNUSED(securityOrigin);
#if QT_CONFIG(messagebox)
- return (QMessageBox::information(view(), QStringLiteral("Javascript Confirm - %1").arg(url().toString()), msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok);
+ return (QMessageBox::information(view(),
+ QStringLiteral("Javascript Confirm - %1").arg(url().toString()),
+ msg.toHtmlEscaped(),
+ QMessageBox::Ok,
+ QMessageBox::Cancel) == QMessageBox::Ok);
#else
Q_UNUSED(msg);
return false;
@@ -2368,7 +2374,12 @@ bool QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin, const QString
#if QT_CONFIG(inputdialog)
bool ret = false;
if (result)
- *result = QInputDialog::getText(view(), QStringLiteral("Javascript Prompt - %1").arg(url().toString()), msg, QLineEdit::Normal, defaultValue, &ret);
+ *result = QInputDialog::getText(view(),
+ QStringLiteral("Javascript Prompt - %1").arg(url().toString()),
+ msg.toHtmlEscaped(),
+ QLineEdit::Normal,
+ defaultValue.toHtmlEscaped(),
+ &ret);
return ret;
#else
Q_UNUSED(msg);