summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-09-24 12:03:59 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-09-25 14:59:50 +0200
commit77517b562777b8975d7b2345cc6790e6925ed136 (patch)
tree3bd9da3e6842af2d0b9c04b46693c66ab437fd2e
parent16192598a84eaf9ac9a50b7cca6ac5e4c21bb5e8 (diff)
parent52345f558f55e04ea68a8fa30d9862ca69131a18 (diff)
Merge "Merge remote-tracking branch 'origin/5.13' into 5.14"
-rw-r--r--dist/changes-5.12.580
-rw-r--r--dist/changes-5.13.191
-rw-r--r--examples/webenginewidgets/notifications/doc/src/notifications.qdoc28
-rw-r--r--examples/webenginewidgets/notifications/main.cpp19
-rw-r--r--examples/webenginewidgets/notifications/notificationpopup.h15
-rw-r--r--src/buildtools/config/linux.pri18
-rw-r--r--src/core/api/qwebenginenotification.cpp83
-rw-r--r--src/core/certificate_error_controller.cpp6
-rw-r--r--src/core/certificate_error_controller_p.h4
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/core_common.pri3
-rw-r--r--src/core/file_picker_controller.cpp51
-rw-r--r--src/core/profile_io_data_qt.cpp7
-rw-r--r--src/core/profile_io_data_qt.h2
-rw-r--r--src/core/render_widget_host_view_qt.cpp9
-rw-r--r--src/core/touch_selection_controller_client_qt.cpp2
-rw-r--r--src/core/web_event_factory.cpp4
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp8
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp2
-rw-r--r--src/webengine/api/qquickwebengineview.cpp6
-rw-r--r--src/webengine/doc/src/qtwebengine-features.qdoc4
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc2
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc16
-rw-r--r--src/webengine/plugin/plugin.cpp2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp4
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp2
-rw-r--r--src/webengine/ui/ToolTip.qml8
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp11
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp3
-rw-r--r--src/webenginewidgets/api/qwebenginescript.cpp2
-rw-r--r--src/webenginewidgets/api/qwebenginescriptcollection.cpp2
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp2
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc19
-rw-r--r--tests/auto/quick/qmltests/data/tst_filePicker.qml116
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp14
-rw-r--r--tests/auto/widgets/proxypac/tst_proxypac.cpp4
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST4
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp10
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp34
39 files changed, 552 insertions, 147 deletions
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5
new file mode 100644
index 000000000..15f0bcde6
--- /dev/null
+++ b/dist/changes-5.12.5
@@ -0,0 +1,80 @@
+Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.12.5 Changes *
+****************************************************************************
+
+General
+-------
+
+ - [QTBUG-62106] Fixed possible crash after rapid tapping.
+ - [QTBUG-75884] Fixed crash on setHttpUserAgent.
+ - [QTBUG-76249] Fixed user-agent on some new windows.
+ - [QTBUG-76268] Fixed tab key send on minimize.
+ - [QTBUG-76347] Fixed duplicate events being send from tablets.
+ - [QTBUG-76828] Clear shared context on exit.
+ - [QTBUG-76958] Fixed possible crash when loading in background.
+
+Chromium
+--------
+
+ - Security fixes from Chromium up to version 76.0.3809.87, including:
+
+ - CVE-2019-5829
+ - CVE-2019-5831
+ - CVE-2019-5832
+ - CVE-2019-5837
+ - CVE-2019-5839
+ - CVE-2019-5842
+ - CVE-2019-5851
+ - CVE-2019-5852
+ - CVE-2019-5854
+ - CVE-2019-5855
+ - CVE-2019-5856
+ - CVE-2019-5857
+ - CVE-2019-5860
+ - CVE-2019-5861
+ - CVE-2019-5862
+ - CVE-2019-5865
+ - Critical security issue 977057
+ - Security bug 934161
+ - Security bug 939644
+ - Security bug 948172
+ - Security bug 948228
+ - Security bug 948944
+ - Security bug 950005
+ - Security bug 952849
+ - Security bug 956625
+ - Security bug 958457
+ - Security bug 958689
+ - Security bug 959193
+ - Security bug 959518
+ - Security bug 958717
+ - Security bug 960785
+ - Security bug 961674
+ - Security bug 961597
+ - Security bug 962083
+ - Security bug 964002
+ - Security bug 973893
+ - Security bug 974627
+ - Security bug 976050
+ - Security bug 981602
+ - Security bug 983850
+ - Security bug 983938
diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1
new file mode 100644
index 000000000..9e3a49558
--- /dev/null
+++ b/dist/changes-5.13.1
@@ -0,0 +1,91 @@
+Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.13.1 Changes *
+****************************************************************************
+
+General
+-------
+
+ - [QTBUG-62106] Fixed possible crash after rapid tapping.
+ - [QTBUG-76226] Fixed PDF viewer on URLs with percent-encoded characters.
+ - [QTBUG-76249] Fixed user-agent on some new windows.
+ - [QTBUG-76958] Fixed possible crash when loading in background.
+
+
+Chromium
+--------
+
+ - Security fixes from Chromium up to version 76.0.3809.87, including:
+
+ - CVE-2019-5829
+ - CVE-2019-5831
+ - CVE-2019-5832
+ - CVE-2019-5836
+ - CVE-2019-5837
+ - CVE-2019-5839
+ - CVE-2019-5842
+ - CVE-2019-5851
+ - CVE-2019-5852
+ - CVE-2019-5854
+ - CVE-2019-5855
+ - CVE-2019-5856
+ - CVE-2019-5857
+ - CVE-2019-5860
+ - CVE-2019-5861
+ - CVE-2019-5862
+ - CVE-2019-5865
+ - Critical security issue 977057
+ - Security issue 934161
+ - Security issue 939644
+ - Security issue 948172
+ - Security issue 948228
+ - Security issue 948944
+ - Security issue 950005
+ - Security issue 952849
+ - Security issue 954762
+ - Security issue 956625
+ - Security issue 958717
+ - Security issue 958457
+ - Security issue 958689
+ - Security issue 959192
+ - Security issue 959193
+ - Security issue 959518
+ - Security issue 960785
+ - Security issue 961597
+ - Security issue 961674
+ - Security issue 962083
+ - Security issue 962572
+ - Security issue 964002
+ - Security issue 964795
+ - Security issue 964928
+ - Security issue 973893
+ - Security issue 974627
+ - Security issue 976050
+ - Security issue 981602
+ - Security issue 983850
+ - Security issue 983938
+
+
+Qt WebEngine Core
+-----------------
+
+ - [QTBUG-60203] QWebEngineUrlRequestInterceptor can now set referer header.
+
diff --git a/examples/webenginewidgets/notifications/doc/src/notifications.qdoc b/examples/webenginewidgets/notifications/doc/src/notifications.qdoc
index 2c999e7e1..ec932f90c 100644
--- a/examples/webenginewidgets/notifications/doc/src/notifications.qdoc
+++ b/examples/webenginewidgets/notifications/doc/src/notifications.qdoc
@@ -44,22 +44,22 @@
In this example, we create an internal HTML page that is added through
a resource collection file (.qrc). The page displays buttons for requesting
- permissions and creating a notification. In addition, it contains JavaScript
- logic for triggering these actions.
+ permissions and contains necessary JavaScript code to trigger this request:
\quotefromfile webenginewidgets/notifications/data/index.html
\skipto Notification.requestPermission
\printline requestPermission
- \dots
- \skipto if
- \printuntil createNotification()
- \printline /^})$/
+ \skipuntil resetPermission
+ \printuntil /\}\)$/
+
+ Also page contains a button for creating a notification. The following
+ JavaScript constructions are executed on the press event:
\quotefromfile webenginewidgets/notifications/data/index.html
\skipto createNotification()
- \printuntil Notification
- \dots
- \printline /^})$/
+ \printuntil new Notification
+ \skipuntil Notification was created
+ \printline }
\section1 Main Function
@@ -127,7 +127,8 @@
\skipto QWebEngineNotification::closed
\printuntil QTimer
- \printline /^\}/
+ \skipto /\}/
+ \printline /\}/
\section2 Closing Active Notification
@@ -138,9 +139,7 @@
destroy the notification object through the \c std::unique_ptr::reset() method.
\skipto onClosed
- \dots
- \skipto hide()
- \printuntil reset
+ \printuntil }
\section2 Implementing User Interaction
@@ -152,5 +151,6 @@
\skipto mouseReleaseEvent
\printuntil onClosed
- \printuntil /^\}/
+ \printline /\}$/
+ \printline /\}$/
*/
diff --git a/examples/webenginewidgets/notifications/main.cpp b/examples/webenginewidgets/notifications/main.cpp
index 661b82ff5..c3039b9e0 100644
--- a/examples/webenginewidgets/notifications/main.cpp
+++ b/examples/webenginewidgets/notifications/main.cpp
@@ -56,11 +56,13 @@
#include <QWebEngineProfile>
#include <QWebEngineView>
-class WebEnginePage : public QWebEnginePage {
+class WebEnginePage : public QWebEnginePage
+{
public:
WebEnginePage(QWidget *parent) : QWebEnginePage(parent) { }
- bool acceptNavigationRequest(const QUrl &url, NavigationType, bool) override {
+ bool acceptNavigationRequest(const QUrl &url, NavigationType, bool) override
+ {
if (url.scheme() != "https")
return true;
QDesktopServices::openUrl(url);
@@ -81,16 +83,15 @@ int main(int argc, char *argv[])
QObject::connect(view.page(), &QWebEnginePage::featurePermissionRequested,
[&] (const QUrl &origin, QWebEnginePage::Feature feature) {
- if (feature != QWebEnginePage::Notifications)
- return;
- view.page()->setFeaturePermission(origin, feature, QWebEnginePage::PermissionGrantedByUser);
- });
+ if (feature != QWebEnginePage::Notifications)
+ return;
+ view.page()->setFeaturePermission(origin, feature, QWebEnginePage::PermissionGrantedByUser);
+ });
auto profile = view.page()->profile();
auto popup = new NotificationPopup(&view);
- profile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
- popup->present(notification);
- });
+ profile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification)
+ { popup->present(notification); });
view.resize(640, 480);
view.show();
diff --git a/examples/webenginewidgets/notifications/notificationpopup.h b/examples/webenginewidgets/notifications/notificationpopup.h
index fcbb003b9..d211c7996 100644
--- a/examples/webenginewidgets/notifications/notificationpopup.h
+++ b/examples/webenginewidgets/notifications/notificationpopup.h
@@ -61,14 +61,16 @@
#include <memory>
-class NotificationPopup : public QWidget {
+class NotificationPopup : public QWidget
+{
Q_OBJECT
QLabel m_icon, m_title, m_message;
std::unique_ptr<QWebEngineNotification> notification;
public:
- NotificationPopup(QWidget *parent) : QWidget(parent) {
+ NotificationPopup(QWidget *parent) : QWidget(parent)
+ {
setWindowFlags(Qt::ToolTip);
auto rootLayout = new QHBoxLayout(this);
@@ -91,7 +93,8 @@ public:
adjustSize();
}
- void present(std::unique_ptr<QWebEngineNotification> &newNotification) {
+ void present(std::unique_ptr<QWebEngineNotification> &newNotification)
+ {
if (notification) {
notification->close();
notification.reset();
@@ -114,14 +117,16 @@ public:
}
protected slots:
- void onClosed() {
+ void onClosed()
+ {
hide();
notification->close();
notification.reset();
}
protected:
- void mouseReleaseEvent(QMouseEvent *event) override {
+ void mouseReleaseEvent(QMouseEvent *event) override
+ {
QWidget::mouseReleaseEvent(event);
if (notification && event->button() == Qt::LeftButton) {
notification->click();
diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri
index 998aedc40..493ea9766 100644
--- a/src/buildtools/config/linux.pri
+++ b/src/buildtools/config/linux.pri
@@ -164,9 +164,21 @@ host_build {
gn_args += use_system_libpng=true
qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_libpng=true
}
- qtConfig(webengine-system-jpeg): gn_args += use_system_libjpeg=true
- qtConfig(webengine-system-freetype): gn_args += use_system_freetype=true
- qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true
+ qtConfig(webengine-system-jpeg) {
+ gn_args += use_system_libjpeg=true
+ } else {
+ gn_args += use_system_libjpeg=false
+ }
+ qtConfig(webengine-system-freetype) {
+ gn_args += use_system_freetype=true
+ } else {
+ gn_args += use_system_freetype=false
+ }
+ qtConfig(webengine-system-harfbuzz) {
+ gn_args += use_system_harfbuzz=true
+ } else {
+ gn_args += use_system_harfbuzz=false
+ }
!qtConfig(webengine-system-glib): gn_args += use_glib=false
qtConfig(webengine-pulseaudio) {
gn_args += use_pulseaudio=true
diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp
index f91eabd25..abc63fed2 100644
--- a/src/core/api/qwebenginenotification.cpp
+++ b/src/core/api/qwebenginenotification.cpp
@@ -48,6 +48,22 @@ QT_BEGIN_NAMESPACE
using QtWebEngineCore::UserNotificationController;
/*!
+ \qmltype WebEngineNotification
+ \instantiates QWebEngineNotification
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.9
+ \brief Encapsulates the data of an HTML5 web notification.
+
+ This type contains the information and API for HTML5 desktop and push notifications.
+
+ Web engine notifications are passed to the user in the
+ \l WebEngineProfile::presentNotification() signal.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
+*/
+
+/*!
\class QWebEngineNotification
\brief The QWebEngineNotification class encapsulates the data of an HTML5 web notification.
\since 5.13
@@ -56,10 +72,11 @@ using QtWebEngineCore::UserNotificationController;
This class contains the information and API for HTML5 desktop and push notifications.
- Web engine notifications are passed to the user in the
- \l QWebEngineProfile::setNotificationPresenter() and
- \l QQuickWebEngineProfile::presentNotification() calls and the
- \l WebEngineProfile::presentNotification() signal.
+ Web engine notifications are passed to the user through the custom handler
+ provided with the \l QWebEngineProfile::setNotificationPresenter() call.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
*/
class QWebEngineNotificationPrivate : public UserNotificationController::Client {
@@ -115,6 +132,10 @@ bool QWebEngineNotification::matches(const QWebEngineNotification *other) const
}
/*!
+ \qmlproperty bool WebEngineNotification::title
+ \brief The title of the notification.
+*/
+/*!
\property QWebEngineNotification::title
\brief The title of the notification.
\sa message()
@@ -126,6 +147,10 @@ QString QWebEngineNotification::title() const
}
/*!
+ \qmlproperty string WebEngineNotification::message
+ \brief The body of the notification message.
+*/
+/*!
\property QWebEngineNotification::message
\brief The body of the notification message.
\sa title()
@@ -138,6 +163,13 @@ QString QWebEngineNotification::message() const
}
/*!
+ \qmlproperty string WebEngineNotification::tag
+ \brief The tag of the notification message.
+
+ New notifications that have the same tag and origin URL as an existing
+ one should replace or update the old notification with the same tag.
+*/
+/*!
\property QWebEngineNotification::tag
\brief The tag of the notification message.
@@ -153,6 +185,10 @@ QString QWebEngineNotification::tag() const
}
/*!
+ \qmlproperty url WebEngineNotification::origin
+ \brief The URL of the page sending the notification.
+*/
+/*!
\property QWebEngineNotification::origin
\brief The URL of the page sending the notification.
*/
@@ -175,6 +211,12 @@ QImage QWebEngineNotification::icon() const
}
/*!
+ \qmlproperty string WebEngineNotification::language
+ \brief The primary language for the notification's title and body.
+
+ Its value is a valid BCP 47 language tag, or the empty string.
+*/
+/*!
\property QWebEngineNotification::language
\brief The primary language for the notification's title and body.
@@ -189,6 +231,14 @@ QString QWebEngineNotification::language() const
}
/*!
+ \qmlproperty enumeration WebEngineNotification::direction
+ \brief The text direction for the notification's title and body.
+
+ \value Qt.LeftToRight Items are laid out from left to right.
+ \value Qt.RightToLeft Items are laid out from right to left.
+ \value Qt.LayoutDirectionAuto The direction to lay out items is determined automatically.
+*/
+/*!
\property QWebEngineNotification::direction
\brief The text direction for the notification's title and body.
\sa title(), message()
@@ -200,6 +250,12 @@ Qt::LayoutDirection QWebEngineNotification::direction() const
}
/*!
+ \qmlmethod void WebEngineNotification::show()
+ Creates and dispatches a JavaScript \e {show event} on notification.
+
+ Should be called by the notification platform when the notification has been shown to user.
+*/
+/*!
Creates and dispatches a JavaScript \e {show event} on notification.
Should be called by the notification platform when the notification has been shown to user.
@@ -212,6 +268,12 @@ void QWebEngineNotification::show() const
}
/*!
+ \qmlmethod void WebEngineNotification::click()
+ Creates and dispatches a JavaScript \e {click event} on notification.
+
+ Should be called by the notification platform when the notification is activated by the user.
+*/
+/*!
Creates and dispatches a JavaScript \e {click event} on notification.
Should be called by the notification platform when the notification is activated by the user.
@@ -224,6 +286,13 @@ void QWebEngineNotification::click() const
}
/*!
+ \qmlmethod void WebEngineNotification::close()
+ Creates and dispatches a JavaScript \e {close event} on notification.
+
+ Should be called by the notification platform when the notification is closed,
+ either by the underlying platform or by the user.
+*/
+/*!
Creates and dispatches a JavaScript \e {close event} on notification.
Should be called by the notification platform when the notification is closed,
@@ -237,6 +306,12 @@ void QWebEngineNotification::close() const
}
/*!
+ \qmlsignal WebEngineNotification::closed()
+
+ This signal is emitted when the web page calls close steps for the notification,
+ and it no longer needs to be shown.
+*/
+/*!
\fn void QWebEngineNotification::closed()
This signal is emitted when the web page calls close steps for the notification,
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index 71465a1af..89c2980e3 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -79,14 +79,14 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er
const net::SSLInfo& ssl_info,
const GURL &request_url,
content::ResourceType resource_type,
- bool _overridable,
+ bool fatal_error,
bool strict_enforcement,
const base::Callback<void(content::CertificateRequestResultType)>& cb
)
: certError(CertificateErrorController::CertificateError(cert_error))
, requestUrl(toQt(request_url))
, resourceType(CertificateErrorController::ResourceType(resource_type))
- , overridable(_overridable)
+ , fatalError(fatal_error)
, strictEnforcement(strict_enforcement)
, callback(cb)
{
@@ -119,7 +119,7 @@ QUrl CertificateErrorController::url() const
bool CertificateErrorController::overridable() const
{
- return d->overridable;
+ return !d->fatalError && !d->strictEnforcement;
}
bool CertificateErrorController::strictEnforcement() const
diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h
index f3b0c23fa..d51a559d0 100644
--- a/src/core/certificate_error_controller_p.h
+++ b/src/core/certificate_error_controller_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class CertificateErrorControllerPrivate {
public:
- CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool overridable, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback);
+ CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool fatal_error, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback);
void accept(bool accepted);
@@ -68,7 +68,7 @@ public:
QDateTime validStart;
QDateTime validExpiry;
CertificateErrorController::ResourceType resourceType;
- bool overridable;
+ bool fatalError;
bool strictEnforcement;
const base::Callback<void(content::CertificateRequestResultType)> callback;
QList<QSslCertificate> chain;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index ee420d258..5816749c8 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -393,7 +393,7 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont
ssl_info,
request_url,
resource_type,
- !IsCertErrorFatal(cert_error),
+ IsCertErrorFatal(cert_error),
strict_enforcement,
callback)));
contentsDelegate->allowCertificateError(errorController);
diff --git a/src/core/core_common.pri b/src/core/core_common.pri
index 2a9dc90c0..e10d14267 100644
--- a/src/core/core_common.pri
+++ b/src/core/core_common.pri
@@ -18,6 +18,3 @@ CONFIG -= ltcg
# Chromium requires C++14
CONFIG += c++14
-#QTBUG-73216 ci has to be updated with latest yocto
-boot2qt: CONFIG -= use_gold_linker
-
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp
index 3e64afd20..63b93c502 100644
--- a/src/core/file_picker_controller.cpp
+++ b/src/core/file_picker_controller.cpp
@@ -39,6 +39,9 @@
#include "file_picker_controller.h"
#include "type_conversion.h"
+#if defined(OS_WIN)
+#include "base/files/file_path.h"
+#endif
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/file_select_listener.h"
@@ -64,12 +67,31 @@ FilePickerController::~FilePickerController() = default;
void FilePickerController::accepted(const QStringList &files)
{
QStringList stringList;
-
- for (const QString &file : files) {
- if (QDir(file).isAbsolute())
- stringList.append(file);
- else
- qWarning("Ignore invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(file));
+ stringList.reserve(files.count());
+
+ for (const QString &urlString : files) {
+ // We accept strings on both absolute-path and file-URL form:
+ if (QDir::isAbsolutePath(urlString)) {
+ QString absolutePath = QDir::fromNativeSeparators(urlString);
+#if defined(OS_WIN)
+ if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1()))
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ else
+#endif
+ stringList.append(absolutePath);
+ } else {
+ QUrl url(urlString, QUrl::StrictMode);
+ if (url.isLocalFile() && QDir::isAbsolutePath(url.toLocalFile())) {
+ QString absolutePath = url.toLocalFile();
+#if defined(OS_WIN)
+ if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1()))
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ else
+#endif
+ stringList.append(absolutePath);
+ } else
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ }
}
FilePickerController::filesSelectedInChooser(stringList);
@@ -77,21 +99,10 @@ void FilePickerController::accepted(const QStringList &files)
void FilePickerController::accepted(const QVariant &files)
{
- QStringList stringList;
- QList<QUrl> urlList = QUrl::fromStringList(files.toStringList());
-
- if (urlList.isEmpty()) {
- FilePickerController::accepted(stringList);
- } else {
- for (const QUrl &url : qAsConst(urlList)) {
- if (url.isValid() && url.scheme() == "file" && !url.path().isEmpty())
- stringList.append(url.path());
- else
- qWarning("Ignore invalid item in FilePickerController::accepted(QVariant): %s", qPrintable(url.toString()));
- }
+ if (!files.canConvert(QVariant::StringList))
+ qWarning("An unhandled type '%s' was provided in FilePickerController::accepted(QVariant)", files.typeName());
- FilePickerController::accepted(stringList);
- }
+ accepted(files.toStringList());
}
void FilePickerController::rejected()
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 38fe56f7d..5c87d87a2 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -239,9 +239,11 @@ extensions::ExtensionSystemQt* ProfileIODataQt::GetExtensionSystem()
void ProfileIODataQt::initializeOnIOThread()
{
m_networkDelegate.reset(new NetworkDelegateQt(this));
+ m_hostResolver = net::HostResolver::CreateStandaloneResolver(nullptr);
m_urlRequestContext.reset(new net::URLRequestContext());
m_urlRequestContext->set_network_delegate(m_networkDelegate.get());
m_urlRequestContext->set_enable_brotli(base::FeatureList::IsEnabled(features::kBrotliEncoding));
+ m_urlRequestContext->set_host_resolver(m_hostResolver.get());
// this binds factory to io thread
m_weakPtr = m_weakPtrFactory.GetWeakPtr();
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
@@ -338,11 +340,6 @@ void ProfileIODataQt::generateStorage()
ct_verifier->AddLogs(ct_logs);
m_storage->set_cert_transparency_verifier(std::move(ct_verifier));
m_storage->set_ct_policy_enforcer(base::WrapUnique(new net::DefaultCTPolicyEnforcer()));
-// static std::unique_ptr<net::HostResolverManager> s_hostResolverManager =
-// std::make_unique<net::HostResolverManager>(net::HostResolver::Options(), nullptr);
-// m_storage->set_host_resolver(net::HostResolver::CreateResolver(s_hostResolverManager.get()));
- m_storage->set_host_resolver(net::HostResolver::CreateStandaloneResolver(nullptr));
-
m_storage->set_ssl_config_service(std::make_unique<net::SSLConfigServiceDefaults>());
if (!m_httpAuthPreferences) {
m_httpAuthPreferences.reset(new net::HttpAuthPreferences());
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index 4a5b9f77d..00a4de2b0 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -56,6 +56,7 @@ class ClientCertStore;
class DhcpPacFileFetcherFactory;
class HttpAuthPreferences;
class HttpNetworkSession;
+class HostResolver;
class NetworkDelegate;
class ProxyConfigService;
class URLRequestContext;
@@ -157,6 +158,7 @@ private:
std::unique_ptr<net::HttpAuthPreferences> m_httpAuthPreferences;
std::unique_ptr<net::URLRequestJobFactory> m_jobFactory;
std::unique_ptr<net::TransportSecurityPersister> m_transportSecurityPersister;
+ std::unique_ptr<net::HostResolver> m_hostResolver;
base::WeakPtr<ProfileIODataQt> m_weakPtr;
scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate;
content::URLRequestInterceptorScopedVector m_requestInterceptors;
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index e741962fb..c98612192 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -770,8 +770,11 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
}
ui::TextInputType type = getTextInputType();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
-
+#else
+ m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
m_surroundingText = toQt(state->value);
// Remove IME composition text from the surrounding text
if (state->composition_start != -1 && state->composition_end != -1)
@@ -1200,7 +1203,11 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query)
// TODO: Implement this
return QVariant(); // No limit.
case Qt::ImHints:
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
+#else
+ return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
default:
return QVariant();
}
diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp
index da3c78b8a..0f44210d1 100644
--- a/src/core/touch_selection_controller_client_qt.cpp
+++ b/src/core/touch_selection_controller_client_qt.cpp
@@ -315,7 +315,7 @@ void TouchSelectionControllerClientQt::showMenu()
WebContentsAdapterClient *adapterClient = m_rwhv->adapterClient();
Q_ASSERT(adapterClient);
- adapterClient->showTouchSelectionMenu(m_menuController.get(),
+ adapterClient->showTouchSelectionMenu(m_menuController.data(),
QRect(toQt(gfx::ToEnclosingRect(anchor_rect))),
QSize(toQt(gfx::ToRoundedSize(max_handle_size))));
m_menuShowing = true;
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 7f5306e67..3598c1c78 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -926,7 +926,7 @@ static ui::DomKey domKeyForQtKey(int qtKey)
return ui::DomKey::ZENKAKU;
case Qt::Key_Zenkaku_Hankaku:
return ui::DomKey::ZENKAKU_HANKAKU;
-
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
// Dead keys (ui/events/keycodes/keyboard_code_conversion_xkb.cc)
case Qt::Key_Dead_Grave:
return ui::DomKey::DeadKeyFromCombiningCharacter(0x0300);
@@ -994,7 +994,7 @@ static ui::DomKey domKeyForQtKey(int qtKey)
return ui::DomKey::DeadKeyFromCombiningCharacter(0x00A4);
case Qt::Key_Dead_Greek:
return ui::DomKey::DeadKeyFromCombiningCharacter(0x037E);
-
+#endif
// General-Purpose Function Keys
case Qt::Key_F1:
return ui::DomKey::F1;
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 57434e296..edad7ec44 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -157,7 +157,10 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC
\fn QQuickWebEngineProfile::presentNotification(QWebEngineNotification *notification)
This signal is emitted whenever there is a newly created user notification.
- The \a notification argument holds the notification instance to query data and interact with.
+ The \a notification argument holds the \l {QWebEngineNotification} instance
+ to query data and interact with.
+
+ \sa WebEngineProfile::presentNotification
*/
QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter)
@@ -395,7 +398,8 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb
\since QtWebEngine 1.9
This signal is emitted whenever there is a newly created user notification.
- The \a notification argument holds the notification instance to query data and interact with.
+ The \a notification argument holds the \l {WebEngineNotification} instance
+ to query data and interact with.
*/
/*!
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index 93a3668ed..9a102a504 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -250,7 +250,7 @@ bool QQuickWebEngineSettings::pluginsEnabled() const
Tells the web engine whether fullscreen is supported in this application or not.
- Enabled by default.
+ Disabled by default.
*/
bool QQuickWebEngineSettings::fullScreenSupportEnabled() const
{
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 58d950cd9..8a1a3c516 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -297,7 +297,7 @@ void QQuickWebEngineViewPrivate::allowCertificateError(const QSharedPointer<Cert
// mark the object for gc by creating temporary jsvalue
qmlEngine(q)->newQObject(quickController);
Q_EMIT q->certificateError(quickController);
- if (!quickController->deferred() && !quickController->answered())
+ if (!quickController->overridable() || (!quickController->deferred() && !quickController->answered()))
quickController->rejectCertificate();
else
m_certificateErrorControllers.append(errorController);
@@ -1152,9 +1152,7 @@ void QQuickWebEngineViewPrivate::updateAdapter()
adapter->setClient(this);
if (wasInitialized) {
if (!m_html.isEmpty())
- adapter->setContent(m_html.toUtf8(), defaultMimeType, m_url);
- else if (m_url.isValid())
- adapter->load(m_url);
+ adapter->setContent(m_html.toUtf8(), defaultMimeType, activeUrl);
else if (activeUrl.isValid())
adapter->load(activeUrl);
else
diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc
index 08c189740..00b9cb496 100644
--- a/src/webengine/doc/src/qtwebengine-features.qdoc
+++ b/src/webengine/doc/src/qtwebengine-features.qdoc
@@ -126,7 +126,9 @@
so uniquely identifies the user and might violate privacy expectations.
To activate support for client certificates, an application needs to listen to
- the QWebEnginePage::selectClientCertificate signal and select one of the offered
+ the QWebEnginePage::selectClientCertificate or
+ \l{WebEnginePage::selectClientCertificate}{WebEnginePage.selectClientCertificate}
+ signals and select one of the offered
certificates. For applications that can navigate to untrusted web sites, it is
recommended to always give the user a choice before uniquely identifying them
to a remote server.
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
index 5b7d750ff..5d32fa6c7 100644
--- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -73,6 +73,8 @@
\list
\li Visual Studio 2017 version 15.8 or later
+ \li Active Template Library (ATL), usually included in the Visual Studio
+ installation
\li Windows 10 SDK
\endlist
diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc
index 8f03774c8..9abc8f37b 100644
--- a/src/webengine/doc/src/webengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview_lgpl.qdoc
@@ -396,7 +396,7 @@
runJavaScript("document.title", function(result) { console.log(result); });
\endcode
- Only "plain data" can be returned from JavaScript as the result value.
+ Only plain data can be returned from JavaScript as the result value.
Supported data types include all of the JSON data types as well as, for
example, \c{Date} and \c{ArrayBuffer}. Unsupported data types include, for
example, \c{Function} and \c{Promise}.
@@ -407,7 +407,8 @@
\warning Do not execute lengthy routines in the callback function, because it might block the
rendering of the web content.
- See WebEngineView::userScripts for an alternative API to inject scripts.
+ For more information about injecting scripts, see \l {Script Injection}.
+ For an alternative way to inject scripts, see WebEngineView::userScripts.
*/
/*!
@@ -444,14 +445,13 @@
To clear the search highlight, just pass an empty string.
- The \a resultCallback must take a boolean parameter. It will be called with
- a value of true if the \a subString was found; otherwise the callback value
- will be false.
+ The \a resultCallback must take an integer parameter. It will be called with
+ the number of found occurrences of the \a subString.
\code
- findText("Qt", WebEngineView.FindCaseSensitively, function(success) {
- if (success)
- console.log("Qt was found!");
+ findText("Qt", WebEngineView.FindCaseSensitively, function(matchCount) {
+ if (matchCount > 0)
+ console.log("'Qt' tokens found:", matchCount);
});
\endcode
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index e47a46a95..5fb48d867 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -164,10 +164,12 @@ public:
qmlRegisterUncreatableType<QWebEngineRegisterProtocolHandlerRequest>(uri, 1, 7, "RegisterProtocolHandlerRequest",
msgUncreatableType("RegisterProtocolHandlerRequest"));
qmlRegisterUncreatableType<QQuickWebEngineAction>(uri, 1, 8, "WebEngineAction", msgUncreatableType("WebEngineAction"));
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
qmlRegisterUncreatableType<QQuickWebEngineClientCertificateSelection>(uri, 1, 9, "WebEngineClientCertificateSelection",
msgUncreatableType("WebEngineClientCertificateSelection"));
qmlRegisterUncreatableType<QQuickWebEngineClientCertificateOption>(uri, 1, 9, "WebEngineClientCertificateOption",
msgUncreatableType("WebEngineClientCertificateOption"));
+#endif
qmlRegisterUncreatableType<QWebEngineNotification>(uri, 1, 9, "WebEngineNotification", msgUncreatableType("WebEngineNotification"));
qmlRegisterUncreatableType<QQuickWebEngineTooltipRequest>(uri, 1, 10, "TooltipRequest",
msgUncreatableType("TooltipRequest"));
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 3a103b9aa..ac32671aa 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -106,7 +106,11 @@ QRectF RenderWidgetHostViewQtDelegateQuick::viewGeometry() const
const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height())));
QRectF geometry = QRectF(p1, p2).normalized();
// But keep the size untransformed to behave like other QQuickItems.
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
geometry.setSize(size());
+#else
+ geometry.setSize(QSizeF(width(), height()));
+#endif
return geometry;
}
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
index 23b9e02c2..d3ebdbf27 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp
@@ -48,7 +48,7 @@ RenderWidgetHostViewQtDelegateQuickWindow::RenderWidgetHostViewQtDelegateQuickWi
: m_realDelegate(realDelegate)
, m_virtualParent(nullptr)
{
- setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
+ setFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
}
RenderWidgetHostViewQtDelegateQuickWindow::~RenderWidgetHostViewQtDelegateQuickWindow()
diff --git a/src/webengine/ui/ToolTip.qml b/src/webengine/ui/ToolTip.qml
index 96033e8f1..2bfe9eaf5 100644
--- a/src/webengine/ui/ToolTip.qml
+++ b/src/webengine/ui/ToolTip.qml
@@ -47,8 +47,9 @@ Item {
visible: false
property alias text: toolTip.text
- property int delayTimerInterval: 1000
- property int hideTimerInterval: 1500
+ property int delayTimerInterval: 500
+ property int hideTimerInterval: 10000
+ property int toolTipMaxWidth: 400
Timer {
id: delayTimer
@@ -77,7 +78,8 @@ Item {
Text {
id: toolTip
anchors {fill: parent; margins: 5}
- wrapMode: Text.WrapAnywhere
+ wrapMode: Text.Wrap
+ width: Math.min(toolTipMaxWidth, (toolTip.text.length +1) * 8)
}
}
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b22d47916..e4f4c4bc8 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -178,7 +178,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
wasShownTimer.setSingleShot(true);
QObject::connect(&wasShownTimer, &QTimer::timeout, [this](){
ensureInitialized();
- adapter->setVisible(true);
});
profile->d_ptr->addWebContentsAdapterClient(this);
@@ -442,7 +441,7 @@ void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer<QByte
printerThread->start();
PrinterWorker *printerWorker = new PrinterWorker(result, currentPrinter);
- QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [=](bool success) {
+ QObject::connect(printerWorker, &PrinterWorker::resultReady, q, [requestId, this](bool success) {
currentPrinter = nullptr;
m_callbacks.invoke(requestId, success);
});
@@ -1720,8 +1719,8 @@ void QWebEnginePagePrivate::allowCertificateError(const QSharedPointer<Certifica
accepted = q->certificateError(error);
if (error.deferred() && !error.answered())
m_certificateErrorControllers.append(controller);
- else if (!error.answered() && error.isOverridable())
- controller->accept(accepted);
+ else if (!error.answered())
+ controller->accept(error.isOverridable() && accepted);
}
void QWebEnginePagePrivate::selectClientCert(const QSharedPointer<ClientCertSelectController> &controller)
@@ -1817,7 +1816,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
}
// Update tooltip if text was changed.
- QString wrappedTip = QLatin1String("<p style=\"white-space:pre\">")
+ QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">")
% toolTipText.toHtmlEscaped().left(MaxTooltipLength)
% QLatin1String("</p>");
if (view->toolTip() != wrappedTip)
@@ -2178,7 +2177,7 @@ void QWebEnginePage::runJavaScript(const QString& scriptSource, quint32 worldId,
In addition, a page might also execute scripts
added through QWebEngineProfile::scripts().
- \sa QWebEngineScriptCollection, QWebEngineScript
+ \sa QWebEngineScriptCollection, QWebEngineScript, {Script Injection}
*/
QWebEngineScriptCollection &QWebEnginePage::scripts()
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 4a77eb8cf..09f5ce2fd 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -661,7 +661,8 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const
Returns the collection of scripts that are injected into all pages that share
this profile.
- \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts()
+ \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts(),
+ {Script Injection}
*/
QWebEngineScriptCollection *QWebEngineProfile::scripts() const
{
diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp
index d1e996b3a..af6b9aa8d 100644
--- a/src/webenginewidgets/api/qwebenginescript.cpp
+++ b/src/webenginewidgets/api/qwebenginescript.cpp
@@ -67,6 +67,8 @@ using QtWebEngineCore::UserScript;
Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
the collection of scripts associated with a single page or a
number of pages sharing the same profile.
+
+ \sa {Script Injection}
*/
/*!
\enum QWebEngineScript::InjectionPoint
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
index 5ef0ffd44..8cbeeb804 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
@@ -55,6 +55,8 @@ using QtWebEngineCore::UserScript;
Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access
the collection of scripts associated with a single page or a
number of pages sharing the same profile.
+
+ \sa {Script Injection}
*/
/*!
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index ac979e766..de81448a9 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -61,6 +61,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage
Q_Q(QWebEngineView);
if (oldPage) {
+ oldPage->setVisible(false);
oldPage->disconnect(q);
}
@@ -74,6 +75,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage
QObject::connect(newPage, &QWebEnginePage::loadFinished, q, &QWebEngineView::loadFinished);
QObject::connect(newPage, &QWebEnginePage::selectionChanged, q, &QWebEngineView::selectionChanged);
QObject::connect(newPage, &QWebEnginePage::renderProcessTerminated, q, &QWebEngineView::renderProcessTerminated);
+ newPage->setVisible(q->isVisible());
}
auto oldUrl = oldPage ? oldPage->url() : QUrl();
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 699d7f181..7701b9b3d 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -767,10 +767,15 @@
\fn void QWebEnginePage::runJavaScript(const QString &scriptSource, const QWebEngineCallback<const QVariant &> &resultCallback)
\since 5.7
- Runs the JavaScript code contained in \a scriptSource in the world specified by \a worldId.
- The world ID values are the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0
- and \c 256. Using the \e runJavaScript() versions without the world ID is the same as running the
- script in the \c MainWorld.
+ Runs the JavaScript code contained in \a scriptSource without checking
+ whether the DOM of the page has been constructed. If you need more
+ control over how the script is run, consider using \l scripts() instead.
+
+ To avoid conflicts with other scripts executed on the page, the world in
+ which the script is run is specified by \a worldId. The world ID values are
+ the same as provided by QWebEngineScript::ScriptWorldId, and between \c 0
+ and \c 256. If you leave out the \c world ID, the script is run in the
+ \c MainWorld.
When the script has been executed, \a resultCallback is called with the result of the last
executed statement. \c resultCallback can be any of a function pointer, a functor or a lambda,
@@ -780,7 +785,7 @@
page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); });
\endcode
- Only "plain data" can be returned from JavaScript as the result value.
+ Only plain data can be returned from JavaScript as the result value.
Supported data types include all of the JSON data types as well as, for
example, \c{Date} and \c{ArrayBuffer}. Unsupported data types include, for
example, \c{Function} and \c{Promise}.
@@ -792,9 +797,7 @@
during page destruction. When QWebEnginePage is deleted, the callback is triggered with an invalid
value and it is not safe to use the corresponding QWebEnginePage or QWebEngineView instance inside it.
- See scripts() for an alternative API to inject scripts.
-
- \sa QWebEngineScript::ScriptWorldId
+ \sa scripts(), QWebEngineScript::ScriptWorldId, {Script Injection}
*/
/*!
diff --git a/tests/auto/quick/qmltests/data/tst_filePicker.qml b/tests/auto/quick/qmltests/data/tst_filePicker.qml
index 2f813b966..fad81273c 100644
--- a/tests/auto/quick/qmltests/data/tst_filePicker.qml
+++ b/tests/auto/quick/qmltests/data/tst_filePicker.qml
@@ -36,6 +36,12 @@ TestWebEngineView {
width: 400
height: 300
+ function driveLetter() {
+ if (Qt.platform.os !== "windows")
+ return "";
+ return "C:/";
+ }
+
SignalSpy {
id: titleSpy
target: webEngineView
@@ -72,27 +78,25 @@ TestWebEngineView {
function test_acceptSingleFileSelection_data() {
return [
- { tag: "/test.txt)", input: "/test.txt", passDefaultDialog: false, passCustomDialog: true },
- { tag: "/tést.txt", input: "/tést.txt", passDefaultDialog: false, passCustomDialog: true },
- { tag: "file:///test.txt", input: "file:///test.txt", passDefaultDialog: true, passCustomDialog: false },
- { tag: "file:///tést.txt", input: "file:///tést.txt", passDefaultDialog: true, passCustomDialog: false },
- { tag: "file:///t%C3%A9st.txt", input: "file:///t%C3%A9st.txt", passDefaultDialog: true, passCustomDialog: false },
- { tag: "file://test.txt", input: "file://test.txt", passDefaultDialog: false, passCustomDialog: false },
- { tag: "file:/test.txt", input: "file:/test.txt", passDefaultDialog: true, passCustomDialog: false },
- { tag: "file:test//test.txt", input: "file:test//test.txt", passDefaultDialog: false, passCustomDialog: false },
- { tag: "http://test.txt", input: "http://test.txt", passDefaultDialog: false, passCustomDialog: false },
- { tag: "qrc:/test.txt", input: "qrc:/test.txt", passDefaultDialog: false, passCustomDialog: false },
+ { tag: driveLetter() + "/test.txt", input: driveLetter() + "/test.txt", expected: "test.txt" },
+ { tag: driveLetter() + "test.txt", input: driveLetter() + "test.txt", expected: "Failed to Upload" },
+ { tag: driveLetter() + "/tést.txt", input: driveLetter() + "/tést.txt", expected: "tést.txt" },
+ { tag: driveLetter() + "/t%65st.txt", input: driveLetter() + "/t%65st.txt", expected: "t%65st.txt" },
+ { tag: "file:///" + driveLetter() + "test.txt", input: "file:///" + driveLetter() + "test.txt", expected: "test.txt" },
+ { tag: "file:///" + driveLetter() + "tést.txt", input: "file:///" + driveLetter() + "tést.txt", expected: "tést.txt" },
+ { tag: "file:///" + driveLetter() + "t%65st.txt", input: "file:///" + driveLetter() + "t%65st.txt", expected: "test.txt" },
+ { tag: "file://" + driveLetter() + "test.txt", input: "file://" + driveLetter() + "test.txt", expected: "test.txt" },
+ { tag: "file:/" + driveLetter() + "test.txt", input: "file:/" + driveLetter() + "test.txt", expected: "test.txt"},
+ { tag: "file:test//test.txt", input: "file:test//test.txt", expected: "Failed to Upload" },
+ { tag: "http://test.txt", input: "http://test.txt", expected: "Failed to Upload" },
+ { tag: "qrc:/test.txt", input: "qrc:/test.txt", expected: "Failed to Upload" },
];
}
function test_acceptSingleFileSelection(row) {
var expectedFileName;
- // Default dialog (expects URL).
- expectedFileName = "Failed to Upload";
- if (row.passDefaultDialog)
- expectedFileName = row.input.slice(row.input.lastIndexOf('/') + 1);
-
+ // Default dialog
webEngineView.url = Qt.resolvedUrl("singlefileupload.html");
verify(webEngineView.waitForLoadSucceeded());
@@ -101,16 +105,12 @@ TestWebEngineView {
keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
tryCompare(FilePickerParams, "filePickerOpened", true);
- tryCompare(webEngineView, "title", decodeURIComponent(expectedFileName));
+ tryCompare(webEngineView, "title", row.expected);
- // Custom dialog (expects absolute path).
+ // Custom dialog
var finished = false;
- expectedFileName = "Failed to Upload";
- if (row.passCustomDialog)
- expectedFileName = row.input.slice(row.input.lastIndexOf('/') + 1);
-
function acceptedFileHandler(request) {
request.accepted = true;
request.dialogAccept(row.input);
@@ -123,7 +123,7 @@ TestWebEngineView {
keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
tryVerify(function() { return finished; });
- tryCompare(webEngineView, "title", expectedFileName);
+ tryCompare(webEngineView, "title", row.expected);
webEngineView.fileDialogRequested.disconnect(acceptedFileHandler);
}
@@ -165,14 +165,14 @@ TestWebEngineView {
function test_acceptMultipleFilesWithCustomDialog_data() {
return [
- { tag: "path", input: ["/test1.txt", "/test2.txt"], expectedValueForDefaultDialog: "Failed to Upload", expectedValueForCustomDialog: "test1.txt,test2.txt" },
- { tag: "file", input: ["file:///test1.txt", "file:///test2.txt"], expectedValueForDefaultDialog: "test1.txt,test2.txt", expectedValueForCustomDialog: "Failed to Upload" },
- { tag: "mixed", input: ["file:///test1.txt", "/test2.txt"], expectedValueForDefaultDialog: "test1.txt", expectedValueForCustomDialog: "test2.txt" },
+ { tag: "path", input: [driveLetter() + "/test1.txt", driveLetter() + "/test2.txt"], expectedValue: "test1.txt,test2.txt" },
+ { tag: "file", input: ["file:///" + driveLetter() + "test1.txt", "file:/" + driveLetter() + "test2.txt"], expectedValue: "test1.txt,test2.txt" },
+ { tag: "mixed", input: ["file:///" + driveLetter() + "test1.txt", driveLetter() + "/test2.txt"], expectedValue: "test1.txt,test2.txt" },
];
}
function test_acceptMultipleFilesWithCustomDialog(row) {
- // Default dialog (expects URL).
+ // Default dialog
webEngineView.url = Qt.resolvedUrl("multifileupload.html");
verify(webEngineView.waitForLoadSucceeded());
@@ -181,10 +181,10 @@ TestWebEngineView {
keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
tryCompare(FilePickerParams, "filePickerOpened", true);
- tryCompare(webEngineView, "title", row.expectedValueForDefaultDialog);
+ tryCompare(webEngineView, "title", row.expectedValue);
- // Custom dialog (expects absolute path).
+ // Custom dialog
var finished = false;
function acceptedFileHandler(request) {
@@ -199,7 +199,65 @@ TestWebEngineView {
keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
tryVerify(function() { return finished; });
- tryCompare(webEngineView, "title", row.expectedValueForCustomDialog);
+ tryCompare(webEngineView, "title", row.expectedValue);
+ webEngineView.fileDialogRequested.disconnect(acceptedFileHandler);
+ }
+
+ function test_acceptFileOnWindows_data() {
+ return [
+ { tag: "C:test.txt", input: "C:test.txt", expected: "Failed to Upload"},
+ { tag: "C:test:txt", input: "C:test:txt", expected: "Failed to Upload"},
+ { tag: "C:/test.txt", input: "C:/test.txt", expected: "test.txt"},
+ { tag: "C:\\test.txt", input: "C:\\test.txt", expected: "test.txt"},
+ { tag: "C:\\Documents and Settings\\test\\test.txt", input: "C:\\Documents and Settings\\test\\test.txt", expected: "test.txt"},
+ { tag: "\\\\applib\\products\\a%2Db\\ abc%5F9\\t.est\\test.txt", input: "file://applib/products/a%2Db/ abc%5F9/4148.920a/media/test.txt", expected: "test.txt"},
+ { tag: "file://applib/products/a%2Db/ abc%5F9/t.est/test.txt", input: "file://applib/products/a%2Db/ abc%5F9/4148.920a/media/test.txt", expected: "test.txt"},
+ { tag: "file://applib/products/a-b/abc_1/t.est/test.txt", input: "file://applib/products/a-b/abc_1/t.est/test.txt", expected: "test.txt"},
+ { tag: "file:\\\\applib\\products\\a-b\\abc_1\\t:est\\test.txt", input: "file:\\\\applib\\products\\a-b\\abc_1\\t:est\\test.txt", expected: "test.txt"},
+ { tag: "file:C:/test.txt", input: "file:C:/test.txt", expected: "Failed to Upload"},
+ { tag: "file:/C:/test.txt", input: "file:/C:/test.txt", expected: "Failed to Upload"},
+ { tag: "file://C:/test.txt", input: "file://C:/test.txt", expected: "Failed to Upload"},
+ { tag: "file:///C:test.txt", input: "file:///C:test.txt", expected: "Failed to Upload"},
+ { tag: "file:///C:/test.txt", input: "file:///C:/test.txt", expected: "test.txt"},
+ { tag: "file:///C:\\test.txt", input: "file:///C:\\test.txt", expected: "test.txt"},
+ { tag: "file:\\//C:/test.txt", input: "file:\\//C:/test.txt", expected: "test.txt"},
+ { tag: "file:\\\\/C:\\test.txt", input: "file:\\\\/C:\\test.txt", expected: "test.txt"},
+ { tag: "\\\\?\\C:/test.txt", input: "\\\\?\\C:/test.txt", expected: "Failed to Upload"},
+ ];
+ }
+
+ function test_acceptFileOnWindows(row) {
+ if (Qt.platform.os !== "windows")
+ skip("Windows-only test");
+
+ // Default dialog
+ webEngineView.url = Qt.resolvedUrl("singlefileupload.html");
+ verify(webEngineView.waitForLoadSucceeded());
+
+ FilePickerParams.selectFiles = true;
+ FilePickerParams.selectedFilesUrl.push(row.input);
+
+ keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
+ tryCompare(FilePickerParams, "filePickerOpened", true);
+ tryCompare(webEngineView, "title", row.expected);
+
+
+ // Custom dialog
+ var finished = false;
+
+ function acceptedFileHandler(request) {
+ request.accepted = true;
+ request.dialogAccept(row.input);
+ finished = true;
+ }
+
+ webEngineView.fileDialogRequested.connect(acceptedFileHandler);
+ webEngineView.url = Qt.resolvedUrl("singlefileupload.html");
+ verify(webEngineView.waitForLoadSucceeded());
+
+ keyClick(Qt.Key_Enter); // Focus is on the button. Open FileDialog.
+ tryVerify(function() { return finished; });
+ tryCompare(webEngineView, "title", row.expected);
webEngineView.fileDialogRequested.disconnect(acceptedFileHandler);
}
}
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 74c04635f..5572515a1 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -91,6 +91,7 @@ private Q_SLOTS:
void userScripts();
void javascriptClipboard_data();
void javascriptClipboard();
+ void setProfile();
private:
inline QQuickWebEngineView *newWebEngineView();
@@ -1148,5 +1149,18 @@ void tst_QQuickWebEngineView::javascriptClipboard()
QTRY_COMPARE(evaluateJavaScriptSync(view, "accessPrompt").toBool(), false);
}
+void tst_QQuickWebEngineView::setProfile() {
+ QSignalSpy loadSpy(webEngineView(), SIGNAL(loadingChanged(QQuickWebEngineLoadRequest*)));
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page.html"));
+ QVERIFY(waitForLoadSucceeded(webEngineView()));
+ QCOMPARE(loadSpy.size(), 2);
+ webEngineView()->setUrl(urlFromTestPath("html/basic_page2.html"));
+ QVERIFY(waitForLoadSucceeded(webEngineView()));
+ QCOMPARE(loadSpy.size(), 4);
+ QQuickWebEngineProfile *profile = new QQuickWebEngineProfile();
+ webEngineView()->setProfile(profile);
+ QTRY_COMPARE(webEngineView()->url() ,urlFromTestPath("html/basic_page2.html"));
+}
+
QTEST_MAIN(tst_QQuickWebEngineView)
#include "tst_qquickwebengineview.moc"
diff --git a/tests/auto/widgets/proxypac/tst_proxypac.cpp b/tests/auto/widgets/proxypac/tst_proxypac.cpp
index f9340341b..934e23fde 100644
--- a/tests/auto/widgets/proxypac/tst_proxypac.cpp
+++ b/tests/auto/widgets/proxypac/tst_proxypac.cpp
@@ -46,6 +46,10 @@ private slots:
void tst_ProxyPac::proxypac()
{
+ const QString fromEnv = QString::fromLocal8Bit(qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"));
+ if (!fromEnv.contains("--proxy-pac-url"))
+ qFatal("--proxy-pac-url argument is not passed.");
+
ProxyServer proxyServer1;
proxyServer1.setPort(5551);
proxyServer1.run();
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
index e6fad8b20..7857ee818 100644
--- a/tests/auto/widgets/qwebenginepage/BLACKLIST
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -4,9 +4,5 @@ osx
[mouseMovementProperties]
windows
-[runJavaScriptFromSlot]
-osx
-linux
-
[fullScreenRequested]
windows
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index dbb15ba10..5edd778e2 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -1824,24 +1824,22 @@ void tst_QWebEnginePage::runJavaScriptFromSlot()
{
QWebEngineProfile profile;
QWebEnginePage page(&profile);
- page.settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true);
QSignalSpy loadFinishedSpy(&page, &QWebEnginePage::loadFinished);
page.setHtml("<html><body>"
" <input type='text' id='input1' value='QtWebEngine' size='50' />"
"</body></html>");
QTRY_COMPARE(loadFinishedSpy.count(), 1);
- // Workaround for QTBUG-74718
- QTRY_VERIFY(page.action(QWebEnginePage::SelectAll)->isEnabled());
- QVariant result(-1);
+ bool done = false;
connect(&page, &QWebEnginePage::selectionChanged, [&]() {
- result = evaluateJavaScriptSync(&page, QStringLiteral("2+2"));
+ QTRY_COMPARE(evaluateJavaScriptSync(&page, QStringLiteral("2+2")), QVariant(4));
+ done = true;
});
evaluateJavaScriptSync(&page, QStringLiteral("const input = document.getElementById('input1');"
"input.focus();"
"input.select();"));
- QTRY_COMPARE(result, QVariant(4));
+ QTRY_VERIFY(done);
}
void tst_QWebEnginePage::fullScreenRequested()
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 827ac2757..71c4aa9b5 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -192,6 +192,8 @@ private Q_SLOTS:
void webUIURLs_data();
void webUIURLs();
void visibilityState();
+ void visibilityState2();
+ void visibilityState3();
void jsKeyboardEvent();
void deletePage();
void closeOpenerTab();
@@ -3140,6 +3142,38 @@ void tst_QWebEngineView::visibilityState()
QCOMPARE(evaluateJavaScriptSync(view.page(), "document.visibilityState").toString(), QStringLiteral("visible"));
}
+void tst_QWebEngineView::visibilityState2()
+{
+ QWebEngineView view;
+ QSignalSpy spy(&view, &QWebEngineView::loadFinished);
+ view.show();
+ view.load(QStringLiteral("about:blank"));
+ view.hide();
+ QVERIFY(spy.count() || spy.wait());
+ QVERIFY(spy.takeFirst().takeFirst().toBool());
+ QCOMPARE(evaluateJavaScriptSync(view.page(), "document.visibilityState").toString(), QStringLiteral("hidden"));
+}
+
+void tst_QWebEngineView::visibilityState3()
+{
+ QWebEnginePage page1;
+ QWebEnginePage page2;
+ QSignalSpy spy1(&page1, &QWebEnginePage::loadFinished);
+ QSignalSpy spy2(&page2, &QWebEnginePage::loadFinished);
+ page1.load(QStringLiteral("about:blank"));
+ page2.load(QStringLiteral("about:blank"));
+ QVERIFY(spy1.count() || spy1.wait());
+ QVERIFY(spy2.count() || spy2.wait());
+ QWebEngineView view;
+ view.setPage(&page1);
+ view.show();
+ QCOMPARE(evaluateJavaScriptSync(&page1, "document.visibilityState").toString(), QStringLiteral("visible"));
+ QCOMPARE(evaluateJavaScriptSync(&page2, "document.visibilityState").toString(), QStringLiteral("hidden"));
+ view.setPage(&page2);
+ QCOMPARE(evaluateJavaScriptSync(&page1, "document.visibilityState").toString(), QStringLiteral("hidden"));
+ QCOMPARE(evaluateJavaScriptSync(&page2, "document.visibilityState").toString(), QStringLiteral("visible"));
+}
+
void tst_QWebEngineView::jsKeyboardEvent()
{
QWebEngineView view;