From 3db2cf8b8e3cf98ed03ab7220e4006946b741973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 24 Sep 2019 13:26:39 +0200 Subject: Update Chromium This pulls in the following changes: ae7a5db571b [Backport] Fix security issue 957160 3e1ca50e045 [Backport] Fix CVE-2019-5869 3ab252e808d Restore webrtc H.264 support with MSVC b84e8682b31 Fix building with pulseaudio 13 56c9ec96237 Add workaround for MSVC bug in libvpx AVX2 code Change-Id: I57a3d62e5ba0ae1ab261daf0b7990a5a332cf59c Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 0240cfc1a..56c9ec962 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 0240cfc1a59deb5b612923d47ccef72f10504fe1 +Subproject commit 56c9ec96237de4c7787c643c7ac7ac4e00c9a1d1 -- cgit v1.2.3 From e31acc86e991d6f83bd56eebb7371914fc9ca5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 24 Sep 2019 17:46:19 +0200 Subject: Fix XMLHttpRequest status with custom schemes Emulate a HTTP 200 OK response when QWebEngineUrlRequestJob::reply is called so that an XMLHttpRequest to a custom scheme gets a proper 'status' property. Note that calling QWebEngineUrlRequestJob::fail on the other hand emulates a network error, meaning it triggers the 'error' event in XMLHttpRequest. Fixes: QTBUG-78316 Change-Id: Ia7249a5b72533aa7e2ed4ef8f62d8b6b89820cc1 Reviewed-by: Allan Sandfeld Jensen --- src/core/net/url_request_custom_job.cpp | 18 ++++ src/core/net/url_request_custom_job.h | 1 + .../qwebengineprofile/tst_qwebengineprofile.cpp | 110 +++++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index cba9b4dc5..d8442707e 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -40,10 +40,12 @@ #include "url_request_custom_job.h" #include "url_request_custom_job_proxy.h" +#include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "net/base/io_buffer.h" +#include "net/http/http_util.h" #include @@ -136,6 +138,22 @@ bool URLRequestCustomJob::GetCharset(std::string* charset) return false; } +void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) +{ + if (m_error) + return; + + std::string headers; + if (m_redirect.is_valid()) { + headers += "HTTP/1.1 303 See Other\n"; + headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); + } else { + headers += "HTTP/1.1 200 OK\n"; + } + + info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size())); +} + bool URLRequestCustomJob::IsRedirectResponse(GURL* location, int* http_status_code, bool* /*insecure_scheme_was_upgraded*/) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index 16be76f29..c800d1595 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -64,6 +64,7 @@ public: int ReadRawData(net::IOBuffer *buf, int buf_size) override; bool GetMimeType(std::string *mimeType) const override; bool GetCharset(std::string *charset) override; + void GetResponseInfo(net::HttpResponseInfo* info) override; bool IsRedirectResponse(GURL* location, int* http_status_code, bool* insecure_scheme_was_upgraded) override; protected: diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 8b75067ee..921831700 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -40,6 +40,12 @@ #include #include +#if QT_CONFIG(webengine_webchannel) +#include +#endif + +#include + class tst_QWebEngineProfile : public QObject { Q_OBJECT @@ -58,6 +64,7 @@ private Q_SLOTS: void urlSchemeHandlerStreaming(); void urlSchemeHandlerRequestHeaders(); void urlSchemeHandlerInstallation(); + void urlSchemeHandlerXhrStatus(); void customUserAgent(); void httpAcceptLanguage(); void downloadItem(); @@ -568,6 +575,109 @@ void tst_QWebEngineProfile::urlSchemeHandlerInstallation() profile.removeUrlScheme("tst"); } +#if QT_CONFIG(webengine_webchannel) +class XhrStatusHost : public QObject +{ + Q_OBJECT +public: + std::map requests; + + bool isReady() + { + static const auto sig = QMetaMethod::fromSignal(&XhrStatusHost::load); + return isSignalConnected(sig); + } + +Q_SIGNALS: + void load(QUrl url); + +public Q_SLOTS: + void loadFinished(QUrl url, int status) + { + requests[url] = status; + } + +private: +}; + +class XhrStatusUrlSchemeHandler : public QWebEngineUrlSchemeHandler +{ +public: + void requestStarted(QWebEngineUrlRequestJob *job) + { + QString path = job->requestUrl().path(); + if (path == "/") { + QBuffer *buffer = new QBuffer(job); + buffer->open(QBuffer::ReadWrite); + buffer->write(QByteArrayLiteral(R"( + + + + + + +)")); + buffer->seek(0); + job->reply("text/html", buffer); + } else if (path == "/qwebchannel.js") { + QFile *file = new QFile(":/qtwebchannel/qwebchannel.js", job); + file->open(QFile::ReadOnly); + job->reply("application/javascript", file); + } else if (path == "/ok") { + QBuffer *buffer = new QBuffer(job); + buffer->buffer() = QByteArrayLiteral("ok"); + job->reply("text/plain", buffer); + } else if (path == "/redirect") { + QUrl url = job->requestUrl(); + url.setPath("/ok"); + job->redirect(url); + } else if (path == "/fail") { + job->fail(QWebEngineUrlRequestJob::RequestFailed); + } else { + job->fail(QWebEngineUrlRequestJob::UrlNotFound); + } + } +}; +#endif + +void tst_QWebEngineProfile::urlSchemeHandlerXhrStatus() +{ +#if QT_CONFIG(webengine_webchannel) + XhrStatusUrlSchemeHandler handler; + XhrStatusHost host; + QWebEngineProfile profile; + QWebEnginePage page(&profile); + QWebChannel channel; + channel.registerObject("host", &host); + profile.installUrlSchemeHandler("aviancarrier", &handler); + page.setWebChannel(&channel); + page.load(QUrl("aviancarrier:/")); + QTRY_VERIFY(host.isReady()); + host.load(QUrl("aviancarrier:/ok")); + host.load(QUrl("aviancarrier:/redirect")); + host.load(QUrl("aviancarrier:/fail")); + host.load(QUrl("aviancarrier:/notfound")); + QTRY_COMPARE(host.requests.size(), 4u); + QCOMPARE(host.requests[QUrl("aviancarrier:/ok")], 200); + QCOMPARE(host.requests[QUrl("aviancarrier:/redirect")], 200); + QCOMPARE(host.requests[QUrl("aviancarrier:/fail")], -1); + QCOMPARE(host.requests[QUrl("aviancarrier:/notfound")], -1); +#else + QSKIP("No QtWebChannel"); +#endif +} + void tst_QWebEngineProfile::customUserAgent() { QString defaultUserAgent = QWebEngineProfile::defaultProfile()->httpUserAgent(); -- cgit v1.2.3 From e77ec61b7ba1fb71b397ef358036b5057a0cb39b Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 18 Sep 2019 10:53:38 +0200 Subject: Unify shared context initialization Setting shared context on core application object should be done before core application is initialised. This is handled correctly in widgets part but not in qml part. Unify our shared context creation and call WebEngine::initialize() before QCoreaApplication is created. Context has to be set shared before first window's QPlatformOpenGLContext is created and not before window itself is created as documentation claimed. Keep the older code running, but print the warning. Update one test to test new initialization order, but keep the others to check if they still works. [ChangeLog] WebEngine::initialize() has to be called before QCoreApplication is created. Task-number: QTBUG-76391 Change-Id: Iff938493a4d21f360110136192daedb6199584c1 Reviewed-by: Allan Sandfeld Jensen --- examples/webengine/customdialogs/main.cpp | 3 ++- examples/webengine/minimal/main.cpp | 3 +-- examples/webengine/quicknanobrowser/main.cpp | 3 +-- examples/webengine/recipebrowser/main.cpp | 3 ++- examples/webengine/webengineaction/main.cpp | 4 ++-- src/core/api/qtwebenginecoreglobal.cpp | 2 +- src/core/content_browser_client_qt.cpp | 2 +- src/webengine/api/qtwebengineglobal.cpp | 15 ++++++++++++--- tests/auto/quick/dialogs/tst_dialogs.cpp | 5 +++-- tests/auto/quick/shared/util.h | 12 ++++++++++++ 10 files changed, 37 insertions(+), 15 deletions(-) diff --git a/examples/webengine/customdialogs/main.cpp b/examples/webengine/customdialogs/main.cpp index 82a3eca63..5aad8affb 100644 --- a/examples/webengine/customdialogs/main.cpp +++ b/examples/webengine/customdialogs/main.cpp @@ -67,9 +67,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - Application app(argc, argv); QtWebEngine::initialize(); + Application app(argc, argv); + QQmlApplicationEngine engine; Server *server = new Server(&engine); diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp index 9db6ea6aa..348517ee0 100644 --- a/examples/webengine/minimal/main.cpp +++ b/examples/webengine/minimal/main.cpp @@ -56,9 +56,8 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QtWebEngine::initialize(); + QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/examples/webengine/quicknanobrowser/main.cpp b/examples/webengine/quicknanobrowser/main.cpp index 8d032f5d8..d09abba3c 100644 --- a/examples/webengine/quicknanobrowser/main.cpp +++ b/examples/webengine/quicknanobrowser/main.cpp @@ -80,11 +80,10 @@ int main(int argc, char **argv) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QtWebEngine::initialize(); Application app(argc, argv); - QtWebEngine::initialize(); - QQmlApplicationEngine appEngine; Utils utils; appEngine.rootContext()->setContextProperty("utils", &utils); diff --git a/examples/webengine/recipebrowser/main.cpp b/examples/webengine/recipebrowser/main.cpp index 6e6d69804..e61b9e0f5 100644 --- a/examples/webengine/recipebrowser/main.cpp +++ b/examples/webengine/recipebrowser/main.cpp @@ -58,9 +58,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); QtWebEngine::initialize(); + QGuiApplication app(argc, argv); + QQuickStyle::setStyle(QStringLiteral("Material")); QQmlApplicationEngine engine; diff --git a/examples/webengine/webengineaction/main.cpp b/examples/webengine/webengineaction/main.cpp index ce723a99b..f2dec9655 100644 --- a/examples/webengine/webengineaction/main.cpp +++ b/examples/webengine/webengineaction/main.cpp @@ -56,10 +56,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QtWebEngine::initialize(); + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 25d0bd3be..3c7fc54a1 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -108,7 +108,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() QCoreApplication *app = QCoreApplication::instance(); if (!app) { - qFatal("QtWebEngine::initialize() must be called after the construction of the application object."); + qFatal("QtWebEngine::initialize() but no core application instance."); return; } diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 16945020b..04a8fc363 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -235,7 +235,7 @@ void ShareGroupQtQuick::AboutToAddFirstContext() // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) { - qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); + qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function before QCoreApplication is created."); } m_shareContextQtQuick = new QtShareGLContext(shareContext); #endif diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index a11618dba..4346832c9 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qtwebengineglobal.h" +#include namespace QtWebEngineCore { @@ -62,8 +63,8 @@ namespace QtWebEngine { /*! \fn QtWebEngine::initialize() - Sets up an OpenGL Context that can be shared between threads. This has to be done after - QGuiApplication is created, but before a Qt Quick window is created. + Sets up an OpenGL Context that can be shared between threads. This has to be done before + QGuiApplication is created and before window's QPlatformOpenGLContext is created. This has the same effect as setting the Qt::AA_ShareOpenGLContexts attribute with QCoreApplication::setAttribute before constructing @@ -71,7 +72,15 @@ namespace QtWebEngine { */ void initialize() { - QtWebEngineCore::initialize(); + QCoreApplication *app = QCoreApplication::instance(); + if (app) { + qWarning("QtWebEngine::initialize() called with QCoreApplication object already created and should be call before. "\ + "This is depreciated and may fail in the future."); + QtWebEngineCore::initialize(); + return; + } + // call initialize the same way as widgets do + qAddPreRoutine(QtWebEngineCore::initialize); } } // namespace QtWebEngine diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp index eee6b2bb6..82ea3be37 100644 --- a/tests/auto/quick/dialogs/tst_dialogs.cpp +++ b/tests/auto/quick/dialogs/tst_dialogs.cpp @@ -28,6 +28,7 @@ #include "testhandler.h" #include "server.h" +#include "util.h" #include #include #include @@ -43,6 +44,7 @@ class tst_Dialogs : public QObject { public: tst_Dialogs(){} + private slots: void initTestCase(); void init(); @@ -64,7 +66,6 @@ private: void tst_Dialogs::initTestCase() { - QtWebEngine::initialize(); QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); qmlRegisterType("io.qt.tester", 1, 0, "TestHandler"); m_engine.reset(new QQmlApplicationEngine()); @@ -230,5 +231,5 @@ void tst_Dialogs::javaScriptDialogRequested() } #include "tst_dialogs.moc" -QTEST_MAIN(tst_Dialogs) +W_QTEST_MAIN(tst_Dialogs) diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h index c2e7d3e19..bc5ae445b 100644 --- a/tests/auto/quick/shared/util.h +++ b/tests/auto/quick/shared/util.h @@ -36,6 +36,7 @@ #include #include #include +#include #if !defined(TESTS_SOURCE_DIR) #define TESTS_SOURCE_DIR "" @@ -182,4 +183,15 @@ inline QString activeElementId(QQuickWebEngineView *webEngineView) return arguments.at(1).toString(); } +#define W_QTEST_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QtWebEngine::initialize(); \ + QGuiApplication app(argc, argv); \ + app.setAttribute(Qt::AA_Use96Dpi, true); \ + TestObject tc; \ + QTEST_SET_MAIN_SOURCE_PATH \ + return QTest::qExec(&tc, argc, argv); \ +} #endif /* UTIL_H */ + -- cgit v1.2.3 From b44ed0fb99cd3d7047fcd322010c27cfa7989a18 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 18 Sep 2019 17:40:29 +0200 Subject: Reuse action for back, forward, reload web actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now back, forward, reload web action where created for context menu and bind to current webview. This change makes the binding to page instead. Change-Id: Id27db4a110e624f6ea916f31f529c21caa35668b Reviewed-by: Jüri Valdmann --- src/webenginewidgets/api/qwebenginepage.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 7b66ac876..2b18d63b1 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2539,16 +2539,13 @@ void QContextMenuBuilder::addMenuItem(ContextMenuItem menuItem) switch (menuItem) { case ContextMenuItem::Back: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), QWebEnginePage::tr("&Back"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::back); + action = thisRef->action(QWebEnginePage::Back); break; case ContextMenuItem::Forward: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), QWebEnginePage::tr("&Forward"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::forward); + action = thisRef->action(QWebEnginePage::Forward); break; case ContextMenuItem::Reload: - action = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), QWebEnginePage::tr("&Reload"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::reload); + action = thisRef->action(QWebEnginePage::Reload); break; case ContextMenuItem::Cut: action = thisRef->action(QWebEnginePage::Cut); -- cgit v1.2.3 From 120a5dd51e07f2de733e8d8b305897160851df19 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 9 Oct 2019 08:38:25 +0200 Subject: Stabilize tst_QWebEnginePage::comboBoxPopupPositionAfterMove auto test Fixes a flaky fail when jsViewPosition is called too early to query the view position. Change-Id: Ib2e9c1e95a6363a8e45e8bcc44e1878fd9a6914f Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 6373bf2d9..818439e46 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1051,6 +1051,12 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterMove() auto jsViewPosition = [&view]() { QLatin1String script("(function() { return [window.screenX, window.screenY]; })()"); QVariantList posList = evaluateJavaScriptSync(view.page(), script).toList(); + + if (posList.count() != 2) { + qWarning("jsViewPosition failed."); + return QPoint(); + } + return QPoint(posList.at(0).toInt(), posList.at(1).toInt()); }; -- cgit v1.2.3 From 13a336137a77bcc17fcdeaade3900a25a4e61e74 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 9 Oct 2019 15:52:57 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pulls in the following changes: ccfc032fb57 FIXUP: Disable crash-reports when reporting is disabled 7efe91029a6 Improve jpeg headers handling be2b74f4ab8 [Backport][ios] Get things compiling on Xcode 11. 3449634e50a Fix use of deprecated method for scanning wifi networks 8c785066d98 Workaround presumably wrong macOS SDK detection Fixes: QTBUG-78997 Change-Id: Ib23116fb51e89ca32ae4631350969377d2d8a42e Reviewed-by: Michael Brüning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 56c9ec962..8c785066d 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 56c9ec96237de4c7787c643c7ac7ac4e00c9a1d1 +Subproject commit 8c785066d987b663ed7d3386151ec8144c31cdcc -- cgit v1.2.3 From 7d08de5b527cb2112556a126b889dd7d0d888d22 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 7 Oct 2019 10:59:45 +0200 Subject: Fix life cycle issue of QWebEngineUrlRequestInterceptor Since 5e92adf intercept() is called on ui thread, however this patch does not consider deletion of interceptor while io thread still process the request and for examples checks interceptor's deprecated property. Fix it. Note this only fixes issue for interceptors which are not deprecated therefore run on ui thread. Change-Id: I5d5909065563e57a0cacb81fd04271b3f88596de Reviewed-by: Allan Sandfeld Jensen --- src/core/net/network_delegate_qt.cpp | 16 +++++++++------- src/core/net/url_request_notification.cpp | 2 +- src/core/profile_io_data_qt.cpp | 9 +++++++++ src/core/profile_io_data_qt.h | 4 +++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp index 7f278fd92..2cca152e6 100644 --- a/src/core/net/network_delegate_qt.cpp +++ b/src/core/net/network_delegate_qt.cpp @@ -136,11 +136,11 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet // Deprecated =begin // quick peek if deprecated - QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->requestInterceptor(); - if (profileInterceptor && profileInterceptor->property("deprecated").toBool()) { - profileInterceptor = nullptr; - if (QWebEngineUrlRequestInterceptor* interceptor = m_profileIOData->acquireInterceptor()) { - interceptor->interceptRequest(requestInfo); + + if (m_profileIOData->isInterceptorDeprecated()) { + QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->acquireInterceptor(); + if (profileInterceptor && m_profileIOData->isInterceptorDeprecated()) { + profileInterceptor->interceptRequest(requestInfo); m_profileIOData->releaseInterceptor(); if (requestInfo.changed()) { int result = infoPrivate->shouldBlockRequest ? net::ERR_BLOCKED_BY_CLIENT : net::OK; @@ -174,7 +174,9 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet if (!resourceInfo) return net::OK; - if (!m_profileIOData->hasPageInterceptors() && !profileInterceptor && !content::IsResourceTypeFrame(resourceType)) + // try to bail out + if (!m_profileIOData->hasPageInterceptors() && (!m_profileIOData->requestInterceptor() || m_profileIOData->isInterceptorDeprecated()) && + !content::IsResourceTypeFrame(resourceType)) return net::OK; auto webContentsGetter = resourceInfo->GetWebContentsGetterForRequest(); @@ -185,7 +187,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet std::move(requestInfo), webContentsGetter, std::move(callback), - profileInterceptor ? m_profileIOData->profileAdapter() : nullptr + m_profileIOData->profileAdapter() ); // We'll run the callback after we notified the UI thread. diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp index e37ad35bc..9d309e314 100644 --- a/src/core/net/url_request_notification.cpp +++ b/src/core/net/url_request_notification.cpp @@ -107,7 +107,7 @@ void URLRequestNotification::notify() if (webContents) { - if (m_profileAdapter) { + if (m_profileAdapter && m_profileAdapter->requestInterceptor()) { QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor(); if (!interceptor->property("deprecated").toBool()) interceptor->interceptRequest(m_requestInfo); diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 27c97a986..6ed172335 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -741,9 +741,18 @@ void ProfileIODataQt::updateRequestInterceptor() QMutexLocker lock(&m_mutex); m_requestInterceptor = m_profileAdapter->requestInterceptor(); m_hasPageInterceptors = m_profileAdapter->hasPageRequestInterceptor(); + if (m_requestInterceptor) + m_isInterceptorDeprecated = m_requestInterceptor->property("deprecated").toBool(); + else + m_isInterceptorDeprecated = false; // We in this case do not need to regenerate any Chromium classes. } +bool ProfileIODataQt::isInterceptorDeprecated() const +{ + return m_isInterceptorDeprecated; +} + QWebEngineUrlRequestInterceptor *ProfileIODataQt::acquireInterceptor() { m_mutex.lock(); diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 570365085..a1b123771 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -120,7 +120,8 @@ public: void setGlobalCertificateVerification(); // Used in NetworkDelegateQt::OnBeforeURLRequest. - QWebEngineUrlRequestInterceptor *acquireInterceptor(); + bool isInterceptorDeprecated() const; // Remove for Qt6 + QWebEngineUrlRequestInterceptor *acquireInterceptor(); // Remove for Qt6 void releaseInterceptor(); QWebEngineUrlRequestInterceptor *requestInterceptor(); @@ -191,6 +192,7 @@ private: base::WeakPtrFactory m_weakPtrFactory; // this should be always the last member QString m_dataPath; bool m_pendingStorageRequestGeneration = false; + volatile bool m_isInterceptorDeprecated = false; // Remove for Qt6 DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt); friend class BrowsingDataRemoverObserverQt; -- cgit v1.2.3 From 7c3977b60c59f5e4826f8c0a58ad887672d55fe1 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 10 Oct 2019 09:37:03 +0200 Subject: FIXUP: Fix page and profile interceptors initialization Previous commit showed an issue when interceptors are set before URLRequestContextGetterQt is created. The initial initialization was done on updateStorageSettings() which only affected profile interceptor initialization. Add explicit updateRequestInterceptor call to have profile and page interceptors initialized. This fixes also the issue of not set properly 'deprecated' flag. Change-Id: I0dda9eff67a2d779f4c9693920077a5aac2d9122 Reviewed-by: Allan Sandfeld Jensen --- src/core/profile_io_data_qt.cpp | 1 - src/core/profile_qt.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 6ed172335..a2613d3fc 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -614,7 +614,6 @@ void ProfileIODataQt::setRequestContextData(content::ProtocolHandlerMap *protoco void ProfileIODataQt::setFullConfiguration() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - m_requestInterceptor = m_profileAdapter->requestInterceptor(); m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy(); m_cookiesPath = m_profileAdapter->cookiesPath(); m_channelIdPath = m_profileAdapter->channelIdPath(); diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index 5977a28a8..cd8ee8110 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -272,6 +272,7 @@ net::URLRequestContextGetter *ProfileQt::CreateRequestContext( m_profileIOData->setRequestContextData(protocol_handlers, std::move(request_interceptors)); m_profileIOData->updateStorageSettings(); + m_profileIOData->updateRequestInterceptor(); m_urlRequestContextGetter = new URLRequestContextGetterQt(m_profileIOData.get()); return m_urlRequestContextGetter.get(); } -- cgit v1.2.3 From 51228eb249a178ada6ebd2ccd5e662bcd7bd2c60 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 10 Oct 2019 08:08:24 +0200 Subject: Don't modify the allowed actions as they are correct already MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By not modifying the allowed actions instead of just setting it to be the MoveAction will enable dragging from a webpage to another webpage to work correctly. Otherwise it will potentially reject the drag because it is seen only as a move, whereas it wouldn't be possible to really move from one webpage to another as the original source cannot be deleted. Change-Id: I34105d10e7d1dc831016c33c9c6cfc544c4e084b Reviewed-by: Jüri Valdmann --- src/core/web_contents_adapter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index ca2479965..d1fe786f6 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1414,8 +1414,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD }); QMimeData *mimeData = mimeDataFromDropData(*m_currentDropData); - if (handleDropDataFileContents(dropData, mimeData)) - allowedActions = Qt::MoveAction; + handleDropDataFileContents(dropData, mimeData); drag->setMimeData(mimeData); if (!pixmap.isNull()) { -- cgit v1.2.3 From 2e15d4724e1984111d37370b4c2e56cbb87bb38c Mon Sep 17 00:00:00 2001 From: Allan Jensen Date: Wed, 9 Oct 2019 14:51:25 +0200 Subject: Fix accessiblity events for combo-boxes The editable text-fields gets value-changed events from Blink instead of the text-changed events we needed. Change-Id: I688c06b644f333a3ba1ebd8831adbbbb7d49cbe7 Fixes: QTBUG-78206 Reviewed-by: Peter Varga --- src/core/browser_accessibility_manager_qt.cpp | 18 ++++++++++++++++++ src/core/browser_accessibility_manager_qt.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 7fb1386c5..8e3ee5940 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -146,6 +146,24 @@ void BrowserAccessibilityManagerQt::FireBlinkEvent(ax::mojom::Event event_type, break; } } + +void BrowserAccessibilityManagerQt::FireGeneratedEvent(ui::AXEventGenerator::Event event_type, + BrowserAccessibility* node) +{ + BrowserAccessibilityQt *iface = static_cast(node); + + switch (event_type) { + case ui::AXEventGenerator::Event::VALUE_CHANGED: + if (iface->role() == QAccessible::EditableText) { + QAccessibleTextUpdateEvent event(iface, -1, QString(), QString()); + QAccessible::updateAccessibility(&event); + } + break; + default: + break; + } +} + #endif // QT_NO_ACCESSIBILITY } diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h index 87c8875ba..16e2d1fe7 100644 --- a/src/core/browser_accessibility_manager_qt.h +++ b/src/core/browser_accessibility_manager_qt.h @@ -60,6 +60,8 @@ public: ~BrowserAccessibilityManagerQt() override; void FireBlinkEvent(ax::mojom::Event event_type, BrowserAccessibility* node) override; + void FireGeneratedEvent(ui::AXEventGenerator::Event event_type, + BrowserAccessibility* node) override; QAccessibleInterface *rootParentAccessible(); bool isValid() const { return m_valid; } -- cgit v1.2.3 From 9013c9a43aace3d091c6a64691fcbdf65abefe64 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 14 Oct 2019 09:42:29 +0200 Subject: Bump version Change-Id: Ideee5087290cf2a1d081261d832c8ceb11aeeae8 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index dceae50da..d804257e8 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -5,4 +5,4 @@ QTWEBENGINE_OUT_ROOT = $$shadowed($$PWD) load(qt_build_config) CONFIG += warning_clean -MODULE_VERSION = 5.13.1 +MODULE_VERSION = 5.13.2 -- cgit v1.2.3 -- cgit v1.2.3 From 986a1e024cc273f613d2c11e8f2ecc6ecd120ea0 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 23 Sep 2019 13:04:24 +0200 Subject: Add workaround for broken rendering on embedded On some boards we get wrong tile textures on the screen. It looks like this is some sort of a race condition or a problem with gl fencing. Add quick workaround by setting QTWEBENGINE_DISABLE_GPU_THREAD env. variable to force no in-process-gpu-thread. Change-Id: Ib397b04e039a279413c79277e25b77064b9b6854 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_engine_context.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a3a5881bf..07e0d3ba8 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -362,6 +362,7 @@ ProxyAuthentication WebEngineContext::qProxyNetworkAuthentication(QString host, const static char kChromiumFlagsEnv[] = "QTWEBENGINE_CHROMIUM_FLAGS"; const static char kDisableSandboxEnv[] = "QTWEBENGINE_DISABLE_SANDBOX"; +const static char kDisableInProcGpuThread[] = "QTWEBENGINE_DISABLE_GPU_THREAD"; static void appendToFeatureList(std::string &featureList, const char *feature) { @@ -608,6 +609,7 @@ WebEngineContext::WebEngineContext() #ifndef QT_NO_OPENGL threadedGpu = QOpenGLContext::supportsThreadedOpenGL(); #endif + threadedGpu = threadedGpu && !qEnvironmentVariableIsSet(kDisableInProcGpuThread); registerMainThreadFactories(threadedGpu); SetContentClient(new ContentClientQt); -- cgit v1.2.3 From 4a141b148d04be3b97d29d2ef808c30c2e8f54b1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 14 Oct 2019 15:33:36 +0200 Subject: Update Chromium Changes: 6a5dc3af3537 [Backport] Reintroduce glib message event loop 1/3 580ffe2cb750 [Backport] Reintroduce glib event loop 2/3 9ae8ddaeea11 Reintroduce glib event loop 3/3 1f07ca687b1a [Backport] CVE-2019-5870 00d9e1e3be09 [Backport] CVE-2019-5872 d627df149baa [Backport] CVE-2019-5875 2d9ed8b1aaa6 [Backport] CVE-2019-5876 bebd1df6d51d [Backport] CVE-2019-13691 1c7141ad185b [Backport] CVE-2019-13692 f0e6f7f8a392 [Backport] CVE-2019-13688 495b2ebcd9d3 [Backport] CVE-2019-13687 cc18c848e174 [Backport] CVE-2019-13693 b41d57627c00 [Backport] CVE-2019-13695 c88d2026cc60 [Backport] CVE-2019-13697 Task-number: QTBUG-79193 Change-Id: I1a318d573d5f95c8bad02e96ed5084a1a1ef7bf8 Reviewed-by: Michal Klocek --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index 8c785066d..c88d2026c 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 8c785066d987b663ed7d3386151ec8144c31cdcc +Subproject commit c88d2026cc604c9cc7b42e4684eb480f12690e30 -- cgit v1.2.3 From 0cbd705b119169db0dc6cb83f811a045570dd975 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 15 Oct 2019 10:44:14 +0200 Subject: Disable explicitly glib There some issue with running glib event message pump, due to coming release just make sure glib is disabled. Change-Id: Ibe7b89ddfbcd57dbb41cfbc5d6a8ad1c69be39cb Reviewed-by: Allan Sandfeld Jensen --- src/core/config/linux.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 22cb5991f..f45c418fe 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -178,7 +178,7 @@ host_build { } else { gn_args += use_system_harfbuzz=false } - !qtConfig(webengine-system-glib): gn_args += use_glib=false + gn_args += use_glib=false qtConfig(webengine-pulseaudio) { gn_args += use_pulseaudio=true } else { -- cgit v1.2.3 From ae0eea6d5dbbe8570ff5ee2342484a78ad5c92fb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 15 Oct 2019 18:26:37 +0200 Subject: Handle possible frame eviction on show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our surface id might have been invalidated, so we need to generate a new one. And DelegatedFrameHost::WasShown needs to be called after RenderWidgetHostImpl::WasShown which cancels the eviction. Change-Id: I5761d47b11754a77e40ebde7fc5ed2e64f372613 Fixes: QTBUG-79021 Reviewed-by: Jüri Valdmann --- src/core/render_widget_host_view_qt.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 7633aa44c..e86f05d60 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1009,15 +1009,22 @@ QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode) void RenderWidgetHostViewQt::notifyShown() { if (m_enableViz) { + // Handle possible frame eviction: + if (!m_dfhLocalSurfaceIdAllocator.HasValidLocalSurfaceIdAllocation()) + m_dfhLocalSurfaceIdAllocator.GenerateId(); if (m_visible) return; m_visible = true; + } + + host()->WasShown(base::nullopt); + + if (m_enableViz) { m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get()); m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(), m_viewRectInDips.size(), base::nullopt); } - host()->WasShown(base::nullopt); } void RenderWidgetHostViewQt::notifyHidden() -- cgit v1.2.3 From 6ec6b478dbe164686e1355da0478c6783e55d0ba Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 16 Oct 2019 14:00:12 +0200 Subject: Fix timestamp of geoposition objects toTime() conversion function was incorrect and this resulted inaccurate timestamps when using the geolocation feature. Change-Id: I4d536a3a99bb630c9304e91f06b77b9035b0ffc6 Reviewed-by: Allan Sandfeld Jensen --- src/core/type_conversion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index dfd8e8fef..2275ae82e 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -217,7 +217,7 @@ inline QDateTime toQt(base::Time time) } inline base::Time toTime(const QDateTime &dateTime) { - return base::Time::FromInternalValue(dateTime.toMSecsSinceEpoch()); + return base::Time::FromJavaTime(dateTime.toMSecsSinceEpoch()); } inline QNetworkCookie toQt(const net::CanonicalCookie & cookie) -- cgit v1.2.3 From 0d8e9d612951f2501f7e1f92f0173ab0e680324e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Thu, 10 Oct 2019 13:53:17 +0200 Subject: Fix getDisplayMedia crash The MEDIA_DISPLAY_VIDEO_CAPTURE stream type is handled incorrectly by MediaCaptureDevicesDispatcher causing a crash when an unexpected type of media device is returned to Chromium. This patch only fixes the crash, screen sharing is nonetheless not properly supported by WebEngine due to limitations of the public API which does not allow selecting between screens, not to mention windows or tabs. On Linux WebRTC's ScreenCapturer is not even built since it depends on use_x11 being set in GN. Fixes: QTBUG-78016 Change-Id: I7fa49febaba1be94bdb6c31265dfc24ee809d635 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Qt CI Bot --- src/core/media_capture_devices_dispatcher.cpp | 76 ++++++++++++---------- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 35 ++++++---- 2 files changed, 62 insertions(+), 49 deletions(-) diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index ecc46f244..29230c27b 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -87,22 +87,25 @@ const blink::MediaStreamDevice *findDeviceWithId(const blink::MediaStreamDevices return 0; } -// Based on chrome/browser/media/desktop_capture_access_handler.cc: -void getDevicesForDesktopCapture(blink::MediaStreamDevices *devices, content::DesktopMediaID mediaId, bool captureAudio) +// Based on chrome/browser/media/webrtc/desktop_capture_devices_util.cc: +void getDevicesForDesktopCapture(blink::MediaStreamDevices *devices, + content::DesktopMediaID mediaId, + bool captureAudio, + blink::MediaStreamType videoType, + blink::MediaStreamType audioType) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // Add selected desktop source to the list. - devices->push_back(blink::MediaStreamDevice(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, mediaId.ToString(), "Screen")); + devices->push_back(blink::MediaStreamDevice(videoType, mediaId.ToString(), mediaId.ToString())); if (captureAudio) { if (mediaId.type == content::DesktopMediaID::TYPE_WEB_CONTENTS) { devices->push_back( - blink::MediaStreamDevice(blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, - mediaId.ToString(), "Tab audio")); + blink::MediaStreamDevice(audioType, mediaId.ToString(), "Tab audio")); } else { // Use the special loopback device ID for system audio capture. devices->push_back(blink::MediaStreamDevice( - blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, + audioType, media::AudioDeviceDescription::kLoopbackInputDeviceId, "System Audio")); } @@ -151,19 +154,27 @@ content::DesktopMediaID getDefaultScreenId() WebContentsAdapterClient::MediaRequestFlags mediaRequestFlagsForRequest(const content::MediaStreamRequest &request) { - WebContentsAdapterClient::MediaRequestFlags requestFlags = WebContentsAdapterClient::MediaNone; + if (request.audio_type == blink::MEDIA_DEVICE_AUDIO_CAPTURE && + request.video_type == blink::MEDIA_DEVICE_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaAudioCapture, WebContentsAdapterClient::MediaVideoCapture}; - if (request.audio_type == blink::MEDIA_DEVICE_AUDIO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaAudioCapture; - else if (request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaDesktopAudioCapture; + if (request.audio_type == blink::MEDIA_DEVICE_AUDIO_CAPTURE && + request.video_type == blink::MEDIA_NO_SERVICE) + return {WebContentsAdapterClient::MediaAudioCapture}; - if (request.video_type == blink::MEDIA_DEVICE_VIDEO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaVideoCapture; - else if (request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaDesktopVideoCapture; + if (request.audio_type == blink::MEDIA_NO_SERVICE && + request.video_type == blink::MEDIA_DEVICE_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaVideoCapture}; - return requestFlags; + if (request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE && + request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaDesktopAudioCapture, WebContentsAdapterClient::MediaDesktopVideoCapture}; + + if (request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE || + request.video_type == blink::MEDIA_DISPLAY_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaDesktopVideoCapture}; + + return {}; } } // namespace @@ -198,14 +209,13 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: if (!securityOriginsMatch) qWarning("Security origin mismatch for media access permission: %s requested and %s provided\n", qPrintable(requestSecurityOrigin.toString()), qPrintable(securityOrigin.toString())); - bool microphoneRequested = - (request.audio_type && authorizationFlags & WebContentsAdapterClient::MediaAudioCapture); - bool webcamRequested = - (request.video_type && authorizationFlags & WebContentsAdapterClient::MediaVideoCapture); - bool desktopAudioRequested = - (request.audio_type && authorizationFlags & WebContentsAdapterClient::MediaDesktopAudioCapture); - bool desktopVideoRequested = - (request.video_type && authorizationFlags & WebContentsAdapterClient::MediaDesktopVideoCapture); + WebContentsAdapterClient::MediaRequestFlags requestFlags = mediaRequestFlagsForRequest(request); + WebContentsAdapterClient::MediaRequestFlags finalFlags = requestFlags & authorizationFlags; + + bool microphoneRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture); + bool webcamRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture); + bool desktopAudioRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaDesktopAudioCapture); + bool desktopVideoRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture); if (securityOriginsMatch) { if (microphoneRequested || webcamRequested) { @@ -221,7 +231,8 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: break; } } else if (desktopVideoRequested) { - getDevicesForDesktopCapture(&devices, getDefaultScreenId(), desktopAudioRequested); + getDevicesForDesktopCapture(&devices, getDefaultScreenId(), desktopAudioRequested, + request.video_type, request.audio_type); } } @@ -274,13 +285,13 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // Let's not support tab capture for now. - if (request.video_type == blink::MEDIA_GUM_TAB_VIDEO_CAPTURE || request.audio_type == blink::MEDIA_GUM_TAB_AUDIO_CAPTURE) { + WebContentsAdapterClient::MediaRequestFlags flags = mediaRequestFlagsForRequest(request); + if (!flags) { std::move(callback).Run(blink::MediaStreamDevices(), blink::MEDIA_DEVICE_NOT_SUPPORTED, std::unique_ptr()); return; } - if (request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE || request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) { + if (flags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture)) { const bool screenCaptureEnabled = adapterClient->webEngineSettings()->testAttribute(WebEngineSettings::ScreenCaptureEnabled); const bool originIsSecure = content::IsOriginSecure(request.security_origin); @@ -298,18 +309,13 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter enqueueMediaAccessRequest(webContents, request, std::move(callback)); // We might not require this approval for pepper requests. - adapterClient->runMediaAccessPermissionRequest(toQt(request.security_origin), mediaRequestFlagsForRequest(request)); + adapterClient->runMediaAccessPermissionRequest(toQt(request.security_origin), flags); } void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content::WebContents *webContents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback) { blink::MediaStreamDevices devices; - if (request.video_type != blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE || request.requested_video_device_id.empty()) { - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, std::unique_ptr()); - return; - } - content::WebContents *const web_contents_for_stream = content::WebContents::FromRenderFrameHost( content::RenderFrameHost::FromID(request.render_process_id, request.render_frame_id)); content::RenderFrameHost *const main_frame = web_contents_for_stream ? web_contents_for_stream->GetMainFrame() : NULL; @@ -334,7 +340,7 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: // Audio is only supported for screen capture streams. bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE); - getDevicesForDesktopCapture(&devices, mediaId, capture_audio); + getDevicesForDesktopCapture(&devices, mediaId, capture_audio, request.video_type, request.audio_type); std::move(callback).Run(devices, devices.empty() ? blink::MEDIA_DEVICE_INVALID_STATE : blink::MEDIA_DEVICE_OK, std::unique_ptr()); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 818439e46..8d5b486b2 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1253,16 +1253,21 @@ public: load(QUrl("qrc:///resources/content.html")); } - void jsGetUserMedia(const QString & constraints) + void jsGetMedia(const QString &call) { evaluateJavaScriptSync(this, QStringLiteral( "var promiseFulfilled = false;" "var promiseRejected = false;" - "navigator.mediaDevices.getUserMedia(%1)" + "navigator.mediaDevices.%1" ".then(stream => { promiseFulfilled = true})" ".catch(err => { promiseRejected = true})") - .arg(constraints)); + .arg(call)); + } + + void jsGetUserMedia(const QString &constraints) + { + jsGetMedia(QStringLiteral("getUserMedia(%1)").arg(constraints)); } bool jsPromiseFulfilled() @@ -1319,32 +1324,34 @@ private: void tst_QWebEnginePage::getUserMediaRequest_data() { - QTest::addColumn("constraints"); + QTest::addColumn("call"); QTest::addColumn("feature"); QTest::addRow("device audio") - << "{audio: true}" << QWebEnginePage::MediaAudioCapture; + << "getUserMedia({audio: true})" << QWebEnginePage::MediaAudioCapture; QTest::addRow("device video") - << "{video: true}" << QWebEnginePage::MediaVideoCapture; + << "getUserMedia({video: true})" << QWebEnginePage::MediaVideoCapture; QTest::addRow("device audio+video") - << "{audio: true, video: true}" << QWebEnginePage::MediaAudioVideoCapture; + << "getUserMedia({audio: true, video: true})" << QWebEnginePage::MediaAudioVideoCapture; QTest::addRow("desktop video") - << "{video: { mandatory: { chromeMediaSource: 'desktop' }}}" + << "getUserMedia({video: { mandatory: { chromeMediaSource: 'desktop' }}})" << QWebEnginePage::DesktopVideoCapture; QTest::addRow("desktop audio+video") - << "{audio: { mandatory: { chromeMediaSource: 'desktop' }}, video: { mandatory: { chromeMediaSource: 'desktop' }}}" + << "getUserMedia({audio: { mandatory: { chromeMediaSource: 'desktop' }}, video: { mandatory: { chromeMediaSource: 'desktop' }}})" << QWebEnginePage::DesktopAudioVideoCapture; + QTest::addRow("display video") + << "getDisplayMedia()" << QWebEnginePage::DesktopVideoCapture; } void tst_QWebEnginePage::getUserMediaRequest() { - QFETCH(QString, constraints); + QFETCH(QString, call); QFETCH(QWebEnginePage::Feature, feature); GetUserMediaTestPage page; + QWebEngineView view; if (feature == QWebEnginePage::DesktopVideoCapture || feature == QWebEnginePage::DesktopAudioVideoCapture) { // Desktop capture needs to be on a desktop. - QWebEngineView view; view.setPage(&page); view.resize(640, 480); view.show(); @@ -1355,7 +1362,7 @@ void tst_QWebEnginePage::getUserMediaRequest() page.settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true); // 1. Rejecting request on C++ side should reject promise on JS side. - page.jsGetUserMedia(constraints); + page.jsGetMedia(call); QTRY_VERIFY(page.gotFeatureRequest(feature)); page.rejectPendingRequest(); QTRY_VERIFY(!page.jsPromiseFulfilled() && page.jsPromiseRejected()); @@ -1365,13 +1372,13 @@ void tst_QWebEnginePage::getUserMediaRequest() // deeper in the content layer we cannot guarantee that the promise will // always be fulfilled, however in this case an error should be returned to // JS instead of leaving the Promise in limbo. - page.jsGetUserMedia(constraints); + page.jsGetMedia(call); QTRY_VERIFY(page.gotFeatureRequest(feature)); page.acceptPendingRequest(); QTRY_VERIFY(page.jsPromiseFulfilled() || page.jsPromiseRejected()); // 3. Media feature permissions are not remembered. - page.jsGetUserMedia(constraints); + page.jsGetMedia(call); QTRY_VERIFY(page.gotFeatureRequest(feature)); page.acceptPendingRequest(); QTRY_VERIFY(page.jsPromiseFulfilled() || page.jsPromiseRejected()); -- cgit v1.2.3 From 808645a7518aca9f67fed4a911342fb7f728afaa Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 16 Oct 2019 13:01:47 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: 01b3f792f17b [Backport] CVE-2019-13659 d0e61ebba346 [Backport] CVE-2019-13694 9312eb97bf60 [Backport] Security issue 986727 [1/2] 66c739040bba [Backport] Security issue 986727 [2/2] b1ce3367b489 [Backport] CVE-2019-13660 ade14af90b01 [Backport] CVE-2019-13633 [1/2] 5f5f67b3a1f5 [Backport] CVE-2019-13664 6ddab05a4c71 [Backport] Security issue 990234 e8ba421d30c9 [Backport] CVE-2019-13663 [2/2] 1f64c1f27840 [Backport] CVE-2019-13665 8635cf233cdf [Backport] CVE-2019-13668 691467ccbb87 [Backport] CVE-2019-13673 fe065266295e [Backport] Security issue 946351 e989f4cb8907 [Backport] Security issue 964938 6114514c9e76 [Backport] Security issue 974354 [1/2] 858447a76544 [Backport] Security issue 974354 [2/2] 3d7a96629b79 Convert asserts to logs and returns in the PpapiHost a42666a17663 Apply workarounds to build extensions with gcc 5.3.1 18d4c6e82503 Revert "[Backport] CVE-2019-13668" Task-number: QTBUG-79193 Change-Id: I2b70a4343fd37321e0c10e574e515e42930ada10 Reviewed-by: Michael Brüning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index c88d2026c..18d4c6e82 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit c88d2026cc604c9cc7b42e4684eb480f12690e30 +Subproject commit 18d4c6e8250324d084d89b17ad80721bb46ddbd9 -- cgit v1.2.3 From f4fa4d3d3424d36fd1a3c9f8396e0d7a85c5b84a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 30 Sep 2019 17:05:43 +0200 Subject: QML: Fix import to 1.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New QML API in Qt 5.14 should be made available under import QtWebEngine 1.10 Change-Id: Ia421755eaa77f283d7a23b4b2b3b3ea1a491714d Reviewed-by: Michael Brüning Reviewed-by: Jüri Valdmann --- src/webengine/api/qquickwebengineview_p.h | 10 +++++----- src/webengine/plugin/plugin.cpp | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 4a88e3c28..618f9407e 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -139,8 +139,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL) #endif - Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION 11 FINAL) - Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION 11 FINAL) + Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION 10 FINAL) + Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION 10 FINAL) public: QQuickWebEngineView(QQuickItem *parent = 0); @@ -573,9 +573,9 @@ Q_SIGNALS: Q_REVISION(8) void printRequested(); Q_REVISION(9) void selectClientCertificate(QQuickWebEngineClientCertificateSelection *clientCertSelection); Q_REVISION(10) void tooltipRequested(QQuickWebEngineTooltipRequest *request); - Q_REVISION(11) void lifecycleStateChanged(LifecycleState state); - Q_REVISION(11) void recommendedStateChanged(LifecycleState state); - Q_REVISION(11) void findTextFinished(const QWebEngineFindTextResult &result); + Q_REVISION(10) void lifecycleStateChanged(LifecycleState state); + Q_REVISION(10) void recommendedStateChanged(LifecycleState state); + Q_REVISION(10) void findTextFinished(const QWebEngineFindTextResult &result); #if QT_CONFIG(webengine_testsupport) void testSupportChanged(); diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index 5fb48d867..8ed78f1c4 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -97,7 +97,6 @@ public: qmlRegisterType(uri, 1, 8, "WebEngineView"); qmlRegisterType(uri, 1, 9, "WebEngineView"); qmlRegisterType(uri, 1, 10, "WebEngineView"); - qmlRegisterType(uri, 1, 11, "WebEngineView"); qmlRegisterType(uri, 1, 1, "WebEngineProfile"); qmlRegisterType(uri, 1, 2, "WebEngineProfile"); qmlRegisterType(uri, 1, 3, "WebEngineProfile"); @@ -174,7 +173,7 @@ public: qmlRegisterUncreatableType(uri, 1, 10, "TooltipRequest", msgUncreatableType("TooltipRequest")); qRegisterMetaType(); - qmlRegisterUncreatableType(uri, 1, 11, "FindTextResult", msgUncreatableType("FindTextResult")); + qmlRegisterUncreatableType(uri, 1, 10, "FindTextResult", msgUncreatableType("FindTextResult")); } private: -- cgit v1.2.3 From 615ea60ac76a8db78f1473a6970e3dc3bfdb9cc9 Mon Sep 17 00:00:00 2001 From: Tamas Zakor Date: Tue, 15 Oct 2019 09:54:42 +0200 Subject: Fix tst_qwebenginepage::comboBoxPopupPositionAfterMove() auto test Assertion fail occurs when the destruction order of the windows is not correct. This happens only in this test and can not be reproduced manually. Destroy popup window before destroying the main window. Change-Id: Iea00df25c200e1b8aff9ce08ef73a411e549fcab Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 5edd778e2..124dc825f 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1190,6 +1190,8 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterMove() QTRY_VERIFY(QGuiApplication::topLevelWindows().contains(popup)); QTRY_VERIFY(!popup->position().isNull()); QCOMPARE(popupPos + offset, popup->position()); + QTest::mouseClick(window, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(1, 1)); + QTRY_VERIFY(!QGuiApplication::topLevelWindows().contains(popup)); } void tst_QWebEnginePage::comboBoxPopupPositionAfterChildMove() -- cgit v1.2.3 From 0ce522cb43813a2a557c4197e0bc672596080a10 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Fri, 4 Oct 2019 16:57:18 +0200 Subject: Rename certificate error's chain API method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address API review and make the name to be consistent with other methods like localCertificateChain and peerCertificateChain of QSslCertificate Change-Id: I4f115846965d31ea9a20df3b7a27c6c041c52768 Reviewed-by: Michael Brüning --- src/core/certificate_error_controller.cpp | 6 +++--- src/core/certificate_error_controller.h | 2 +- src/core/certificate_error_controller_p.h | 2 +- src/webenginewidgets/api/qwebenginecertificateerror.cpp | 8 ++++---- src/webenginewidgets/api/qwebenginecertificateerror.h | 2 +- tests/auto/widgets/certificateerror/tst_certificateerror.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp index bc83ed802..f3b16357b 100644 --- a/src/core/certificate_error_controller.cpp +++ b/src/core/certificate_error_controller.cpp @@ -93,7 +93,7 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er if (auto cert = ssl_info.cert.get()) { validStart = toQt(cert->valid_start()); validExpiry = toQt(cert->valid_expiry()); - chain = toCertificateChain(cert); + certificateChain = toCertificateChain(cert); } } @@ -187,9 +187,9 @@ QString CertificateErrorController::errorString() const return getQStringForMessageId(IDS_CERT_ERROR_UNKNOWN_ERROR_DESCRIPTION); } -QList CertificateErrorController::chain() const +QList CertificateErrorController::certificateChain() const { - return d->chain; + return d->certificateChain; } QT_END_NAMESPACE diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h index 7f5300dc8..d7e057adf 100644 --- a/src/core/certificate_error_controller.h +++ b/src/core/certificate_error_controller.h @@ -96,7 +96,7 @@ public: QString errorString() const; QDateTime validStart() const; QDateTime validExpiry() const; - QList chain() const; + QList certificateChain() const; void accept(bool); diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h index a11f2b6f0..ceae99853 100644 --- a/src/core/certificate_error_controller_p.h +++ b/src/core/certificate_error_controller_p.h @@ -71,7 +71,7 @@ public: bool fatalError; bool strictEnforcement; const base::Callback callback; - QList chain; + QList certificateChain; }; QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp index 45277e19d..3f20b6483 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp +++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp @@ -79,7 +79,7 @@ public: QUrl url; bool overridable; QString errorDescription; - QList chain; + QList certificateChain; bool answered = false, deferred = false; QWeakPointer controller; @@ -107,7 +107,7 @@ QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointeroverridable(), controller->errorString())) { d->controller = controller; - d->chain = controller->chain(); + d->certificateChain = controller->certificateChain(); } QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &) = default; @@ -255,9 +255,9 @@ bool QWebEngineCertificateError::answered() const Chain starts with the peer's immediate certificate and ending with the CA's certificate. */ -QList QWebEngineCertificateError::chain() const +QList QWebEngineCertificateError::certificateChain() const { - return d->chain; + return d->certificateChain; } QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/webenginewidgets/api/qwebenginecertificateerror.h index b2dd65a9f..d3a19edfc 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.h +++ b/src/webenginewidgets/api/qwebenginecertificateerror.h @@ -90,7 +90,7 @@ public: void ignoreCertificateError(); bool answered() const; - QList chain() const; + QList certificateChain() const; private: friend class QWebEnginePagePrivate; diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp index 5fd765ed5..109c69cd7 100644 --- a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp +++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp @@ -96,7 +96,7 @@ void tst_CertificateError::handleError() page.setUrl(server.url()); QTRY_VERIFY(page.error); QVERIFY(page.error->isOverridable()); - auto chain = page.error->chain(); + auto chain = page.error->certificateChain(); QCOMPARE(chain.size(), 2); QCOMPARE(chain[0].serialNumber(), "3b:dd:1a:b7:2f:40:32:3b:c1:bf:37:d4:86:bd:56:c1:d0:6b:2a:43"); QCOMPARE(chain[1].serialNumber(), "6d:52:fb:b4:57:3b:b2:03:c8:62:7b:7e:44:45:5c:d3:08:87:74:17"); -- cgit v1.2.3 From d8295dc15d8dd80089c8493a35c88d046d6a4884 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Wed, 16 Oct 2019 13:19:16 +0200 Subject: Activate extensions on Linux for GCC version 5.3.1 as well This removes the special handling for the lower GCC versions that we support on linux. This will make the extensions and the PDF viewer available on the pre-built linux packages. Change-Id: I7b79c82f8e2596e2401e05f81041d736486d1c7d Fixes: QTBUG-76329 Reviewed-by: Allan Sandfeld Jensen --- configure.pri | 5 ----- src/core/configure.json | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/configure.pri b/configure.pri index 23f72c5c6..1e7e35178 100644 --- a/configure.pri +++ b/configure.pri @@ -294,8 +294,3 @@ defineTest(qtConfTest_hasThumbFlag) { # no flag assume mthumb return(true) } - -defineTest(qtConfTest_hasGcc6OrNewer) { - greaterThan(QMAKE_GCC_MAJOR_VERSION, 5):return(true) - return(false) -} diff --git a/src/core/configure.json b/src/core/configure.json index be686850b..cd3c5c661 100644 --- a/src/core/configure.json +++ b/src/core/configure.json @@ -334,10 +334,6 @@ "label": "thumb instruction set", "type": "hasThumbFlag" }, - "webengine-extensions-gcc-version" : { - "label": "GCC 6 or newer", - "type": "hasGcc6OrNewer" - }, "webengine-noexecstack" : { "label": "linker supports -z noexecstack", "type": "linkerSupportsFlag", @@ -566,7 +562,7 @@ "label": "Extensions", "purpose": "Enables Chromium extensions within certain limits. Currently used for enabling the pdf viewer.", "section": "WebEngine", - "condition": "features.webengine-printing-and-pdf && (tests.webengine-extensions-gcc-version || config.clang || !config.gcc)", + "condition": "features.webengine-printing-and-pdf", "autoDetect": "features.webengine-printing-and-pdf", "output": [ "publicFeature" ] }, -- cgit v1.2.3 From 43f26916a5716ddcd2270c513f15a62b183929bb Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 1 Oct 2019 08:17:50 +0200 Subject: Improve QWebEngineFindTextResult API Implements suggestions from 5.14 API review: - Rename activeMatchOrdinal to activeMatch - Extend documentation - Change QML import version number to 1.10 Task-number: QTBUG-77839 Change-Id: I5eae659cfb5355af8d0c878d3b5f00654c9d6d13 Reviewed-by: Leena Miettinen Reviewed-by: Allan Sandfeld Jensen --- .../webengine/quicknanobrowser/BrowserWindow.qml | 4 +-- examples/webengine/quicknanobrowser/FindBar.qml | 6 ++-- .../simplebrowser/browserwindow.cpp | 2 +- src/core/api/qwebenginefindtextresult.cpp | 24 ++++++++++++---- src/core/api/qwebenginefindtextresult.h | 6 ++-- src/core/find_text_helper.cpp | 4 +-- src/core/find_text_helper.h | 2 +- src/webengine/doc/src/webengineview_lgpl.qdoc | 4 +-- tests/auto/quick/publicapi/tst_publicapi.cpp | 2 +- tests/auto/quick/qmltests/data/tst_findText.qml | 32 +++++++++++----------- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 16 +++++------ 11 files changed, 57 insertions(+), 45 deletions(-) diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 39a13df59..2d3168382 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -57,7 +57,7 @@ import QtQuick.Controls.Styles 1.0 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.0 import QtQuick.Window 2.1 -import QtWebEngine 1.11 +import QtWebEngine 1.10 ApplicationWindow { id: browserWindow @@ -580,7 +580,7 @@ ApplicationWindow { findBar.visible = true; findBar.numberOfMatches = result.numberOfMatches; - findBar.activeMatchOrdinal = result.activeMatchOrdinal; + findBar.activeMatch = result.activeMatch; } onLoadingChanged: function(loadRequest) { diff --git a/examples/webengine/quicknanobrowser/FindBar.qml b/examples/webengine/quicknanobrowser/FindBar.qml index 2d673592a..de407ac33 100644 --- a/examples/webengine/quicknanobrowser/FindBar.qml +++ b/examples/webengine/quicknanobrowser/FindBar.qml @@ -57,12 +57,12 @@ Rectangle { id: root property int numberOfMatches: 0 - property int activeMatchOrdinal: 0 + property int activeMatch: 0 property alias text: findTextField.text function reset() { numberOfMatches = 0; - activeMatchOrdinal = 0; + activeMatch = 0; visible = false; } @@ -113,7 +113,7 @@ Rectangle { } Label { - text: activeMatchOrdinal + "/" + numberOfMatches + text: activeMatch + "/" + numberOfMatches visible: findTextField.text != "" } diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.cpp b/examples/webenginewidgets/simplebrowser/browserwindow.cpp index 7b167ded7..c1d0ea359 100644 --- a/examples/webenginewidgets/simplebrowser/browserwindow.cpp +++ b/examples/webenginewidgets/simplebrowser/browserwindow.cpp @@ -532,7 +532,7 @@ void BrowserWindow::handleFindTextFinished(const QWebEngineFindTextResult &resul statusBar()->showMessage(tr("\"%1\" not found.").arg(m_lastSearch)); } else { statusBar()->showMessage(tr("\"%1\" found: %2/%3").arg(m_lastSearch, - QString::number(result.activeMatchOrdinal()), + QString::number(result.activeMatch()), QString::number(result.numberOfMatches()))); } } diff --git a/src/core/api/qwebenginefindtextresult.cpp b/src/core/api/qwebenginefindtextresult.cpp index ce1be359e..c0adc6177 100644 --- a/src/core/api/qwebenginefindtextresult.cpp +++ b/src/core/api/qwebenginefindtextresult.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE class QWebEngineFindTextResultPrivate : public QSharedData { public: int numberOfMatches = 0; - int activeMatchOrdinal = 0; + int activeMatch = 0; }; /*! @@ -54,6 +54,18 @@ public: \inmodule QtWebEngineCore + The string search can be initiated by the \l QWebEnginePage::findText() or + \l{WebEngineView::findText()}{WebEngineView.findText()} method. The results of the search + are highlighted in the view. The details of this result are passed as a + QWebEngineFindTextResult object that can be used to show a status message, + such as "2 of 2 matches". For example: + + \code + QObject::connect(view.page(), &QWebEnginePage::findTextFinished, [](const QWebEngineFindTextResult &result) { + qInfo() << result.activeMatch() << "of" << result.numberOfMatches() << "matches"; + }); + \endcode + Results are passed to the user in the \l QWebEnginePage::findTextFinished() and \l{WebEngineView::findTextFinished()}{WebEngineView.findTextFinished()} signals. @@ -67,11 +79,11 @@ QWebEngineFindTextResult::QWebEngineFindTextResult() /*! \internal */ -QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal) +QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatch) : d(new QWebEngineFindTextResultPrivate) { d->numberOfMatches = numberOfMatches; - d->activeMatchOrdinal = activeMatchOrdinal; + d->activeMatch = activeMatch; } /*! \internal @@ -103,12 +115,12 @@ int QWebEngineFindTextResult::numberOfMatches() const } /*! - \property QWebEngineFindTextResult::activeMatchOrdinal + \property QWebEngineFindTextResult::activeMatch \brief The index of the currently highlighted match. */ -int QWebEngineFindTextResult::activeMatchOrdinal() const +int QWebEngineFindTextResult::activeMatch() const { - return d->activeMatchOrdinal; + return d->activeMatch; } QT_END_NAMESPACE diff --git a/src/core/api/qwebenginefindtextresult.h b/src/core/api/qwebenginefindtextresult.h index 073a8135f..246e689c3 100644 --- a/src/core/api/qwebenginefindtextresult.h +++ b/src/core/api/qwebenginefindtextresult.h @@ -55,11 +55,11 @@ class QWebEngineFindTextResultPrivate; class Q_WEBENGINECORE_EXPORT QWebEngineFindTextResult { Q_GADGET Q_PROPERTY(int numberOfMatches READ numberOfMatches CONSTANT FINAL) - Q_PROPERTY(int activeMatchOrdinal READ activeMatchOrdinal CONSTANT FINAL) + Q_PROPERTY(int activeMatch READ activeMatch CONSTANT FINAL) public: int numberOfMatches() const; - int activeMatchOrdinal() const; + int activeMatch() const; QWebEngineFindTextResult(); QWebEngineFindTextResult(const QWebEngineFindTextResult &other); @@ -67,7 +67,7 @@ public: ~QWebEngineFindTextResult(); private: - QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal); + QWebEngineFindTextResult(int numberOfMatches, int activeMatch); QSharedDataPointer d; diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp index effda529f..065fed38f 100644 --- a/src/core/find_text_helper.cpp +++ b/src/core/find_text_helper.cpp @@ -135,7 +135,7 @@ bool FindTextHelper::isFindTextInProgress() const } void FindTextHelper::handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, - const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate) + const gfx::Rect &selectionRect, int activeMatch, bool finalUpdate) { Q_UNUSED(selectionRect); @@ -146,7 +146,7 @@ void FindTextHelper::handleFindReply(content::WebContents *source, int requestId Q_ASSERT(m_currentFindRequestId == requestId); m_lastCompletedFindRequestId = requestId; - m_viewClient->findTextFinished(QWebEngineFindTextResult(numberOfMatches, activeMatchOrdinal)); + m_viewClient->findTextFinished(QWebEngineFindTextResult(numberOfMatches, activeMatch)); invokeResultCallback(requestId, numberOfMatches); } diff --git a/src/core/find_text_helper.h b/src/core/find_text_helper.h index e8f186272..9843dc8b5 100644 --- a/src/core/find_text_helper.h +++ b/src/core/find_text_helper.h @@ -78,7 +78,7 @@ public: void startFinding(const QString &findText, bool caseSensitively, bool findBackward); void stopFinding(); bool isFindTextInProgress() const; - void handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate); + void handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, const gfx::Rect &selectionRect, int activeMatch, bool finalUpdate); void handleLoadCommitted(); private: diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 3a7717bd2..df956f03e 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -1599,7 +1599,7 @@ */ /*! - \qmlproperty int FindTextResult::activeMatchOrdinal + \qmlproperty int FindTextResult::activeMatch \readonly \brief The index of the currently highlighted match. @@ -1607,7 +1607,7 @@ /*! \qmlsignal WebEngineView::findTextFinished(FindTextResult result) - \since QtWebEngine 1.11 + \since QtWebEngine 1.10 This signal is emitted when a string search on a page is completed. \a result is the result of the string search. diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 9f7dfa8ad..321972057 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -279,7 +279,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineFileDialogRequest.dialogReject() --> void" << "QQuickWebEngineFileDialogRequest.mode --> FileMode" << "QWebEngineFindTextResult.numberOfMatches --> int" - << "QWebEngineFindTextResult.activeMatchOrdinal --> int" + << "QWebEngineFindTextResult.activeMatch --> int" << "QQuickWebEngineFormValidationMessageRequest.Hide --> RequestType" << "QQuickWebEngineFormValidationMessageRequest.Move --> RequestType" << "QQuickWebEngineFormValidationMessageRequest.Show --> RequestType" diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml index 040d324e6..c02a1348e 100644 --- a/tests/auto/quick/qmltests/data/tst_findText.qml +++ b/tests/auto/quick/qmltests/data/tst_findText.qml @@ -113,7 +113,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextCaseInsensitive() { @@ -127,7 +127,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextManyMatches() { @@ -141,7 +141,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 100) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } @@ -156,7 +156,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) } function test_findTextNotFound() { @@ -170,7 +170,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) } function test_findTextAfterNotFound() { @@ -184,7 +184,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) webEngineView.url = Qt.resolvedUrl("test1.html") verify(webEngineView.waitForLoadSucceeded()) @@ -195,7 +195,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextInModifiedDOMAfterNotFound() { @@ -212,7 +212,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) runJavaScript("document.body.innerHTML = 'blahellobla'"); tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; }, 20000); @@ -223,7 +223,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextInterruptedByLoad() { @@ -276,7 +276,7 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, i); compare(findTextSpy.signalArguments[i-1][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[i-1][0].activeMatchOrdinal, i); + compare(findTextSpy.signalArguments[i-1][0].activeMatch, i); } // The last match is followed by the fist one. @@ -285,7 +285,7 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1); + compare(findTextSpy.signalArguments[0][0].activeMatch, 1); // The first match is preceded by the last one. webEngineView.clear(); @@ -293,23 +293,23 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 3); + compare(findTextSpy.signalArguments[0][0].activeMatch, 3); - // Finding another word resets the activeMatchOrdinal. + // Finding another word resets the activeMatch. webEngineView.clear(); webEngineView.findText("bar"); findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 2); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1); + compare(findTextSpy.signalArguments[0][0].activeMatch, 1); - // If no match activeMatchOrdinal is 0. + // If no match activeMatch is 0. webEngineView.clear(); webEngineView.findText("bla"); findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0); + compare(findTextSpy.signalArguments[0][0].activeMatch, 0); } } } diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 124dc825f..1b3295abb 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -999,7 +999,7 @@ void tst_QWebEnginePage::findTextResult() if (findTextSpy.count() != 1) return QVector({-1, -1}); auto r = findTextSpy.takeFirst().value(0).value(); - return QVector({ r.numberOfMatches(), r.activeMatchOrdinal() }); + return QVector({ r.numberOfMatches(), r.activeMatch() }); }; // findText will abort in blink if the view has an empty size. @@ -1104,7 +1104,7 @@ void tst_QWebEnginePage::findTextActiveMatchOrdinal() QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), i); + QCOMPARE(result.activeMatch(), i); } // The last match is followed by the fist one. @@ -1112,28 +1112,28 @@ void tst_QWebEnginePage::findTextActiveMatchOrdinal() QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), 1); + QCOMPARE(result.activeMatch(), 1); // The first match is preceded by the last one. m_view->page()->findText("foo", QWebEnginePage::FindBackward); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), 3); + QCOMPARE(result.activeMatch(), 3); - // Finding another word resets the activeMatchOrdinal. + // Finding another word resets the activeMatch. m_view->page()->findText("bar", 0); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 2); - QCOMPARE(result.activeMatchOrdinal(), 1); + QCOMPARE(result.activeMatch(), 1); - // If no match activeMatchOrdinal is 0. + // If no match activeMatch is 0. m_view->page()->findText("bla", 0); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 0); - QCOMPARE(result.activeMatchOrdinal(), 0); + QCOMPARE(result.activeMatch(), 0); } static QWindow *findNewTopLevelWindow(const QWindowList &oldTopLevelWindows) -- cgit v1.2.3 From e23696665cf6e9e7ac848d2125995bae8948e909 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 21 Oct 2019 11:49:59 +0200 Subject: Follow theme settings like Chrome does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set Blink-settings based on Chromium theme settings to match Chrome defaults. Change-Id: I02975c319644583166ed3c5a0eae02975d7b14f1 Fixes: QTBUG-79347 Reviewed-by: Jüri Valdmann --- src/core/web_engine_settings.cpp | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 9bc1279ba..49006ec20 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -53,7 +53,9 @@ #include "content/public/common/webrtc_ip_handling_policy.h" #include "media/base/media_switches.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" +#include "ui/base/ui_base_switches.h" #include "ui/events/event_switches.h" +#include "ui/native_theme/native_theme.h" #include #include @@ -399,6 +401,50 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p prefs->minimum_font_size = fontSize(MinimumFontSize); prefs->minimum_logical_font_size = fontSize(MinimumLogicalFontSize); prefs->default_encoding = defaultTextEncoding().toStdString(); + + // Set the theme colors. Based on chrome_content_browser_client.cc: + const ui::NativeTheme *webTheme = ui::NativeTheme::GetInstanceForWeb(); + if (webTheme) { +#if !defined(OS_MACOSX) + // Mac has a concept of high contrast that does not relate to forced colors. + prefs->forced_colors = webTheme->UsesHighContrastColors() + ? blink::ForcedColors::kActive + : blink::ForcedColors::kNone; +#endif // !defined(OS_MACOSX) + switch (webTheme->GetPreferredColorScheme()) { + case ui::NativeTheme::PreferredColorScheme::kDark: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kDark; + break; + case ui::NativeTheme::PreferredColorScheme::kLight: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kLight; + break; + case ui::NativeTheme::PreferredColorScheme::kNoPreference: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kNoPreference; + } + } + + // Apply native CaptionStyle parameters. + base::Optional style; + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceCaptionStyle)) { + style = ui::CaptionStyle::FromSpec( + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kForceCaptionStyle)); + } + + // Apply system caption style. + if (!style && webTheme) + style = webTheme->GetSystemCaptionStyle(); + + if (style) { + prefs->text_track_background_color = style->background_color; + prefs->text_track_text_color = style->text_color; + prefs->text_track_text_size = style->text_size; + prefs->text_track_text_shadow = style->text_shadow; + prefs->text_track_font_family = style->font_family; + prefs->text_track_font_variant = style->font_variant; + prefs->text_track_window_color = style->window_color; + prefs->text_track_window_padding = style->window_padding; + prefs->text_track_window_radius = style->window_radius; + } } bool WebEngineSettings::applySettingsToRendererPreferences(blink::mojom::RendererPreferences *prefs) -- cgit v1.2.3 From 054967e7749f59172472bab79b5b0a8bc12a9b4e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 30 Sep 2019 17:02:34 +0200 Subject: QML: Use revision 10 for import 1.10 This makes reviewing API etc easier. Change-Id: Ib6cfa74cb130cf1085d6af24eaaa0b9cf403889b Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebenginedownloaditem_p.h | 12 ++++++------ src/webengine/plugin/plugin.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h index 96ef0daf0..beb359622 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p.h @@ -137,10 +137,10 @@ public: Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL) Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL) Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION 7 FINAL) - Q_PROPERTY(QUrl url READ url CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 8 FINAL) - Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 8 FINAL) + Q_PROPERTY(QUrl url READ url CONSTANT REVISION 10 FINAL) + Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 10 FINAL) + Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 10 FINAL) + Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 10 FINAL) Q_INVOKABLE void accept(); Q_INVOKABLE void cancel(); @@ -181,8 +181,8 @@ Q_SIGNALS: Q_REVISION(4) void interruptReasonChanged(); Q_REVISION(5) void isFinishedChanged(); Q_REVISION(5) void isPausedChanged(); - Q_REVISION(8) void downloadDirectoryChanged(); - Q_REVISION(8) void downloadFileNameChanged(); + Q_REVISION(10) void downloadDirectoryChanged(); + Q_REVISION(10) void downloadFileNameChanged(); private: QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0); diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index 8ed78f1c4..3acf7d058 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -121,7 +121,7 @@ public: msgUncreatableType("WebEngineDownloadItem")); qmlRegisterUncreatableType(uri, 1, 8, "WebEngineDownloadItem", msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType(uri, 1, 10, "WebEngineDownloadItem", + qmlRegisterUncreatableType(uri, 1, 10, "WebEngineDownloadItem", msgUncreatableType("WebEngineDownloadItem")); qmlRegisterUncreatableType(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest")); qmlRegisterUncreatableType(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest")); -- cgit v1.2.3 From 6a1412e9de450e016fcec87496dfa002e3887814 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 24 Sep 2019 12:57:54 +0200 Subject: Update plugins.qmltypes for 5.14 Task-number: QTBUG-78690 Change-Id: Ieeb9ffc0873b57a2642293d042ae60dd1382fdda Reviewed-by: Kai Koehne Reviewed-by: Allan Sandfeld Jensen --- src/webengine/plugin/plugins.qmltypes | 365 ++++++++++++++++++++++++++++++++-- 1 file changed, 348 insertions(+), 17 deletions(-) diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index 0037861e5..a23d1c3c0 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -4,10 +4,284 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -defaultplatform -dependencies dependencies.json QtWebEngine 1.9' +// 'qmlplugindump -nonrelocatable -defaultplatform -dependencies dependencies.json QtWebEngine 1.10' Module { dependencies: ["QtQuick 2.8"] + Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Enum { + name: "CheckIndexOption" + values: { + "NoOption": 0, + "IndexIsValid": 1, + "DoNotUseParent": 2, + "ParentIsInvalid": 4 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "parent" + type: "QModelIndex" + Parameter { name: "child"; type: "QModelIndex" } + } + Method { + name: "sibling" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "idx"; type: "QModelIndex" } + } + Method { + name: "rowCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "rowCount"; type: "int" } + Method { + name: "columnCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "columnCount"; type: "int" } + Method { + name: "hasChildren" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "hasChildren"; type: "bool" } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + } + Method { + name: "fetchMore" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "canFetchMore" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "flags" + type: "Qt::ItemFlags" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + Parameter { name: "flags"; type: "Qt::MatchFlags" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } Component { name: "QQuickWebEngineAction" prototype: "QObject" @@ -202,6 +476,7 @@ Module { prototype: "QObject" exports: [ "QtWebEngine/WebEngineDownloadItem 1.1", + "QtWebEngine/WebEngineDownloadItem 1.10", "QtWebEngine/WebEngineDownloadItem 1.2", "QtWebEngine/WebEngineDownloadItem 1.3", "QtWebEngine/WebEngineDownloadItem 1.4", @@ -211,7 +486,7 @@ Module { "QtWebEngine/WebEngineDownloadItem 1.8" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] + exportMetaObjectRevisions: [0, 10, 1, 2, 3, 4, 5, 6, 7] Enum { name: "DownloadState" values: { @@ -294,12 +569,18 @@ Module { isReadonly: true isPointer: true } + Property { name: "url"; revision: 10; type: "QUrl"; isReadonly: true } + Property { name: "suggestedFileName"; revision: 10; type: "string"; isReadonly: true } + Property { name: "downloadDirectory"; revision: 10; type: "string" } + Property { name: "downloadFileName"; revision: 10; type: "string" } Signal { name: "savePageFormatChanged"; revision: 2 } Signal { name: "mimeTypeChanged"; revision: 1 } Signal { name: "typeChanged"; revision: 3 } Signal { name: "interruptReasonChanged"; revision: 4 } Signal { name: "isFinishedChanged"; revision: 5 } Signal { name: "isPausedChanged"; revision: 5 } + Signal { name: "downloadDirectoryChanged"; revision: 10 } + Signal { name: "downloadFileNameChanged"; revision: 10 } Method { name: "accept" } Method { name: "cancel" } Method { name: "pause" } @@ -625,10 +906,11 @@ Module { "QtWebEngine/WebEngineSettings 1.5", "QtWebEngine/WebEngineSettings 1.6", "QtWebEngine/WebEngineSettings 1.7", - "QtWebEngine/WebEngineSettings 1.8" + "QtWebEngine/WebEngineSettings 1.8", + "QtWebEngine/WebEngineSettings 1.9" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] + exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7, 8] Enum { name: "UnknownUrlSchemePolicy" values: { @@ -703,6 +985,25 @@ Module { isPointer: true } } + Component { + name: "QQuickWebEngineTooltipRequest" + prototype: "QObject" + exports: ["QtWebEngine/TooltipRequest 1.10"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "RequestType" + values: { + "Show": 0, + "Hide": 1 + } + } + Property { name: "x"; type: "int"; isReadonly: true } + Property { name: "y"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string"; isReadonly: true } + Property { name: "type"; type: "RequestType"; isReadonly: true } + Property { name: "accepted"; type: "bool" } + } Component { name: "QQuickWebEngineView" defaultProperty: "data" @@ -710,6 +1011,7 @@ Module { exports: [ "QtWebEngine/WebEngineView 1.0", "QtWebEngine/WebEngineView 1.1", + "QtWebEngine/WebEngineView 1.10", "QtWebEngine/WebEngineView 1.2", "QtWebEngine/WebEngineView 1.3", "QtWebEngine/WebEngineView 1.4", @@ -719,7 +1021,7 @@ Module { "QtWebEngine/WebEngineView 1.8", "QtWebEngine/WebEngineView 1.9" ] - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + exportMetaObjectRevisions: [0, 1, 10, 2, 3, 4, 5, 6, 7, 8, 9] Enum { name: "NavigationRequestAction" values: { @@ -735,7 +1037,8 @@ Module { "FormSubmittedNavigation": 2, "BackForwardNavigation": 3, "ReloadNavigation": 4, - "OtherNavigation": 5 + "OtherNavigation": 5, + "RedirectNavigation": 6 } } Enum { @@ -994,6 +1297,14 @@ Module { "Landscape": 1 } } + Enum { + name: "LifecycleState" + values: { + "Active": 0, + "Frozen": 1, + "Discarded": 2 + } + } Property { name: "url"; type: "QUrl" } Property { name: "icon"; type: "QUrl"; isReadonly: true } Property { name: "loading"; type: "bool"; isReadonly: true } @@ -1035,7 +1346,8 @@ Module { Property { name: "webChannelWorld"; revision: 3; type: "uint" } Property { name: "inspectedView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } Property { name: "devToolsView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } - Property { name: "testSupport"; type: "QQuickWebEngineTestSupport"; isPointer: true } + Property { name: "lifecycleState"; revision: 10; type: "LifecycleState" } + Property { name: "recommendedState"; revision: 10; type: "LifecycleState"; isReadonly: true } Signal { name: "loadingChanged" Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } @@ -1194,6 +1506,26 @@ Module { isPointer: true } } + Signal { + name: "tooltipRequested" + revision: 10 + Parameter { name: "request"; type: "QQuickWebEngineTooltipRequest"; isPointer: true } + } + Signal { + name: "lifecycleStateChanged" + revision: 10 + Parameter { name: "state"; type: "LifecycleState" } + } + Signal { + name: "recommendedStateChanged" + revision: 10 + Parameter { name: "state"; type: "LifecycleState" } + } + Signal { + name: "findTextFinished" + revision: 10 + Parameter { name: "result"; type: "QWebEngineFindTextResult" } + } Method { name: "runJavaScript" Parameter { type: "string" } @@ -1319,27 +1651,26 @@ Module { Parameter { name: "action"; type: "WebAction" } } } + Component { + name: "QWebEngineFindTextResult" + exports: ["QtWebEngine/FindTextResult 1.10"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "numberOfMatches"; type: "int"; isReadonly: true } + Property { name: "activeMatchOrdinal"; type: "int"; isReadonly: true } + } Component { name: "QWebEngineNotification" prototype: "QObject" exports: ["QtWebEngine/WebEngineNotification 1.9"] isCreatable: false exportMetaObjectRevisions: [0] - Enum { - name: "Direction" - values: { - "LeftToRight": 0, - "RightToLeft": 1, - "DirectionAuto": 2 - } - } Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "icon"; type: "QIcon"; isReadonly: true } Property { name: "title"; type: "string"; isReadonly: true } Property { name: "message"; type: "string"; isReadonly: true } Property { name: "tag"; type: "string"; isReadonly: true } Property { name: "language"; type: "string"; isReadonly: true } - Property { name: "direction"; type: "Direction"; isReadonly: true } + Property { name: "direction"; type: "Qt::LayoutDirection"; isReadonly: true } Signal { name: "closed" } Method { name: "show" } Method { name: "click" } -- cgit v1.2.3 From b3f9b66e6b43087873c7fc6518c0197201fd04c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Thu, 17 Oct 2019 10:31:35 +0200 Subject: Leave DCHECKs on when configured with -force-asserts Change-Id: I92d84285f7b5dcfe4178b2ed393f192c161c57c7 Reviewed-by: Allan Sandfeld Jensen --- src/buildtools/config/common.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri index 23a134774..97d39535c 100644 --- a/src/buildtools/config/common.pri +++ b/src/buildtools/config/common.pri @@ -137,3 +137,5 @@ qtConfig(webengine-kerberos) { ccache { gn_args += cc_wrapper=\"ccache\" } + +qtConfig(force_asserts): gn_args += dcheck_always_on=true -- cgit v1.2.3 From 229621361562d0e89aeb5f2d2f0ace0115bf164c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 2 Oct 2019 16:23:09 +0200 Subject: Merge remote-tracking branch 'origin/5.13' into 5.14 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conflicts: examples/webengine/minimal/main.cpp src/3rdparty src/core/net/url_request_custom_job.cpp tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp Change-Id: I33994024a4be5ed787800c5718a0a443b970c36d Reviewed-by: Jüri Valdmann --- examples/webengine/customdialogs/main.cpp | 3 +- examples/webengine/minimal/main.cpp | 3 +- examples/webengine/quicknanobrowser/main.cpp | 3 +- examples/webengine/recipebrowser/main.cpp | 3 +- examples/webengine/webengineaction/main.cpp | 4 +- src/core/api/qtwebenginecoreglobal.cpp | 2 +- src/core/content_browser_client_qt.cpp | 2 +- src/core/net/url_request_custom_job.cpp | 20 ++-- src/webengine/api/qtwebengineglobal.cpp | 15 ++- src/webenginewidgets/api/qwebenginepage.cpp | 9 +- tests/auto/quick/dialogs/tst_dialogs.cpp | 5 +- tests/auto/quick/shared/util.h | 12 +++ .../qwebengineprofile/tst_qwebengineprofile.cpp | 109 +++++++++++++++++++++ 13 files changed, 162 insertions(+), 28 deletions(-) diff --git a/examples/webengine/customdialogs/main.cpp b/examples/webengine/customdialogs/main.cpp index 82a3eca63..5aad8affb 100644 --- a/examples/webengine/customdialogs/main.cpp +++ b/examples/webengine/customdialogs/main.cpp @@ -67,9 +67,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - Application app(argc, argv); QtWebEngine::initialize(); + Application app(argc, argv); + QQmlApplicationEngine engine; Server *server = new Server(&engine); diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp index 8bcd0e0e9..86109f97a 100644 --- a/examples/webengine/minimal/main.cpp +++ b/examples/webengine/minimal/main.cpp @@ -57,9 +57,8 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); - QGuiApplication app(argc, argv); - QtWebEngine::initialize(); + QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/examples/webengine/quicknanobrowser/main.cpp b/examples/webengine/quicknanobrowser/main.cpp index 8d032f5d8..d09abba3c 100644 --- a/examples/webengine/quicknanobrowser/main.cpp +++ b/examples/webengine/quicknanobrowser/main.cpp @@ -80,11 +80,10 @@ int main(int argc, char **argv) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QtWebEngine::initialize(); Application app(argc, argv); - QtWebEngine::initialize(); - QQmlApplicationEngine appEngine; Utils utils; appEngine.rootContext()->setContextProperty("utils", &utils); diff --git a/examples/webengine/recipebrowser/main.cpp b/examples/webengine/recipebrowser/main.cpp index 6e6d69804..e61b9e0f5 100644 --- a/examples/webengine/recipebrowser/main.cpp +++ b/examples/webengine/recipebrowser/main.cpp @@ -58,9 +58,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); QtWebEngine::initialize(); + QGuiApplication app(argc, argv); + QQuickStyle::setStyle(QStringLiteral("Material")); QQmlApplicationEngine engine; diff --git a/examples/webengine/webengineaction/main.cpp b/examples/webengine/webengineaction/main.cpp index ce723a99b..f2dec9655 100644 --- a/examples/webengine/webengineaction/main.cpp +++ b/examples/webengine/webengineaction/main.cpp @@ -56,10 +56,10 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QtWebEngine::initialize(); + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 0fddacb15..b27de4c23 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -108,7 +108,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() QCoreApplication *app = QCoreApplication::instance(); if (!app) { - qFatal("QtWebEngine::initialize() must be called after the construction of the application object."); + qFatal("QtWebEngine::initialize() but no core application instance."); return; } diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 6fcd9ad5b..29b6e09ed 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -252,7 +252,7 @@ void ShareGroupQtQuick::AboutToAddFirstContext() // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) { - qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); + qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function before QCoreApplication is created."); } m_shareContextQtQuick = new QtShareGLContext(shareContext); #endif diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 56ba79f35..0e640766f 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -41,6 +41,7 @@ #include "url_request_custom_job_proxy.h" #include "api/qwebengineurlscheme.h" + #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" @@ -146,17 +147,22 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) { // Based on net::URLRequestRedirectJob::StartAsync() - if (!m_corsEnabled) + if (m_error) return; std::string headers; - headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); - if (m_redirect.is_valid()) + if (m_redirect.is_valid()) { + headers += "HTTP/1.1 303 See Other\n"; headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); - std::string origin; - if (request_->extra_request_headers().GetHeader("Origin", &origin)) { - headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin.c_str()); - headers += "Access-Control-Allow-Credentials: true\n"; + } else { + headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); + } + if (m_corsEnabled) { + std::string origin; + if (request_->extra_request_headers().GetHeader("Origin", &origin)) { + headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin.c_str()); + headers += "Access-Control-Allow-Credentials: true\n"; + } } info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(headers)); diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index a11618dba..4346832c9 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qtwebengineglobal.h" +#include namespace QtWebEngineCore { @@ -62,8 +63,8 @@ namespace QtWebEngine { /*! \fn QtWebEngine::initialize() - Sets up an OpenGL Context that can be shared between threads. This has to be done after - QGuiApplication is created, but before a Qt Quick window is created. + Sets up an OpenGL Context that can be shared between threads. This has to be done before + QGuiApplication is created and before window's QPlatformOpenGLContext is created. This has the same effect as setting the Qt::AA_ShareOpenGLContexts attribute with QCoreApplication::setAttribute before constructing @@ -71,7 +72,15 @@ namespace QtWebEngine { */ void initialize() { - QtWebEngineCore::initialize(); + QCoreApplication *app = QCoreApplication::instance(); + if (app) { + qWarning("QtWebEngine::initialize() called with QCoreApplication object already created and should be call before. "\ + "This is depreciated and may fail in the future."); + QtWebEngineCore::initialize(); + return; + } + // call initialize the same way as widgets do + qAddPreRoutine(QtWebEngineCore::initialize); } } // namespace QtWebEngine diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index db3efa521..524df0425 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2671,16 +2671,13 @@ void QContextMenuBuilder::addMenuItem(ContextMenuItem menuItem) switch (menuItem) { case ContextMenuItem::Back: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), QWebEnginePage::tr("&Back"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::back); + action = thisRef->action(QWebEnginePage::Back); break; case ContextMenuItem::Forward: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), QWebEnginePage::tr("&Forward"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::forward); + action = thisRef->action(QWebEnginePage::Forward); break; case ContextMenuItem::Reload: - action = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), QWebEnginePage::tr("&Reload"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::reload); + action = thisRef->action(QWebEnginePage::Reload); break; case ContextMenuItem::Cut: action = thisRef->action(QWebEnginePage::Cut); diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp index eee6b2bb6..82ea3be37 100644 --- a/tests/auto/quick/dialogs/tst_dialogs.cpp +++ b/tests/auto/quick/dialogs/tst_dialogs.cpp @@ -28,6 +28,7 @@ #include "testhandler.h" #include "server.h" +#include "util.h" #include #include #include @@ -43,6 +44,7 @@ class tst_Dialogs : public QObject { public: tst_Dialogs(){} + private slots: void initTestCase(); void init(); @@ -64,7 +66,6 @@ private: void tst_Dialogs::initTestCase() { - QtWebEngine::initialize(); QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true); qmlRegisterType("io.qt.tester", 1, 0, "TestHandler"); m_engine.reset(new QQmlApplicationEngine()); @@ -230,5 +231,5 @@ void tst_Dialogs::javaScriptDialogRequested() } #include "tst_dialogs.moc" -QTEST_MAIN(tst_Dialogs) +W_QTEST_MAIN(tst_Dialogs) diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h index c2e7d3e19..bc5ae445b 100644 --- a/tests/auto/quick/shared/util.h +++ b/tests/auto/quick/shared/util.h @@ -36,6 +36,7 @@ #include #include #include +#include #if !defined(TESTS_SOURCE_DIR) #define TESTS_SOURCE_DIR "" @@ -182,4 +183,15 @@ inline QString activeElementId(QQuickWebEngineView *webEngineView) return arguments.at(1).toString(); } +#define W_QTEST_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QtWebEngine::initialize(); \ + QGuiApplication app(argc, argv); \ + app.setAttribute(Qt::AA_Use96Dpi, true); \ + TestObject tc; \ + QTEST_SET_MAIN_SOURCE_PATH \ + return QTest::qExec(&tc, argc, argv); \ +} #endif /* UTIL_H */ + diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 25afa5849..3e92385d0 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -40,6 +40,11 @@ #include #include +#if QT_CONFIG(webengine_webchannel) +#include +#endif + +#include #include class tst_QWebEngineProfile : public QObject @@ -60,6 +65,7 @@ private Q_SLOTS: void urlSchemeHandlerStreaming(); void urlSchemeHandlerRequestHeaders(); void urlSchemeHandlerInstallation(); + void urlSchemeHandlerXhrStatus(); void customUserAgent(); void httpAcceptLanguage(); void downloadItem(); @@ -575,6 +581,109 @@ void tst_QWebEngineProfile::urlSchemeHandlerInstallation() profile.removeUrlScheme("tst"); } +#if QT_CONFIG(webengine_webchannel) +class XhrStatusHost : public QObject +{ + Q_OBJECT +public: + std::map requests; + + bool isReady() + { + static const auto sig = QMetaMethod::fromSignal(&XhrStatusHost::load); + return isSignalConnected(sig); + } + +Q_SIGNALS: + void load(QUrl url); + +public Q_SLOTS: + void loadFinished(QUrl url, int status) + { + requests[url] = status; + } + +private: +}; + +class XhrStatusUrlSchemeHandler : public QWebEngineUrlSchemeHandler +{ +public: + void requestStarted(QWebEngineUrlRequestJob *job) + { + QString path = job->requestUrl().path(); + if (path == "/") { + QBuffer *buffer = new QBuffer(job); + buffer->open(QBuffer::ReadWrite); + buffer->write(QByteArrayLiteral(R"( + + + + + + +)")); + buffer->seek(0); + job->reply("text/html", buffer); + } else if (path == "/qwebchannel.js") { + QFile *file = new QFile(":/qtwebchannel/qwebchannel.js", job); + file->open(QFile::ReadOnly); + job->reply("application/javascript", file); + } else if (path == "/ok") { + QBuffer *buffer = new QBuffer(job); + buffer->buffer() = QByteArrayLiteral("ok"); + job->reply("text/plain", buffer); + } else if (path == "/redirect") { + QUrl url = job->requestUrl(); + url.setPath("/ok"); + job->redirect(url); + } else if (path == "/fail") { + job->fail(QWebEngineUrlRequestJob::RequestFailed); + } else { + job->fail(QWebEngineUrlRequestJob::UrlNotFound); + } + } +}; +#endif + +void tst_QWebEngineProfile::urlSchemeHandlerXhrStatus() +{ +#if QT_CONFIG(webengine_webchannel) + XhrStatusUrlSchemeHandler handler; + XhrStatusHost host; + QWebEngineProfile profile; + QWebEnginePage page(&profile); + QWebChannel channel; + channel.registerObject("host", &host); + profile.installUrlSchemeHandler("aviancarrier", &handler); + page.setWebChannel(&channel); + page.load(QUrl("aviancarrier:/")); + QTRY_VERIFY(host.isReady()); + host.load(QUrl("aviancarrier:/ok")); + host.load(QUrl("aviancarrier:/redirect")); + host.load(QUrl("aviancarrier:/fail")); + host.load(QUrl("aviancarrier:/notfound")); + QTRY_COMPARE(host.requests.size(), 4u); + QCOMPARE(host.requests[QUrl("aviancarrier:/ok")], 200); + QCOMPARE(host.requests[QUrl("aviancarrier:/redirect")], 200); + QCOMPARE(host.requests[QUrl("aviancarrier:/fail")], -1); + QCOMPARE(host.requests[QUrl("aviancarrier:/notfound")], -1); +#else + QSKIP("No QtWebChannel"); +#endif +} + void tst_QWebEngineProfile::customUserAgent() { QString defaultUserAgent = QWebEngineProfile::defaultProfile()->httpUserAgent(); -- cgit v1.2.3 From dbbf4c11713a268030b552b3063b1c2a3a397793 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 21 Oct 2019 16:09:28 +0200 Subject: Add HTTP content-type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some code only checks the http content type and not the job mimetype. Change-Id: I7a2b2f5d30c2f349f2570f0422ce415eebd0f644 Fixes: QTBUG-79319 Reviewed-by: Jüri Valdmann --- src/core/net/url_request_custom_job.cpp | 6 +++++ .../qwebengineprofile/tst_qwebengineprofile.cpp | 30 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 0e640766f..8f0fada57 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -156,6 +156,12 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); } else { headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); + if (m_mimeType.size() > 0) { + headers += base::StringPrintf("Content-Type: %s", m_mimeType.c_str()); + if (m_charset.size() > 0) + headers += base::StringPrintf("; charset=%s", m_charset.c_str()); + headers += "\n"; + } } if (m_corsEnabled) { std::string origin; diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 3e92385d0..a7a5ba62a 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -66,6 +66,7 @@ private Q_SLOTS: void urlSchemeHandlerRequestHeaders(); void urlSchemeHandlerInstallation(); void urlSchemeHandlerXhrStatus(); + void urlSchemeHandlerScriptModule(); void customUserAgent(); void httpAcceptLanguage(); void downloadItem(); @@ -86,6 +87,7 @@ void tst_QWebEngineProfile::initTestCase() stream.setDefaultPort(8080); letterto.setSyntax(QWebEngineUrlScheme::Syntax::Path); aviancarrier.setSyntax(QWebEngineUrlScheme::Syntax::Path); + aviancarrier.setFlags(QWebEngineUrlScheme::CorsEnabled); QWebEngineUrlScheme::registerScheme(foo); QWebEngineUrlScheme::registerScheme(stream); QWebEngineUrlScheme::registerScheme(letterto); @@ -684,6 +686,34 @@ void tst_QWebEngineProfile::urlSchemeHandlerXhrStatus() #endif } +class ScriptsUrlSchemeHandler : public QWebEngineUrlSchemeHandler +{ +public: + void requestStarted(QWebEngineUrlRequestJob *job) + { + auto *script = new QBuffer(job); + script->setData(QByteArrayLiteral("window.test = 'SUCCESS';")); + job->reply("text/javascript", script); + } +}; + +void tst_QWebEngineProfile::urlSchemeHandlerScriptModule() +{ + ScriptsUrlSchemeHandler handler; + QWebEngineProfile profile; + profile.installUrlSchemeHandler("aviancarrier", &handler); + QWebEnginePage page(&profile); + QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool))); + page.setHtml(QStringLiteral("Test1")); + QTRY_COMPARE(loadFinishedSpy.count(), 1); + QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("test")).toString(), QStringLiteral("SUCCESS")); + + loadFinishedSpy.clear(); + page.setHtml(QStringLiteral("Test2")); + QTRY_COMPARE(loadFinishedSpy.count(), 1); + QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("test")).toString(), QStringLiteral("SUCCESS")); +} + void tst_QWebEngineProfile::customUserAgent() { QString defaultUserAgent = QWebEngineProfile::defaultProfile()->httpUserAgent(); -- cgit v1.2.3 From fc0dbde7345c37207a54eea04c67ee9160c86134 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 21 Oct 2019 14:45:44 +0200 Subject: Speculatively prepare for even slower CI Bumb up timeouts to even more higher levels to accommodate even slower CI instances. Task-number: QTBUG-79290 Change-Id: I33a4660165f72837273c3089092687a8962c83ba Reviewed-by: Michal Klocek --- .../quick/inspectorserver/tst_inspectorserver.cpp | 2 +- .../certificateerror/tst_certificateerror.cpp | 14 ++++----- tests/auto/widgets/devtools/tst_devtools.cpp | 4 +-- .../widgets/faviconmanager/tst_faviconmanager.cpp | 34 +++++++++++----------- .../qwebenginescript/tst_qwebenginescript.cpp | 16 +++++----- .../widgets/qwebengineview/tst_qwebengineview.cpp | 2 +- tests/auto/widgets/util.h | 2 +- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp index 922c7769e..224814f7e 100644 --- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp +++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp @@ -167,7 +167,7 @@ void tst_InspectorServer::openRemoteDebuggingSession() // - The page list didn't return a valid inspector URL // - Or the front-end couldn't be loaded through the inspector HTTP server // - Or the web socket connection couldn't be established between the front-end and the page through the inspector server - QTRY_VERIFY_WITH_TIMEOUT(inspectorWebView->title().startsWith("DevTools -"), 20000); + QTRY_VERIFY_WITH_TIMEOUT(inspectorWebView->title().startsWith("DevTools -"), 30000); } QTEST_MAIN(tst_InspectorServer) diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp index 109c69cd7..f11d9236c 100644 --- a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp +++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp @@ -48,13 +48,13 @@ private Q_SLOTS: struct PageWithCertificateErrorHandler : QWebEnginePage { PageWithCertificateErrorHandler(bool defer, bool accept, QObject *p = nullptr) - : QWebEnginePage(p), deferError(defer), acceptCertificate(accept) { - connect(this, &QWebEnginePage::loadFinished, [&] (bool result) { spyLoad(result); }); + : QWebEnginePage(p), deferError(defer), acceptCertificate(accept) + , loadSpy(this, &QWebEnginePage::loadFinished) { } bool deferError, acceptCertificate; - CallbackSpy spyLoad; + QSignalSpy loadSpy; QScopedPointer error; bool certificateError(const QWebEngineCertificateError &e) override { @@ -104,7 +104,7 @@ void tst_CertificateError::handleError() if (deferError) { QVERIFY(page.error->deferred()); QVERIFY(!page.error->answered()); - QVERIFY(!page.spyLoad.wasCalled()); + QCOMPARE(page.loadSpy.count(), 0); QCOMPARE(toPlainTextSync(&page), QString()); if (acceptCertificate) @@ -115,10 +115,8 @@ void tst_CertificateError::handleError() QVERIFY(page.error->answered()); page.error.reset(); } - - bool loadResult = page.spyLoad.waitForResult(); - QVERIFY(page.spyLoad.wasCalled()); - QCOMPARE(loadResult, acceptCertificate); + QTRY_COMPARE_WITH_TIMEOUT(page.loadSpy.count(), 1, 30000); + QCOMPARE(page.loadSpy.takeFirst().value(0).toBool(), acceptCertificate); QCOMPARE(toPlainTextSync(&page), expectedContent); } diff --git a/tests/auto/widgets/devtools/tst_devtools.cpp b/tests/auto/widgets/devtools/tst_devtools.cpp index 8f3b90a14..3026b3931 100644 --- a/tests/auto/widgets/devtools/tst_devtools.cpp +++ b/tests/auto/widgets/devtools/tst_devtools.cpp @@ -46,7 +46,7 @@ void tst_DevTools::attachAndDestroyPageFirst() QSignalSpy spy(page, &QWebEnginePage::loadFinished); page->load(QUrl("data:text/plain,foobarbaz")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 12000); inspector->setInspectedPage(page); page->triggerAction(QWebEnginePage::InspectElement); @@ -67,7 +67,7 @@ void tst_DevTools::attachAndDestroyInspectorFirst() QSignalSpy spy(page, &QWebEnginePage::loadFinished); page->setHtml(QStringLiteral("

FOO BAR!

")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 12000); page->triggerAction(QWebEnginePage::InspectElement); diff --git a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp index 540c8d505..1469ddb15 100644 --- a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp +++ b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp @@ -107,7 +107,7 @@ void tst_FaviconManager::faviconLoad() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-single.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -132,7 +132,7 @@ void tst_FaviconManager::faviconLoadFromResources() QUrl url("qrc:/resources/favicon-single.html"); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -161,7 +161,7 @@ void tst_FaviconManager::faviconLoadEncodedUrl() QUrl url(urlString + QLatin1String("?favicon=load should work with#whitespace!")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -189,7 +189,7 @@ void tst_FaviconManager::noFavicon() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/test1.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -206,7 +206,7 @@ void tst_FaviconManager::aboutBlank() QUrl url("about:blank"); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -226,7 +226,7 @@ void tst_FaviconManager::unavailableFavicon() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-unavailable.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -245,7 +245,7 @@ void tst_FaviconManager::errorPageEnabled() QUrl url("http://url.invalid"); m_page->load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -264,7 +264,7 @@ void tst_FaviconManager::errorPageDisabled() QUrl url("http://url.invalid"); m_page->load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 12000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -288,7 +288,7 @@ void tst_FaviconManager::bestFavicon() url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-misc.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -311,7 +311,7 @@ void tst_FaviconManager::bestFavicon() url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-shortcut.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_VERIFY(iconUrlChangedSpy.count() >= 1); QTRY_VERIFY(iconChangedSpy.count() >= 1); @@ -347,7 +347,7 @@ void tst_FaviconManager::touchIcon() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-touch.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -367,7 +367,7 @@ void tst_FaviconManager::multiIcon() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-multi.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -395,7 +395,7 @@ void tst_FaviconManager::candidateIcon() QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("faviconmanager/resources/favicon-shortcut.html")); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -432,7 +432,7 @@ void tst_FaviconManager::downloadIconsDisabled() m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -465,7 +465,7 @@ void tst_FaviconManager::downloadTouchIconsEnabled() m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -494,7 +494,7 @@ void tst_FaviconManager::dynamicFavicon() m_page->setHtml("" "" ""); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QTRY_COMPARE(iconUrlChangedSpy.count(), 1); QTRY_COMPARE(iconChangedSpy.count(), 1); @@ -525,7 +525,7 @@ void tst_FaviconManager::touchIconWithSameURL() QTRY_COMPARE(loadFinishedSpy.count(), 1); // The default favicon has to be loaded even if its URL is also set as a touch icon while touch icons are disabled. - QTRY_COMPARE(iconUrlChangedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(m_page->iconUrl().toString(), icon); QTRY_COMPARE(iconChangedSpy.count(), 1); diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp index 2e8687d9b..2044f0df4 100644 --- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp +++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp @@ -180,23 +180,23 @@ void tst_QWebEngineScript::loadEvents() // Single frame / setHtml page.setHtml(QStringLiteral("mr")); - QTRY_COMPARE(page.spy.count(), 1); - QCOMPARE(page.spy.takeFirst().value(0).toBool(), true); + QTRY_COMPARE_WITH_TIMEOUT(page.spy.count(), 1, 20000); + QVERIFY(page.spy.takeFirst().value(0).toBool()); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList())); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList())); // After discard page.setLifecycleState(QWebEnginePage::LifecycleState::Discarded); page.setLifecycleState(QWebEnginePage::LifecycleState::Active); - QTRY_COMPARE(page.spy.count(), 1); - QCOMPARE(page.spy.takeFirst().value(0).toBool(), true); + QTRY_COMPARE_WITH_TIMEOUT(page.spy.count(), 1, 20000); + QVERIFY(page.spy.takeFirst().value(0).toBool()); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList())); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList())); // Multiple frames page.load(QUrl("qrc:/resources/test_iframe_main.html")); - QTRY_COMPARE(page.spy.count(), 1); - QCOMPARE(page.spy.takeFirst().value(0).toBool(), true); + QTRY_COMPARE_WITH_TIMEOUT(page.spy.count(), 1, 20000); + QVERIFY(page.spy.takeFirst().value(0).toBool()); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList())); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList())); QVERIFY(verifyOrder(page.eval("window[0].log", QWebEngineScript::MainWorld).toStringList())); @@ -207,14 +207,14 @@ void tst_QWebEngineScript::loadEvents() // Cross-process navigation page.load(QUrl("chrome://gpu")); QTRY_COMPARE_WITH_TIMEOUT(page.spy.count(), 1, 20000); - QCOMPARE(page.spy.takeFirst().value(0).toBool(), true); + QVERIFY(page.spy.takeFirst().value(0).toBool()); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList())); QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList())); // Using window.open from JS QVERIFY(profile.pages.size() == 1); page.load(QUrl("qrc:/resources/test_window_open.html")); - QTRY_VERIFY(profile.pages.size() == 2); + QTRY_COMPARE(profile.pages.size(), 2); QTRY_COMPARE(profile.pages.front().spy.count(), 1); QTRY_COMPARE(profile.pages.back().spy.count(), 1); QVERIFY(verifyOrder(profile.pages.front().eval("window.log", QWebEngineScript::MainWorld).toStringList())); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 71c4aa9b5..abf414eb9 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -3125,7 +3125,7 @@ void tst_QWebEngineView::webUIURLs() view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool))); view.load(url); - QVERIFY(loadFinishedSpy.wait()); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 12000); QCOMPARE(loadFinishedSpy.takeFirst().at(0).toBool(), supported); } diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h index f27466225..eba974f33 100644 --- a/tests/auto/widgets/util.h +++ b/tests/auto/widgets/util.h @@ -85,7 +85,7 @@ public: T waitForResult() { if (!called) { - timeoutTimer.start(10000); + timeoutTimer.start(20000); eventLoop.exec(); } return result; -- cgit v1.2.3 From 9bba6cf6ebdb1f174312d447711f3a9a2d33fbe2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 21 Oct 2019 10:15:53 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: b5d06a458283 [Backport] Security issue 946978 [1/2] 4f553e3a0c62 [Backport] Security issue 946978 [2/2] 32d77d99be3f [Backport] CVE-2019-13674 2a45953d844a [Backport] CVE-2019-13675 2708f4fe1f1a [Backport] Plumb initiating origin info to download stack. 1d21cbce407f [Backport] CVE-2019-13678/CVE-2019-13681 0da18c7f04e3 [Backport] Security issue 960354 4e50fd02436d [Backport] Security issue 973628 9e3becc64121 [Backport] Security issue 979373 729e9b30bbf2 [Backport] Security issue 981459 28150e5eb962 [Backport] Security issue 981597 843d70ac87de [Backport] Security issue 971904 Fixes: QTBUG-79193 Change-Id: Ic90455446f79500d5971a975e2a04344f65238ac Reviewed-by: Michael Brüning --- src/3rdparty | 2 +- src/core/content_browser_client_qt.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty b/src/3rdparty index 18d4c6e82..843d70ac8 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 18d4c6e8250324d084d89b17ad80721bb46ddbd9 +Subproject commit 843d70ac87de7482c1c1195aa73899bc05efc8f3 diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 04a8fc363..6d1bf07a9 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -196,7 +196,7 @@ public: void* GetHandle() override { return m_handle; } // Qt currently never creates contexts using robustness attributes. - bool WasAllocatedUsingRobustnessExtension() override { return false; } + unsigned int CheckStickyGraphicsResetStatus() override { return 0 /*GL_NO_ERROR*/; } // We don't care about the rest, this context shouldn't be used except for its handle. bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override { Q_UNREACHABLE(); return false; } -- cgit v1.2.3 From 49e660a9e8e47c9cd81bb38f2b74575e7de50aca Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Thu, 17 Oct 2019 18:04:51 +0200 Subject: Track request interceptor destroy and update profile io data accordingly On destroy profile level interceptor is cleaned through QPointer in ProfileAdapter but not in ProfileIOData where it is stored as a raw pointer and used by NetworkDelegateQt. Track 'destroyed' signal and clean it from ProfileIOData, which resolves these issues after interceptor is deleted without explicitly being reset in profile: - for deprecated 'setRequestInterceptor': one of possible access violation in NetworkDelegateQt::OnBeforeURLRequest - for setUrlRequestInterceptor: sending URLRequestNotification for every url request after interceptor is deleted Fixes: QTBUG-79156 Change-Id: Ie2dd3f0909bc45748278c5f97c5c2701742591b5 Reviewed-by: Michal Klocek --- src/core/profile_adapter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index ebb533206..dbe76f0d1 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -179,7 +179,16 @@ void ProfileAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *inte { if (m_requestInterceptor == interceptor) return; + + if (m_requestInterceptor) + disconnect(m_requestInterceptor, &QObject::destroyed, this, nullptr); m_requestInterceptor = interceptor; + if (m_requestInterceptor) + connect(m_requestInterceptor, &QObject::destroyed, this, [this] () { + m_profile->m_profileIOData->updateRequestInterceptor(); + Q_ASSERT(!m_profile->m_profileIOData->requestInterceptor()); + }); + if (m_profile->m_urlRequestContextGetter.get()) m_profile->m_profileIOData->updateRequestInterceptor(); } -- cgit v1.2.3 From 556576b55f6b4404c71c74a5ef8e21f87ed09854 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Mon, 14 Oct 2019 10:28:55 +0300 Subject: Add changes file for Qt 5.13.2 Change-Id: I623b33e2b3c4bb6efd6cf9fd105266637dcb0e3b Reviewed-by: Leena Miettinen --- dist/changes-5.13.2 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 dist/changes-5.13.2 diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2 new file mode 100644 index 000000000..aeac5b000 --- /dev/null +++ b/dist/changes-5.13.2 @@ -0,0 +1,81 @@ +Qt 5.13.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.13.0 through 5.13.1. + +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.2 Changes * +**************************************************************************** + +General +------- + + - [QTBUG-76329] Fixes extensions and PDF viewer when building with GCC 5. + - [QTBUG-77072, QTBUG-78084] Fixed flashing when closing combo box on + macOS. + - [QTBUG-77827] Fixed unbundling of libjpeg on Linux. + - [QTBUG-77977] Fixed invalid URL on profile change. + - [QTBUG-78016] Fixed crash with desktop sharing. + - [QTBUG-78206] Fixed accessibility events for combo boxes. + - [QTBUG-78316] Fixed XMLHttpRequest status with custom schemes. + + +Chromium +-------- + + - Security fixes from Chromium up to version 77.0.3865.120, including: + + - CVE-2019-5869 + - CVE-2019-5870 + - CVE-2019-5872 + - CVE-2019-5875 + - CVE-2019-5876 + - CVE-2019-13659 + - CVE-2019-13660 + - CVE-2019-13663 + - CVE-2019-13664 + - CVE-2019-13665 + - CVE-2019-13673 + - CVE-2019-13674 + - CVE-2019-13675 + - CVE-2019-13678/CVE-2019-13681 + - CVE-2019-13687 + - CVE-2019-13688 + - CVE-2019-13691 + - CVE-2019-13692 + - CVE-2019-13693 + - CVE-2019-13694 + - CVE-2019-13695 + - CVE-2019-13697 + - Security issue 946351 + - Security issue 946978 + - Security issue 957160 + - Security issue 960354 + - Security issue 964938 + - Security issue 971904 + - Security issue 973628 + - Security issue 974354 + - Security issue 979373 + - Security issue 981459 + - Security issue 981597 + - Security issue 986727 + - Security issue 990234 + +Qt WebEngine Widgets +-------------------- + + - [QTBUG-77209] Fixed QWebEnginePage visibility state. -- cgit v1.2.3 From 73a8a53f6a98f24044f18f403b13dff2fb2645b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Wed, 23 Oct 2019 11:54:23 +0200 Subject: Test XMLHttpRequests to CorsEnabled custom schemes Previously cross-origin XMLHttpRequests could only be made to the builtin CORS-enabled schemes, http, https, data, and chrome. Now we also support extending this set with new custom schemes using the CorsEnabled flag. Fixes: QTBUG-79322 Change-Id: I8628aad2be62013e32708308797712de82ff185b Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/origins/tst_origins.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp index 02d5bfba3..990ca70a7 100644 --- a/tests/auto/widgets/origins/tst_origins.cpp +++ b/tests/auto/widgets/origins/tst_origins.cpp @@ -134,6 +134,13 @@ void registerSchemes() scheme.setFlags(QWebEngineUrlScheme::CorsEnabled); QWebEngineUrlScheme::registerScheme(scheme); } + + { + QWebEngineUrlScheme scheme(QBAL("cors")); + scheme.setFlags(QWebEngineUrlScheme::CorsEnabled); + QWebEngineUrlScheme::registerScheme(scheme); + } + } Q_CONSTRUCTOR_FUNCTION(registerSchemes) @@ -159,6 +166,7 @@ public: profile->installUrlSchemeHandler(QBAL("HostPortAndUserInformationSyntax"), this); profile->installUrlSchemeHandler(QBAL("redirect1"), this); profile->installUrlSchemeHandler(QBAL("redirect2"), this); + profile->installUrlSchemeHandler(QBAL("cors"), this); } QVector &requests() { return m_requests; } @@ -569,7 +577,9 @@ void tst_Origins::mixedSchemesWithCsp() // Load the main page over one scheme, then make an XMLHttpRequest to a // different scheme. // -// XMLHttpRequests can only be made to http, https, data, and chrome. +// Cross-origin XMLHttpRequests can only be made to CORS-enabled schemes. These +// include the builtin schemes http, https, data, and chrome, as well as custom +// schemes with the CorsEnabled flag. void tst_Origins::mixedXHR() { QVERIFY(load(QSL("file:" THIS_DIR "resources/mixedXHR.html"))); @@ -581,6 +591,8 @@ void tst_Origins::mixedXHR() QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("error"))); eval(QSL("sendXHR('data:,ok')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); + eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')")); + QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); QVERIFY(load(QSL("qrc:/resources/mixedXHR.html"))); eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")); @@ -591,6 +603,8 @@ void tst_Origins::mixedXHR() QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("error"))); eval(QSL("sendXHR('data:,ok')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); + eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')")); + QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); QVERIFY(load(QSL("tst:/resources/mixedXHR.html"))); eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")); @@ -601,6 +615,8 @@ void tst_Origins::mixedXHR() QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); eval(QSL("sendXHR('data:,ok')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); + eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')")); + QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); } #if defined(WEBSOCKETS) -- cgit v1.2.3 From 299494acb5563a518032a135c7d7529d7700b0cd Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Wed, 23 Oct 2019 13:03:33 +0200 Subject: Update minimum requirement for ICU version to 64 Set it according to V8_MINIMUM_ICU_VERSION define. Change-Id: If41bb7067570bfc825a214f92883bd0e0caca681 Reviewed-by: Allan Sandfeld Jensen --- src/buildtools/configure.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json index 535d8358b..a36d05320 100644 --- a/src/buildtools/configure.json +++ b/src/buildtools/configure.json @@ -150,9 +150,9 @@ ] }, "webengine-icu": { - "label": "icu >= 63", + "label": "icu >= 64", "sources": [ - { "type": "pkgConfig", "args": "icu-uc >= 63 icu-i18n >= 63" } + { "type": "pkgConfig", "args": "icu-uc >= 64 icu-i18n >= 64" } ] }, "webengine-webp": { -- cgit v1.2.3 From 25ccc01aafcaa74245eecbe98f648a06dc075978 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 23 Oct 2019 12:46:21 +0200 Subject: Adapt to change in DrawQuad::ShouldDrawWithBlending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now we need to pass 'true' as argument to get our special behavior. Change-Id: Ifdf5eb71083441350d5ca4c3971d8930cb724d7c Fixes: QTBUG-78762 Reviewed-by: Jüri Valdmann --- src/core/compositor/delegated_frame_node.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/compositor/delegated_frame_node.cpp b/src/core/compositor/delegated_frame_node.cpp index 2a0df3acd..4d74937d9 100644 --- a/src/core/compositor/delegated_frame_node.cpp +++ b/src/core/compositor/delegated_frame_node.cpp @@ -858,7 +858,7 @@ void DelegatedFrameNode::handleQuad( const viz::TextureDrawQuad *tquad = viz::TextureDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(tquad->resource_id(), resourceTracker); QSGTexture *texture = - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate); + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate); QSizeF textureSize; if (texture) textureSize = texture->textureSize(); @@ -909,7 +909,7 @@ void DelegatedFrameNode::handleQuad( const viz::TileDrawQuad *tquad = viz::TileDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(tquad->resource_id(), resourceTracker); nodeHandler->setupTextureContentNode( - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate), + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate), toQt(quad->rect), toQt(tquad->tex_coord_rect), QSGImageNode::NoTransform, currentLayerChain); break; @@ -930,10 +930,10 @@ void DelegatedFrameNode::handleQuad( aResource = findAndHoldResource(vquad->a_plane_resource_id(), resourceTracker); nodeHandler->setupYUVVideoNode( - initAndHoldTexture(yResource, quad->ShouldDrawWithBlending()), - initAndHoldTexture(uResource, quad->ShouldDrawWithBlending()), - initAndHoldTexture(vResource, quad->ShouldDrawWithBlending()), - aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending()) : 0, + initAndHoldTexture(yResource, quad->ShouldDrawWithBlending(true)), + initAndHoldTexture(uResource, quad->ShouldDrawWithBlending(true)), + initAndHoldTexture(vResource, quad->ShouldDrawWithBlending(true)), + aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending(true)) : 0, toQt(vquad->ya_tex_coord_rect), toQt(vquad->uv_tex_coord_rect), toQt(vquad->ya_tex_size), toQt(vquad->uv_tex_size), vquad->video_color_space, vquad->resource_multiplier, vquad->resource_offset, toQt(quad->rect), @@ -945,7 +945,7 @@ void DelegatedFrameNode::handleQuad( const viz::StreamVideoDrawQuad *squad = viz::StreamVideoDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(squad->resource_id(), resourceTracker); MailboxTexture *texture = static_cast( - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate, GL_TEXTURE_EXTERNAL_OES)); + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate, GL_TEXTURE_EXTERNAL_OES)); QMatrix4x4 qMatrix; // convertToQt(squad->matrix.matrix(), qMatrix); -- cgit v1.2.3 From 696c2d3c3c3c96cad654e17d3c07d7960a095fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Tue, 22 Oct 2019 11:46:36 +0200 Subject: Update Chromium Pulls in the following changes: cd435b32a24 Fix crash on exit on Windows 3a617f46cd9 FIXUP: Bring enable_webrtc back 34662922afe Convert asserts to logs and returns in the PpapiHost 27947d92157 Fix compilation with system ICU e49a67d250a Disable long presentation time DCHECK e9b4b34de81 Remove broken symlinks 134f953c5b4 Apply workarounds to build extensions with gcc 5.3.1 on 77-based c212ffca5c7 Adapt DrawQuad::ShouldDrawWithBlending() to work with both compositors 6e50fb5037b Fixup rtc_use_x11 88a931558e2 FIXUP: Apply workarounds to build extensions with gcc 5.3.1 on 77-based Change-Id: I2bab0f1d3fc2c8a85fe9f4d3ebf47d63024b1a6c Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty b/src/3rdparty index dc5221146..88a931558 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit dc5221146d665f5634fab11fb4c9b5515c1ab079 +Subproject commit 88a931558e2e960eacccb32483713fcc4bbaf433 -- cgit v1.2.3 From bcf346057daa0ababa322c0fe657619bf238d77c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 23 Oct 2019 17:33:44 +0200 Subject: Remove NetworkDelegate access from BrowserMessageFilter This makes the code cleaner and also valid with network-service. Change-Id: I9a26f33c4a26784dc62269e386c0ae271a5c1a05 Reviewed-by: Michal Klocek --- src/core/browser_message_filter_qt.cpp | 23 +++++++++-------------- src/core/browser_message_filter_qt.h | 4 +++- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index c8fc88017..a4b75f075 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -40,19 +40,19 @@ #include "browser_message_filter_qt.h" #include "chrome/browser/profiles/profile.h" -#include "common/qt_messages.h" #include "content/public/browser/plugin_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" -#include "type_conversion.h" -#include "net/network_delegate_qt.h" +#include "common/qt_messages.h" +#include "profile_io_data_qt.h" +#include "type_conversion.h" namespace QtWebEngineCore { BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/, Profile *profile) : BrowserMessageFilter(QtMsgStart) - , m_profile(profile) + , m_profileData(ProfileIODataQt::FromBrowserContext(profile)) { } @@ -81,8 +81,7 @@ void BrowserMessageFilterQt::OnAllowDatabase(int /*render_frame_id*/, const GURL &top_origin_url, bool* allowed) { - NetworkDelegateQt *networkDelegate = static_cast(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/, @@ -91,8 +90,7 @@ void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/, bool /*local*/, bool *allowed) { - NetworkDelegateQt *networkDelegate = static_cast(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/, @@ -100,8 +98,7 @@ void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/, const GURL &top_origin_url, bool *allowed) { - NetworkDelegateQt *networkDelegate = static_cast(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnRequestFileSystemAccessSync(int render_frame_id, @@ -153,9 +150,7 @@ void BrowserMessageFilterQt::OnRequestFileSystemAccess(int /*render_frame_id*/, base::Callback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - - NetworkDelegateQt *networkDelegate = static_cast(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - bool allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + bool allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); callback.Run(allowed); } diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index 3963fb9d5..4abc612f8 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -49,6 +49,8 @@ class Profile; namespace QtWebEngineCore { +class ProfileIODataQt; + class BrowserMessageFilterQt : public content::BrowserMessageFilter { public: @@ -91,7 +93,7 @@ private: const GURL &top_origin_url, base::Callback callback); - Profile *m_profile; + ProfileIODataQt *m_profileData; }; } // namespace QtWebEngineCore -- cgit v1.2.3 From d9184f003a4f7ed214f3d170b26c2c0c0a5696ce Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 24 Oct 2019 10:23:07 +0200 Subject: Doc: Mention NavigationTypeRedirect is new in Qt 5.14 Change-Id: I44dd06e94f116a7b580c4530aaa3d142a79b196d Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebengineurlrequestinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index 5492b21d4..e44410099 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -216,7 +216,7 @@ QWebEngineUrlRequestInfo::ResourceType QWebEngineUrlRequestInfo::resourceType() \value NavigationTypeFormSubmitted Navigation submits a form. \value NavigationTypeBackForward Navigation initiated by a history action. \value NavigationTypeReload Navigation initiated by refreshing the page. - \value NavigationTypeRedirect Navigation triggered automatically by page content or remote server. + \value NavigationTypeRedirect Navigation triggered automatically by page content or remote server. (Added in Qt 5.14) \value NavigationTypeOther None of the above. */ -- cgit v1.2.3 From f74170eb7d66fceada6236e87a88573844fd2512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Wed, 23 Oct 2019 14:02:59 +0200 Subject: Delete URLRequestCustomJob::m_httpStatusCode Change-Id: Iab2f1735ea3ef73e77e0c37d263c0771a4ffb336 Reviewed-by: Allan Sandfeld Jensen --- src/core/net/url_request_custom_job.cpp | 3 +-- src/core/net/url_request_custom_job.h | 1 - src/core/net/url_request_custom_job_proxy.cpp | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 8f0fada57..37f7de256 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -68,7 +68,6 @@ URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, , m_pendingReadBuffer(nullptr) , m_corsEnabled(QWebEngineUrlScheme::schemeByName(QByteArray::fromStdString(scheme)) .flags().testFlag(QWebEngineUrlScheme::CorsEnabled)) - , m_httpStatusCode(500) { } @@ -155,7 +154,7 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) headers += "HTTP/1.1 303 See Other\n"; headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); } else { - headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); + headers += base::StringPrintf("HTTP/1.1 %i OK\n", 200); if (m_mimeType.size() > 0) { headers += base::StringPrintf("Content-Type: %s", m_mimeType.c_str()); if (m_charset.size() > 0) diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index e1e8e9fba..19a1a5776 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -82,7 +82,6 @@ private: int m_pendingReadPos; net::IOBuffer *m_pendingReadBuffer; const bool m_corsEnabled; - int m_httpStatusCode; friend class URLRequestCustomJobProxy; diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index b9ccf7ea4..72d14450e 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -100,7 +100,6 @@ void URLRequestCustomJobProxy::reply(std::string mimeType, QIODevice *device) m_job->set_expected_content_size(size); if (m_job->m_device && m_job->m_device->isReadable()) { m_started = true; - m_job->m_httpStatusCode = 200; m_job->NotifyHeadersComplete(); } else { fail(ERR_INVALID_URL); @@ -115,7 +114,6 @@ void URLRequestCustomJobProxy::redirect(GURL url) if (m_job->m_device || m_job->m_error) return; m_job->m_redirect = url; - m_job->m_httpStatusCode = 303; m_started = true; m_job->NotifyHeadersComplete(); } @@ -140,7 +138,6 @@ void URLRequestCustomJobProxy::fail(int error) if (!m_job) return; m_job->m_error = error; - m_job->m_httpStatusCode = 500; if (m_job->m_device) m_job->m_device->close(); if (!m_started) -- cgit v1.2.3 From 196a8061a4f00a6df6b160f6859eaa199e7e2e3c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 25 Oct 2019 14:46:24 +0200 Subject: Request Chromium ANGLE implementation on Windows Chromium now separates normal EGL and ANGLE OpenGL targets. Change-Id: I59555c856a6d9862dabe531dcdb53f50311b37c2 Reviewed-by: Allan Sandfeld Jensen --- src/core/ozone/gl_surface_qt.cpp | 3 ++- src/core/web_engine_context.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index 58a225b4e..e9da5e6a5 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -140,7 +140,7 @@ bool InitializeGLOneOffPlatform() { VSyncProviderWin::InitializeOneOff(); - if (GetGLImplementation() == kGLImplementationEGLGLES2) + if (GetGLImplementation() == kGLImplementationEGLGLES2 || GetGLImplementation() == kGLImplementationEGLANGLE) return GLSurfaceEGLQt::InitializeOneOff(); if (GetGLImplementation() == kGLImplementationDesktopGL) { @@ -173,6 +173,7 @@ CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format return surface; break; } + case kGLImplementationEGLANGLE: case kGLImplementationEGLGLES2: { surface = new GLSurfaceEGLQt(size); if (surface->Initialize(format)) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d4dfaba28..243774fb7 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -585,7 +585,7 @@ WebEngineContext::WebEngineContext() || usingANGLE()) { if (qt_gl_global_share_context()->isOpenGLES()) { - glType = gl::kGLImplementationEGLName; + glType = usingANGLE() ? gl::kGLImplementationANGLEName : gl::kGLImplementationEGLName; } else { QOpenGLContext context; QSurfaceFormat format; -- cgit v1.2.3 From 24bb272ac83fe42ad4cab58a9e97bdf2a53d2be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Mon, 28 Oct 2019 16:37:42 +0100 Subject: Fix handling of autorepeating KeyRelease events A regression in 5.10 has resulted in the web events generated for autorepeating keys not conforming to the spec. Restore the correct behavior from 5.9. Fixes: QTBUG-77208 Change-Id: Ia2f07fd4a8ee78c4599b36aceb235c245a49d566 Reviewed-by: Michal Klocek --- src/core/render_widget_host_view_qt.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e86f05d60..e721cba3b 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1311,6 +1311,14 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) } } + // Ignore autorepeating KeyRelease events so that the generated web events + // conform to the spec, which requires autorepeat to result in a sequence of + // keypress events and only one final keyup event: + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Auto-repeat_handling + // https://w3c.github.io/uievents/#dom-keyboardevent-repeat + if (ev->type() == QEvent::KeyRelease && ev->isAutoRepeat()) + return; + content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(ev); if (webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && !m_editCommand.empty()) { ui::LatencyInfo latency; -- cgit v1.2.3 From 418f929e7a067a13456f50b5478dcb64619b57ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 22 Oct 2019 16:04:13 +0200 Subject: Fix all GCC and Clang warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix all warnings save for -Wdeprecated-declarations in tests. Warnings from GCC 9.2.0: src/core/renderer/extensions/resource_request_policy_qt.cpp:157:23: warning: variable 'resource_root_relative_path' set but not used [-Wunused-but-set-variable] src/core/chromium_overrides.cpp:121:21: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] src/core/render_widget_host_view_qt.cpp:540:12: warning: enumeration value 'kNull' not handled in switch [-Wswitch] warning: enumeration value 'kMiddlePanningVertical' not handled in switch [-Wswitch] warning: enumeration value 'kMiddlePanningHorizontal' not handled in switch [-Wswitch] warning: enumeration value 'kDndNone' not handled in switch [-Wswitch] warning: enumeration value 'kDndMove' not handled in switch [-Wswitch] warning: enumeration value 'kDndCopy' not handled in switch [-Wswitch] warning: enumeration value 'kDndLink' not handled in switch [-Wswitch] warning: enumeration value 'kMaxValue' not handled in switch [-Wswitch] src/core/type_conversion.cpp:57:12: warning: enumeration value ‘kRGBA_F16Norm_SkColorType’ not handled in switch [-Wswitch] src/core/api/qtbug-60565.cpp:83:6: warning: 'void __ShimCppDeleteArrayNoThrow(void*, const std::nothrow_t&)' alias between functions of incompatible types 'void(void*, const std::nothrow_t&) noexcept' and 'void(void*)' [-Wattribute-alias=] src/core/api/qtbug-60565.cpp:79:6: warning: 'void __ShimCppDeleteNoThrow(void*, const std::nothrow_t&)' alias between functions of incompatible types 'void(void*, const std::nothrow_t&) noexcept' and 'void(void*)' [-Wattribute-alias=] src/core/api/qtbug-60565.cpp:75:6: warning: 'void __ShimCppNewArrayNoThrow(size_t, const std::nothrow_t&)' alias between functions of incompatible types 'void(size_t, const std::nothrow_t&) noexcept' {aka 'void(long unsigned int, const std::nothrow_t&) noexcept'} and 'void*(size_t)' {aka 'void*(long unsigned int)'} [-Wattribute-alias=] src/core/api/qtbug-60565.cpp:71:6: warning: 'void __ShimCppNewNoThrow(size_t, const std::nothrow_t&)' alias between functions of incompatible types 'void(size_t, const std::nothrow_t&) noexcept' {aka 'void(long unsigned int, const std::nothrow_t&) noexcept'} and 'void*(size_t)' {aka 'void*(long unsigned int)'} [-Wattribute-alias=] Warnings from Clang 9.0.1: src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h:61:29: warning: private field 'm_dispatcher' is not used [-Wunused-private-field] src/core/web_event_factory.cpp:1296:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] src/core/compositor/compositor_resource_fence.h:55:81: warning: extra ';' after member function definition [-Wextra-semi] src/core/renderer/render_frame_observer_qt.h:81:10: warning: 'ReadyToCommitNavigation' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] src/core/extensions/mime_handler_view_guest_delegate_qt.h:69:27: warning: private field 'guest_' is not used [-Wunused-private-field] src/core/chromium_overrides.cpp:121:12: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] src/core/chromium_overrides.cpp:145:64: warning: missing field 'set_up_command_line' initializer [-Wmissing-field-initializers] src/core/chromium_overrides.cpp:146:55: warning: missing field 'set_up_command_line' initializer [-Wmissing-field-initializers] src/core/render_widget_host_view_qt.cpp:540:13: warning: 7 enumeration values not handled in switch: 'kNull', 'kMiddlePanningVertical', 'kMiddlePanningHorizontal'... [-Wswitch] src/core/compositor/stream_video_node.cpp:50:18: warning: 'updateState' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] src/core/compositor/stream_video_node.cpp:103:18: warning: 'initialize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] src/core/type_conversion.cpp:57:13: warning: enumeration value 'kRGBA_F16Norm_SkColorType' not handled in switch [-Wswitch] src/core/renderer_host/web_channel_ipc_transport_host.cpp:59:60: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-extra-semi] tests/auto/widgets/loadsignals/tst_loadsignals.cpp:237:10: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp:1112:62: warning: lambda capture 'item' is not used [-Wunused-lambda-capture] tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp:1534:55: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] Change-Id: I374be0d4e58accc0a00a2596a560dd6103a98994 Reviewed-by: Michal Klocek Reviewed-by: Michael Brüning --- src/core/api/qtbug-60565.cpp | 28 +++++++++++++++++----- src/core/chromium_overrides.cpp | 6 ++--- src/core/compositor/compositor_resource_fence.h | 2 +- src/core/compositor/stream_video_node.cpp | 4 ++-- .../mime_handler_view_guest_delegate_qt.cpp | 2 +- .../mime_handler_view_guest_delegate_qt.h | 2 -- src/core/render_widget_host_view_qt.cpp | 9 +++++++ .../renderer_permissions_policy_delegate_qt.cpp | 3 +-- .../renderer_permissions_policy_delegate_qt.h | 2 -- .../extensions/resource_request_policy_qt.cpp | 4 ++-- src/core/renderer/render_frame_observer_qt.h | 2 +- .../web_channel_ipc_transport_host.cpp | 2 +- src/core/type_conversion.cpp | 1 + src/core/web_event_factory.cpp | 1 + tests/auto/widgets/loadsignals/tst_loadsignals.cpp | 2 +- .../tst_qwebenginedownloaditem.cpp | 2 +- .../widgets/qwebengineview/tst_qwebengineview.cpp | 2 +- 17 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/core/api/qtbug-60565.cpp b/src/core/api/qtbug-60565.cpp index be601b7e4..f48a2a701 100644 --- a/src/core/api/qtbug-60565.cpp +++ b/src/core/api/qtbug-60565.cpp @@ -68,20 +68,20 @@ void __ShimCppDeleteArray(void* address) SHIM_ALIAS_SYMBOL(ShimCppDeleteArray); __asm__(".symver __ShimCppNewNoThrow, _Znw" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5"); -void __ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept - SHIM_ALIAS_SYMBOL(ShimCppNew); +void *__ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppNewNoThrow); __asm__(".symver __ShimCppNewArrayNoThrow, _Zna" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5"); -void __ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept - SHIM_ALIAS_SYMBOL(ShimCppNewArray); +void *__ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppNewArrayNoThrow); __asm__(".symver __ShimCppDeleteNoThrow, _ZdlPvRKSt9nothrow_t@Qt_5"); void __ShimCppDeleteNoThrow(void* address, const std::nothrow_t&) noexcept - SHIM_ALIAS_SYMBOL(ShimCppDelete); + SHIM_ALIAS_SYMBOL(ShimCppDeleteNoThrow); __asm__(".symver __ShimCppDeleteArrayNoThrow, _ZdaPvRKSt9nothrow_t@Qt_5"); void __ShimCppDeleteArrayNoThrow(void* address, const std::nothrow_t&) noexcept - SHIM_ALIAS_SYMBOL(ShimCppDeleteArray); + SHIM_ALIAS_SYMBOL(ShimCppDeleteArrayNoThrow); static void* __shimCppNew(size_t size); static void* __shimCppNewArray(size_t size); @@ -92,17 +92,33 @@ SHIM_HIDDEN void* ShimCppNew(size_t size) { return __shimCppNew(size); } +SHIM_HIDDEN void* ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept { + return __shimCppNew(size); +} + SHIM_HIDDEN void* ShimCppNewArray(size_t size) { return __shimCppNewArray(size); } +SHIM_HIDDEN void* ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept { + return __shimCppNewArray(size); +} + SHIM_HIDDEN void ShimCppDelete(void* address) { __shimCppDelete(address); } +SHIM_HIDDEN void ShimCppDeleteNoThrow(void* address, const std::nothrow_t&) noexcept { + __shimCppDelete(address); +} + SHIM_HIDDEN void ShimCppDeleteArray(void* address) { __shimCppDeleteArray(address); } + +SHIM_HIDDEN void ShimCppDeleteArrayNoThrow(void* address, const std::nothrow_t&) noexcept { + __shimCppDeleteArray(address); +} } // extern "C" static void* __shimCppNew(size_t size) { diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 4920540a0..9d3e3f08a 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -118,7 +118,7 @@ std::unique_ptr GetFontList_SlowBlocking() // TODO(yusukes): Support localized family names. font_list->Append(std::move(font_item)); } - return std::move(font_list); + return font_list; } } // namespace content @@ -142,8 +142,8 @@ namespace content { std::vector AccessibilityTreeFormatter::GetTestPasses() { return { - {"blink", &AccessibilityTreeFormatterBlink::CreateBlink}, - {"native", &AccessibilityTreeFormatter::Create}, + {"blink", &AccessibilityTreeFormatterBlink::CreateBlink, nullptr}, + {"native", &AccessibilityTreeFormatter::Create, nullptr}, }; } } // namespace content diff --git a/src/core/compositor/compositor_resource_fence.h b/src/core/compositor/compositor_resource_fence.h index 196297f78..574416b8b 100644 --- a/src/core/compositor/compositor_resource_fence.h +++ b/src/core/compositor/compositor_resource_fence.h @@ -52,7 +52,7 @@ public: REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE(); CompositorResourceFence() {} - CompositorResourceFence(const gl::TransferableFence &sync) : m_sync(sync) {}; + CompositorResourceFence(const gl::TransferableFence &sync) : m_sync(sync) {} ~CompositorResourceFence() { release(); } // May be used only by Qt Quick render thread. diff --git a/src/core/compositor/stream_video_node.cpp b/src/core/compositor/stream_video_node.cpp index 29922f866..fb9501f24 100644 --- a/src/core/compositor/stream_video_node.cpp +++ b/src/core/compositor/stream_video_node.cpp @@ -47,7 +47,7 @@ class StreamVideoMaterialShader : public QSGMaterialShader { public: StreamVideoMaterialShader(TextureTarget target) : m_target(target) { } - virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); + virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; char const *const *attributeNames() const override { static const char *names[] = { @@ -100,7 +100,7 @@ protected: return shader2DRect; } - virtual void initialize() { + virtual void initialize() override { m_id_matrix = program()->uniformLocation("matrix"); m_id_sTexture = program()->uniformLocation("s_texture"); m_id_texMatrix = program()->uniformLocation("texMatrix"); diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp index 438b8a83e..022bc7db6 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp @@ -52,7 +52,7 @@ namespace extensions { -MimeHandlerViewGuestDelegateQt::MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *guest) +MimeHandlerViewGuestDelegateQt::MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *) : MimeHandlerViewGuestDelegate() { } diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.h b/src/core/extensions/mime_handler_view_guest_delegate_qt.h index b679c7a38..6cd80689c 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.h +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.h @@ -66,8 +66,6 @@ public: const content::ContextMenuParams ¶ms) override; private: - MimeHandlerViewGuest *guest_; // Owns us. - DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuestDelegateQt); }; diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e721cba3b..e2fd074ae 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -538,6 +538,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) ui::CursorType auraType = ui::CursorType::kNull; #endif switch (cursorInfo.type) { + case ui::CursorType::kNull: case ui::CursorType::kPointer: shape = Qt::ArrowCursor; break; @@ -561,6 +562,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kEastWestResize: case ui::CursorType::kEastPanning: case ui::CursorType::kWestPanning: + case ui::CursorType::kMiddlePanningHorizontal: shape = Qt::SizeHorCursor; break; case ui::CursorType::kNorthResize: @@ -568,6 +570,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kNorthSouthResize: case ui::CursorType::kNorthPanning: case ui::CursorType::kSouthPanning: + case ui::CursorType::kMiddlePanningVertical: shape = Qt::SizeVerCursor; break; case ui::CursorType::kNorthEastResize: @@ -597,9 +600,15 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kProgress: shape = Qt::BusyCursor; break; + case ui::CursorType::kDndNone: + case ui::CursorType::kDndMove: + shape = Qt::DragMoveCursor; + break; + case ui::CursorType::kDndCopy: case ui::CursorType::kCopy: shape = Qt::DragCopyCursor; break; + case ui::CursorType::kDndLink: case ui::CursorType::kAlias: shape = Qt::DragLinkCursor; break; diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp index 39412b76c..aef4903b7 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp @@ -47,8 +47,7 @@ namespace QtWebEngineCore { -RendererPermissionsPolicyDelegateQt::RendererPermissionsPolicyDelegateQt(extensions::Dispatcher *dispatcher) - : m_dispatcher(dispatcher) +RendererPermissionsPolicyDelegateQt::RendererPermissionsPolicyDelegateQt(extensions::Dispatcher *) { extensions::PermissionsData::SetPolicyDelegate(this); } diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h index e2af47657..385b7a4b0 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h @@ -58,8 +58,6 @@ public: bool IsRestrictedUrl(const GURL &, std::string *) override; private: - extensions::Dispatcher *m_dispatcher; - DISALLOW_COPY_AND_ASSIGN(RendererPermissionsPolicyDelegateQt); }; diff --git a/src/core/renderer/extensions/resource_request_policy_qt.cpp b/src/core/renderer/extensions/resource_request_policy_qt.cpp index a64b1fef8..efe44521d 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.cpp +++ b/src/core/renderer/extensions/resource_request_policy_qt.cpp @@ -154,9 +154,9 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // hybrid hosted/packaged apps. The one exception is access to icons, since // some extensions want to be able to do things like create their own // launchers. - base::StringPiece resource_root_relative_path = + /*base::StringPiece resource_root_relative_path = resource_url.path_piece().empty() ? base::StringPiece() - : resource_url.path_piece().substr(1); + : resource_url.path_piece().substr(1);*/ if (extension->is_hosted_app() /*&& !IconsInfo::GetIcons(extension).ContainsPath(resource_root_relative_path)*/) { LOG(ERROR) << "Denying load of " << resource_url.spec() << " from " << "hosted app."; diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index 3c54761f3..fb9fd3869 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -78,7 +78,7 @@ public: private: DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverQt); - void ReadyToCommitNavigation(blink::WebDocumentLoader *); + void ReadyToCommitNavigation(blink::WebDocumentLoader *) override; bool m_isFrameDetached; service_manager::BinderRegistry registry_; diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index e1929e4cd..b1aab00a1 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -56,7 +56,7 @@ namespace QtWebEngineCore { -Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport"); +Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport") inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame) { diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp index ddadeb9f2..aea924dbd 100644 --- a/src/core/type_conversion.cpp +++ b/src/core/type_conversion.cpp @@ -58,6 +58,7 @@ QImage toQImage(const SkBitmap &bitmap) case kUnknown_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F32_SkColorType: + case kRGBA_F16Norm_SkColorType: qWarning("Unknown or unsupported skia image format"); break; case kAlpha_8_SkColorType: diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 3598c1c78..ba04806d5 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1292,6 +1292,7 @@ static inline WebInputEvent::Modifiers modifiersForEvent(const QInputEvent* even if (keyEvent->isAutoRepeat()) result |= WebInputEvent::kIsAutoRepeat; result |= modifierForKeyCode(qtKeyForKeyEvent(keyEvent)); + break; } default: break; diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp index c0bb8d5c5..20e5fbf0d 100644 --- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp +++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp @@ -234,7 +234,7 @@ void tst_LoadSignals::fileDownloadDoesNotTriggerLoadSignals_qtbug66661() QTemporaryDir tempDir; QWebEngineDownloadItem::DownloadState downloadState = QWebEngineDownloadItem::DownloadRequested; connect(view->page()->profile(), &QWebEngineProfile::downloadRequested, - [this, &downloadState, &tempDir](QWebEngineDownloadItem* item){ + [&downloadState, &tempDir](QWebEngineDownloadItem* item){ connect(item, &QWebEngineDownloadItem::stateChanged, [&downloadState](QWebEngineDownloadItem::DownloadState newState){ downloadState = newState; }); diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index 6dc7f03c1..4a5b4e3eb 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -1109,7 +1109,7 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir() suggestedFileName = item->suggestedFileName(); downloadItem = item; item->accept(); - connect(item, &QWebEngineDownloadItem::finished, [&, item]() { + connect(item, &QWebEngineDownloadItem::finished, [&]() { downloadFinished = true; }); downloadAccepted = true; diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index abf414eb9..31438996f 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1531,7 +1531,7 @@ void tst_QWebEngineView::postData() eventloop.quit(); }); - connect(socket, &QIODevice::readyRead, this, [this, socket, &server, &postData](){ + connect(socket, &QIODevice::readyRead, this, [socket, &server, &postData](){ QByteArray rawData = socket->readAll(); QStringList lines = QString::fromLocal8Bit(rawData).split("\r\n"); -- cgit v1.2.3 From 6c736295cf1ead52f7f4ca99138d678573dab03c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 30 Oct 2019 10:54:13 +0100 Subject: Remove superfluous length check before parsing binary JSON The check has been added to QJsonDocument in 5.11. Also, the binary JSON types have been moved around, so this check won't work anymore. Change-Id: I70436cf039cba0810cfccc2041fce655ceb9b6df Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Simon Hausmann --- src/core/renderer_host/web_channel_ipc_transport_host.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index e1929e4cd..f04ef4b46 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -52,8 +52,6 @@ #include #include -#include - namespace QtWebEngineCore { Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport"); @@ -142,12 +140,8 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector= sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) - doc = QJsonDocument::fromRawData(reinterpret_cast(binaryJson.data()), - binaryJson.size()); + QJsonDocument doc = QJsonDocument::fromRawData( + reinterpret_cast(binaryJson.data()), binaryJson.size()); if (!doc.isObject()) { qCCritical(log).nospace() << "received invalid webchannel message from " << frame; -- cgit v1.2.3 From 21f10e777ee2faf41196d0263d4e5134d0ec216a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 29 Oct 2019 12:48:51 +0100 Subject: Update documented Chromium version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-79434 Change-Id: I7ae77a6ff50afe76ad3b8e199b5a8fb793ad65d8 Reviewed-by: Michael Brüning --- src/webengine/doc/src/qtwebengine-overview.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 6aa1af89e..3533b0327 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -89,7 +89,7 @@ \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview} that is part of the documentation in the \l {Chromium Project} upstream source tree. - This version of \QWE is based on Chromium version 73.0.3683, with additional security + This version of \QWE is based on Chromium version 77.0.3865, with additional security fixes from newer versions. \section2 Qt WebEngine Process -- cgit v1.2.3 From 3e45e3b1762e84f5dee24073921448afc5570d73 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2019 13:10:46 +0100 Subject: Code-style cleanup in src/core/extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picking suggested changes for a clang-format run. Change-Id: I1a803b0c0bbf305b3e0861fa42b47ee404b4b255 Reviewed-by: Michael Brüning --- src/core/extensions/extension_system_qt.cpp | 70 +++++++++------------- src/core/extensions/extension_system_qt.h | 4 +- .../extension_web_contents_observer_qt.h | 4 +- .../extensions_browser_api_provider_qt.cpp | 11 ++-- .../extensions_browser_api_provider_qt.h | 3 +- .../extensions/extensions_browser_client_qt.cpp | 66 ++++++++------------ src/core/extensions/extensions_browser_client_qt.h | 8 +-- .../extensions/pdf_web_contents_helper_client_qt.h | 13 ++-- 8 files changed, 73 insertions(+), 106 deletions(-) diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index 7278e50c1..fbe98099c 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -102,8 +102,7 @@ namespace extensions { namespace { -std::string GenerateId(const base::DictionaryValue *manifest, - const base::FilePath &path) +std::string GenerateId(const base::DictionaryValue *manifest, const base::FilePath &path) { std::string raw_key; std::string id_input; @@ -130,49 +129,36 @@ std::unique_ptr ParseManifest(const std::string &manifest } // namespace // Dummy Content Verifier Delegate. Added to prevent crashes. -class ContentVerifierDelegateQt - : public ContentVerifierDelegate { - public: - ~ContentVerifierDelegateQt() override {} - - // This should return what verification mode is appropriate for the given - // extension, if any. - bool ShouldBeVerified(const Extension& extension) override +class ContentVerifierDelegateQt : public ContentVerifierDelegate +{ +public: + ~ContentVerifierDelegateQt() override {} + + // This should return what verification mode is appropriate for the given + // extension, if any. + bool ShouldBeVerified(const Extension &extension) override { return false; } + + // Should return the public key to use for validating signatures via the two + // out parameters. + ContentVerifierKey GetPublicKey() override { return ContentVerifierKey(); } + // This should return a URL that can be used to fetch the + // verified_contents.json containing signatures for the given extension + // id/version pair. + GURL GetSignatureFetchUrl(const std::string &extension_id, const base::Version &version) override { return GURL(); } + + // This should return the set of file paths for images used within the + // browser process. (These may get transcoded during the install process). + std::set GetBrowserImagePaths(const extensions::Extension *extension) override { - return false; + return std::set(); } - // Should return the public key to use for validating signatures via the two - // out parameters. - ContentVerifierKey GetPublicKey() override { - return ContentVerifierKey(); - } - // This should return a URL that can be used to fetch the - // verified_contents.json containing signatures for the given extension - // id/version pair. - GURL GetSignatureFetchUrl(const std::string& extension_id, - const base::Version& version) override { - return GURL(); - } - - // This should return the set of file paths for images used within the - // browser process. (These may get transcoded during the install process). - std::set GetBrowserImagePaths( - const extensions::Extension* extension) override { - return std::set(); - } - - // Called when the content verifier detects that a read of a file inside - // an extension did not match its expected hash. - void VerifyFailed(const std::string& extension_id, - ContentVerifyJob::FailureReason reason) override { - - } - - // Called when ExtensionSystem is shutting down. - void Shutdown() override { - - } + // Called when the content verifier detects that a read of a file inside + // an extension did not match its expected hash. + void VerifyFailed(const std::string &extension_id, ContentVerifyJob::FailureReason reason) override {} + + // Called when ExtensionSystem is shutting down. + void Shutdown() override {} }; void ExtensionSystemQt::LoadExtension(std::string extension_id, std::unique_ptr manifest, const base::FilePath &directory) diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 4370f5cc3..04bffb74d 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -90,8 +90,8 @@ public: ManagementPolicy *management_policy() override; ServiceWorkerManager *service_worker_manager() override; SharedUserScriptMaster *shared_user_script_master() override; - StateStore* state_store() override; - StateStore* rules_store() override; + StateStore *state_store() override; + StateStore *rules_store() override; scoped_refptr store_factory() override; InfoMap *info_map() override; QuotaService *quota_service() override; diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h index 5f32562fc..a528b3856 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.h +++ b/src/core/extensions/extension_web_contents_observer_qt.h @@ -50,8 +50,8 @@ namespace extensions { class ExtensionWebContentsObserverQt - : public ExtensionWebContentsObserver, - public content::WebContentsUserData + : public ExtensionWebContentsObserver + , public content::WebContentsUserData { public: explicit ExtensionWebContentsObserverQt(content::WebContents *web_contents); diff --git a/src/core/extensions/extensions_browser_api_provider_qt.cpp b/src/core/extensions/extensions_browser_api_provider_qt.cpp index cc1932c64..731dfb0fd 100644 --- a/src/core/extensions/extensions_browser_api_provider_qt.cpp +++ b/src/core/extensions/extensions_browser_api_provider_qt.cpp @@ -42,16 +42,13 @@ #include "extensions/browser/api/generated_api_registration.h" namespace extensions { -ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() = - default; -ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() = - default; +ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() = default; +ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() = default; -void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions( - ExtensionFunctionRegistry* registry) { +void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) +{ api::GeneratedFunctionRegistry::RegisterAll(registry); } } - diff --git a/src/core/extensions/extensions_browser_api_provider_qt.h b/src/core/extensions/extensions_browser_api_provider_qt.h index 612df3825..f1d10ac95 100644 --- a/src/core/extensions/extensions_browser_api_provider_qt.h +++ b/src/core/extensions/extensions_browser_api_provider_qt.h @@ -45,7 +45,8 @@ namespace extensions { -class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider { +class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider +{ public: ExtensionsBrowserAPIProviderQt(); ~ExtensionsBrowserAPIProviderQt() override; diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index eb8c12bff..59c15d2f5 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -97,72 +97,57 @@ void DetermineCharset(const std::string &mime_type, if (base::StartsWith(mime_type, "text/", base::CompareCase::INSENSITIVE_ASCII)) { // All of our HTML files should be UTF-8 and for other resource types // (like images), charset doesn't matter. - DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast(data->front()), data->size()))); + DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast(data->front()), data->size()))); *out_charset = "utf-8"; } } // A request for an extension resource in a Chrome .pak file. These are used // by component extensions. -class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { +class URLRequestResourceBundleJob : public net::URLRequestSimpleJob +{ public: - URLRequestResourceBundleJob(net::URLRequest *request, - net::NetworkDelegate *network_delegate, - const base::FilePath &filename, - int resource_id, - const std::string &content_security_policy, - bool send_cors_header) - : net::URLRequestSimpleJob(request, network_delegate) - , filename_(filename) - , resource_id_(resource_id) - , weak_factory_(this) + URLRequestResourceBundleJob(net::URLRequest *request, net::NetworkDelegate *network_delegate, + const base::FilePath &filename, int resource_id, + const std::string &content_security_policy, bool send_cors_header) + : net::URLRequestSimpleJob(request, network_delegate) + , filename_(filename) + , resource_id_(resource_id) + , weak_factory_(this) { // Leave cache headers out of resource bundle requests. response_info_.headers = extensions::BuildHttpHeaders(content_security_policy, send_cors_header, base::Time()); } - int GetRefCountedData(std::string* mime_type, - std::string* charset, - scoped_refptr* data, + int GetRefCountedData(std::string *mime_type, std::string *charset, scoped_refptr *data, net::CompletionOnceCallback callback) const override { - const ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + const ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance(); *data = rb.LoadDataResourceBytes(resource_id_); // Add the Content-Length header now that we know the resource length. - response_info_.headers->AddHeader( - base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength, - base::NumberToString((*data)->size()).c_str())); + response_info_.headers->AddHeader(base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength, + base::NumberToString((*data)->size()).c_str())); - std::string* read_mime_type = new std::string; + std::string *read_mime_type = new std::string; base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, - base::BindOnce(&net::GetMimeTypeFromFile, filename_, - base::Unretained(read_mime_type)), - base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead, - weak_factory_.GetWeakPtr(), mime_type, charset, *data, - base::Owned(read_mime_type), std::move(callback))); + FROM_HERE, { base::MayBlock() }, + base::BindOnce(&net::GetMimeTypeFromFile, filename_, base::Unretained(read_mime_type)), + base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead, weak_factory_.GetWeakPtr(), mime_type, + charset, *data, base::Owned(read_mime_type), std::move(callback))); return net::ERR_IO_PENDING; } - void GetResponseInfo(net::HttpResponseInfo* info) override - { - *info = response_info_; - } + void GetResponseInfo(net::HttpResponseInfo *info) override { *info = response_info_; } private: ~URLRequestResourceBundleJob() override {} - void OnMimeTypeRead(std::string *out_mime_type, - std::string *charset, - scoped_refptr data, - std::string *read_mime_type, - net::CompletionOnceCallback callback, - bool read_result) + void OnMimeTypeRead(std::string *out_mime_type, std::string *charset, scoped_refptr data, + std::string *read_mime_type, net::CompletionOnceCallback callback, bool read_result) { response_info_.headers->AddHeader( - base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, - read_mime_type->c_str())); + base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, read_mime_type->c_str())); *out_mime_type = *read_mime_type; DetermineCharset(*read_mime_type, data.get(), charset); int result = read_result ? net::OK : net::ERR_INVALID_URL; @@ -444,8 +429,7 @@ bool ExtensionsBrowserClientQt::IsBackgroundUpdateAllowed() return true; } -bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported( - const std::string &min_version) +bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported(const std::string &min_version) { return true; } @@ -482,7 +466,7 @@ KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate() return nullptr; } -bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string& app_id) +bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string &app_id) { return false; } diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 056e65c9e..41cb2ce20 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -90,8 +90,7 @@ public: void GetEarlyExtensionPrefsObservers(content::BrowserContext *context, std::vector *observers) const override; ProcessManagerDelegate *GetProcessManagerDelegate() const override; - std::unique_ptr - CreateExtensionHostDelegate() override; + std::unique_ptr CreateExtensionHostDelegate() override; bool DidVersionUpdate(content::BrowserContext *context) override; void PermitExternalProtocolHandler() override; bool IsRunningInForcedAppMode() override; @@ -110,8 +109,7 @@ public: ExtensionCache *GetExtensionCache() override; bool IsBackgroundUpdateAllowed() override; bool IsMinBrowserVersionSupported(const std::string &min_version) override; - ExtensionWebContentsObserver *GetExtensionWebContentsObserver( - content::WebContents *web_contents) override; + ExtensionWebContentsObserver *GetExtensionWebContentsObserver(content::WebContents *web_contents) override; KioskDelegate *GetKioskDelegate() override; // Whether the browser context is associated with Chrome OS lock screen. @@ -138,7 +136,7 @@ public: // Returns the locale used by the application. std::string GetApplicationLocale() override; - bool IsScreensaverInDemoMode(const std::string& app_id) override; + bool IsScreensaverInDemoMode(const std::string &app_id) override; // Sets the API client. void SetAPIClientForTest(ExtensionsAPIClient *api_client); diff --git a/src/core/extensions/pdf_web_contents_helper_client_qt.h b/src/core/extensions/pdf_web_contents_helper_client_qt.h index a22feb138..9a37375b3 100644 --- a/src/core/extensions/pdf_web_contents_helper_client_qt.h +++ b/src/core/extensions/pdf_web_contents_helper_client_qt.h @@ -10,20 +10,21 @@ namespace extensions { -class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient { +class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient +{ public: PDFWebContentsHelperClientQt(); ~PDFWebContentsHelperClientQt() override; private: // pdf::PDFWebContentsHelperClient: - void UpdateContentRestrictions(content::WebContents* contents, int content_restrictions) override; - void OnPDFHasUnsupportedFeature(content::WebContents* contents) override; - void OnSaveURL(content::WebContents* contents) override; + void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override; + void OnPDFHasUnsupportedFeature(content::WebContents *contents) override; + void OnSaveURL(content::WebContents *contents) override; DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelperClientQt); }; -} // namespace extensions +} // namespace extensions -#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ +#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ -- cgit v1.2.3 From b7ca21bb126ed1ce6372af0e8e705b290ad0161a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2019 10:42:46 +0100 Subject: Speculative fix of tst_Origins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup page between tests, increase load timeout and switch to QVERIFY_TRY to be told of timeout overruns. Fixes: QTBUG-79719 Change-Id: Ic246a5b0926c3e8b6c0f90f5ff21a33fa262c046 Reviewed-by: Jüri Valdmann --- tests/auto/widgets/origins/tst_origins.cpp | 137 +++++++++++++++-------------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp index 990ca70a7..434d16495 100644 --- a/tests/auto/widgets/origins/tst_origins.cpp +++ b/tests/auto/widgets/origins/tst_origins.cpp @@ -206,8 +206,9 @@ class tst_Origins final : public QObject { private Q_SLOTS: void initTestCase(); - void cleanup(); void cleanupTestCase(); + void init(); + void cleanup(); void jsUrlCanon(); void jsUrlRelative(); @@ -228,12 +229,12 @@ private Q_SLOTS: void redirect(); private: - bool load(const QUrl &url) + bool verifyLoad(const QUrl &url) { QSignalSpy spy(m_page, &QWebEnginePage::loadFinished); m_page->load(url); - return (!spy.empty() || spy.wait(20000)) - && spy.front().value(0).toBool(); + [&spy]() { QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), 30000); }(); + return !spy.isEmpty() && spy.front().value(0).toBool(); } QVariant eval(const QString &code) @@ -252,26 +253,32 @@ void tst_Origins::initTestCase() QtWarningMsg, QRegularExpression("Please register the custom scheme 'tst'.*")); - m_page = new QWebEnginePage(&m_profile, nullptr); m_handler = new TstUrlSchemeHandler(&m_profile); } -void tst_Origins::cleanup() +void tst_Origins::cleanupTestCase() { - m_handler->requests().clear(); + QVERIFY(!m_page); + delete m_handler; } -void tst_Origins::cleanupTestCase() +void tst_Origins::init() +{ + m_page = new QWebEnginePage(&m_profile, nullptr); +} + +void tst_Origins::cleanup() { - delete m_handler; delete m_page; + m_page = nullptr; + m_handler->requests().clear(); } // Test URL parsing and canonicalization in Blink. The implementation of this // part is mostly shared between Blink and Chromium proper. void tst_Origins::jsUrlCanon() { - QVERIFY(load(QSL("about:blank"))); + QVERIFY(verifyLoad(QSL("about:blank"))); // Standard schemes are biased towards the authority part. QCOMPARE(eval(QSL("new URL(\"http:foo/bar\").href")), QVariant(QSL("http://foo/bar"))); @@ -333,7 +340,7 @@ void tst_Origins::jsUrlCanon() // Test relative URL resolution. void tst_Origins::jsUrlRelative() { - QVERIFY(load(QSL("about:blank"))); + QVERIFY(verifyLoad(QSL("about:blank"))); // Schemes with hosts, like http, work as expected. QCOMPARE(eval(QSL("new URL('bar', 'http://foo').href")), QVariant(QSL("http://foo/bar"))); @@ -382,7 +389,7 @@ void tst_Origins::jsUrlRelative() // blink::SecurityOrigin as opposed to GURL and url::Origin. void tst_Origins::jsUrlOrigin() { - QVERIFY(load(QSL("about:blank"))); + QVERIFY(verifyLoad(QSL("about:blank"))); // For network protocols the origin string must include the domain and port. QCOMPARE(eval(QSL("new URL(\"http://foo.com/page.html\").origin")), QVariant(QSL("http://foo.com"))); @@ -448,15 +455,15 @@ void tst_Origins::subdirWithAccess() { ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true); - QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello"))); QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world"))); - QVERIFY(load(QSL("qrc:/resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello"))); QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world"))); - QVERIFY(load(QSL("tst:/resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello"))); QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world"))); } @@ -474,15 +481,15 @@ void tst_Origins::subdirWithoutAccess() { ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false); - QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant()); QCOMPARE(eval(QSL("msg[1]")), QVariant()); - QVERIFY(load(QSL("qrc:/resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello"))); QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world"))); - QVERIFY(load(QSL("tst:/resources/subdir/index.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/subdir/index.html"))); QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello"))); QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world"))); } @@ -497,7 +504,7 @@ void tst_Origins::subdirWithoutAccess() // file: scheme. void tst_Origins::mixedSchemes() { - QVERIFY(load(QSL("file:" THIS_DIR "resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess"))); eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')")); @@ -505,7 +512,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("qrc:/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')")); @@ -513,7 +520,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("tst:/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("cannotLoad"))); eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')")); @@ -521,7 +528,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess"))); - QVERIFY(load(QSL("PathSyntax:/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax:/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess"))); eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')")); @@ -531,7 +538,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("PathSyntax-LocalAccessAllowed:/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-LocalAccessAllowed:/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')")); @@ -541,7 +548,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')")); @@ -551,7 +558,7 @@ void tst_Origins::mixedSchemes() eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("HostSyntax://a/resources/mixedSchemes.html"))); + QVERIFY(verifyLoad(QSL("HostSyntax://a/resources/mixedSchemes.html"))); eval(QSL("setIFrameUrl('HostSyntax://a/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess"))); eval(QSL("setIFrameUrl('HostSyntax://b/resources/mixedSchemes_frame.html')")); @@ -561,13 +568,13 @@ void tst_Origins::mixedSchemes() // Like mixedSchemes but adds a Content-Security-Policy: frame-src 'none' header. void tst_Origins::mixedSchemesWithCsp() { - QVERIFY(load(QSL("HostSyntax://a/resources/mixedSchemesWithCsp.html"))); + QVERIFY(verifyLoad(QSL("HostSyntax://a/resources/mixedSchemesWithCsp.html"))); eval(QSL("setIFrameUrl('HostSyntax://a/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); eval(QSL("setIFrameUrl('HostSyntax://b/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess"))); - QVERIFY(load(QSL("HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemesWithCsp.html"))); + QVERIFY(verifyLoad(QSL("HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemesWithCsp.html"))); eval(QSL("setIFrameUrl('HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemes_frame.html')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess"))); eval(QSL("setIFrameUrl('HostSyntax-ContentSecurityPolicyIgnored://b/resources/mixedSchemes_frame.html')")); @@ -582,7 +589,7 @@ void tst_Origins::mixedSchemesWithCsp() // schemes with the CorsEnabled flag. void tst_Origins::mixedXHR() { - QVERIFY(load(QSL("file:" THIS_DIR "resources/mixedXHR.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedXHR.html"))); eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')")); @@ -594,7 +601,7 @@ void tst_Origins::mixedXHR() eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); - QVERIFY(load(QSL("qrc:/resources/mixedXHR.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/mixedXHR.html"))); eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')")); @@ -606,7 +613,7 @@ void tst_Origins::mixedXHR() eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); - QVERIFY(load(QSL("tst:/resources/mixedXHR.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/mixedXHR.html"))); eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')")); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("error"))); eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')")); @@ -672,18 +679,18 @@ void tst_Origins::webSocket() m_page->setWebChannel(&channel); QVERIFY(echoServer.listen()); - QVERIFY(load(QSL("file:" THIS_DIR "resources/websocket.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/websocket.html"))); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); - QVERIFY(load(QSL("qrc:/resources/websocket.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/websocket.html"))); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); // Unregistered schemes can also open WebSockets (since Chromium 71) - QVERIFY(load(QSL("tst:/resources/websocket.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/websocket.html"))); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); // Even an insecure registered scheme can open WebSockets. - QVERIFY(load(QSL("PathSyntax:/resources/websocket.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax:/resources/websocket.html"))); QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok"))); } #endif @@ -691,26 +698,26 @@ void tst_Origins::webSocket() // one page, there is not much need for security restrictions. void tst_Origins::dedicatedWorker() { - QVERIFY(load(QSL("file:" THIS_DIR "resources/dedicatedWorker.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/dedicatedWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QCOMPARE(eval(QSL("result")), QVariant(42)); - QVERIFY(load(QSL("qrc:/resources/dedicatedWorker.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/dedicatedWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QCOMPARE(eval(QSL("result")), QVariant(42)); // Unregistered schemes can also create Workers (since Chromium 71) - QVERIFY(load(QSL("tst:/resources/dedicatedWorker.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/dedicatedWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QCOMPARE(eval(QSL("result")), QVariant(42)); // Even an insecure registered scheme can create Workers. - QVERIFY(load(QSL("PathSyntax:/resources/dedicatedWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax:/resources/dedicatedWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QCOMPARE(eval(QSL("result")), QVariant(42)); // But not if the NoAccessAllowed flag is set. - QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/dedicatedWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/dedicatedWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("cannot be accessed from origin 'null'"))); @@ -722,31 +729,31 @@ void tst_Origins::sharedWorker() { { ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false); - QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html"))); - QTRY_VERIFY(eval(QSL("done")).toBool()); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html"))); + QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000); QVERIFY(eval(QSL("error")).toString() .contains(QSL("cannot be accessed from origin 'null'"))); } { ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true); - QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html"))); - QTRY_VERIFY(eval(QSL("done")).toBool()); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html"))); + QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000); QCOMPARE(eval(QSL("result")), QVariant(42)); } - QVERIFY(load(QSL("qrc:/resources/sharedWorker.html"))); - QTRY_VERIFY(eval(QSL("done")).toBool()); + QVERIFY(verifyLoad(QSL("qrc:/resources/sharedWorker.html"))); + QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000); QCOMPARE(eval(QSL("result")), QVariant(42)); // Unregistered schemes should not create SharedWorkers. - QVERIFY(load(QSL("PathSyntax:/resources/sharedWorker.html"))); - QTRY_VERIFY(eval(QSL("done")).toBool()); + QVERIFY(verifyLoad(QSL("PathSyntax:/resources/sharedWorker.html"))); + QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000); QCOMPARE(eval(QSL("result")), QVariant(42)); - QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/sharedWorker.html"))); - QTRY_VERIFY(eval(QSL("done")).toBool()); + QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/sharedWorker.html"))); + QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000); QVERIFY(eval(QSL("error")).toString() .contains(QSL("denied to origin 'null'"))); } @@ -754,41 +761,41 @@ void tst_Origins::sharedWorker() // Service workers have to be explicitly enabled for a scheme. void tst_Origins::serviceWorker() { - QVERIFY(load(QSL("file:" THIS_DIR "resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("The URL protocol of the current origin ('file://') is not supported."))); - QVERIFY(load(QSL("qrc:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("The URL protocol of the current origin ('qrc:') is not supported."))); - QVERIFY(load(QSL("tst:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("Cannot read property 'register' of undefined"))); - QVERIFY(load(QSL("PathSyntax:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("Cannot read property 'register' of undefined"))); - QVERIFY(load(QSL("PathSyntax-Secure:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-Secure:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("The URL protocol of the current origin ('pathsyntax-secure:') is not supported."))); - QVERIFY(load(QSL("PathSyntax-ServiceWorkersAllowed:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-ServiceWorkersAllowed:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("Cannot read property 'register' of undefined"))); - QVERIFY(load(QSL("PathSyntax-Secure-ServiceWorkersAllowed:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-Secure-ServiceWorkersAllowed:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QCOMPARE(eval(QSL("error")), QVariant()); - QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/serviceWorker.html"))); + QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/serviceWorker.html"))); QTRY_VERIFY(eval(QSL("done")).toBool()); QVERIFY(eval(QSL("error")).toString() .contains(QSL("Cannot read property 'register' of undefined"))); @@ -797,40 +804,40 @@ void tst_Origins::serviceWorker() // Support for view-source must be enabled explicitly. void tst_Origins::viewSource() { - QVERIFY(load(QSL("view-source:file:" THIS_DIR "resources/viewSource.html"))); + QVERIFY(verifyLoad(QSL("view-source:file:" THIS_DIR "resources/viewSource.html"))); #ifdef Q_OS_WIN QCOMPARE(m_page->requestedUrl().toString(), QSL("file:///" THIS_DIR "resources/viewSource.html")); #else QCOMPARE(m_page->requestedUrl().toString(), QSL("file://" THIS_DIR "resources/viewSource.html")); #endif - QVERIFY(load(QSL("view-source:qrc:/resources/viewSource.html"))); + QVERIFY(verifyLoad(QSL("view-source:qrc:/resources/viewSource.html"))); QCOMPARE(m_page->requestedUrl().toString(), QSL("qrc:/resources/viewSource.html")); - QVERIFY(load(QSL("view-source:tst:/resources/viewSource.html"))); + QVERIFY(verifyLoad(QSL("view-source:tst:/resources/viewSource.html"))); QCOMPARE(m_page->requestedUrl().toString(), QSL("about:blank")); - QVERIFY(load(QSL("view-source:PathSyntax:/resources/viewSource.html"))); + QVERIFY(verifyLoad(QSL("view-source:PathSyntax:/resources/viewSource.html"))); QCOMPARE(m_page->requestedUrl().toString(), QSL("about:blank")); - QVERIFY(load(QSL("view-source:PathSyntax-ViewSourceAllowed:/resources/viewSource.html"))); + QVERIFY(verifyLoad(QSL("view-source:PathSyntax-ViewSourceAllowed:/resources/viewSource.html"))); QCOMPARE(m_page->requestedUrl().toString(), QSL("pathsyntax-viewsourceallowed:/resources/viewSource.html")); } void tst_Origins::createObjectURL() { // Legal for registered custom schemes. - QVERIFY(load(QSL("qrc:/resources/createObjectURL.html"))); + QVERIFY(verifyLoad(QSL("qrc:/resources/createObjectURL.html"))); QVERIFY(eval(QSL("result")).toString().startsWith(QSL("blob:qrc:"))); // Also legal for unregistered schemes (since Chromium 71) - QVERIFY(load(QSL("tst:/resources/createObjectURL.html"))); + QVERIFY(verifyLoad(QSL("tst:/resources/createObjectURL.html"))); QVERIFY(eval(QSL("result")).toString().startsWith(QSL("blob:tst:"))); } void tst_Origins::redirect() { - QVERIFY(load(QSL("redirect1:/resources/redirect.html"))); + QVERIFY(verifyLoad(QSL("redirect1:/resources/redirect.html"))); QTRY_COMPARE(m_handler->requests().size(), 7); QCOMPARE(m_handler->requests()[0], QUrl(QStringLiteral("redirect1:/resources/redirect.html"))); QCOMPARE(m_handler->requests()[1], QUrl(QStringLiteral("redirect2:/resources/redirect.html"))); -- cgit v1.2.3 From 58bc92115febfa332e9f2ebe0f06a01b5a679416 Mon Sep 17 00:00:00 2001 From: Tamas Zakor Date: Thu, 24 Oct 2019 13:55:50 +0200 Subject: Deprecate QWebEngineDownloadItem path API properly Implements suggestion from 5.14 API review: - Replace QT_DEPRECATED with QT_DEPRECATED_SINCE and QT_DEPRECATED_VERSION_X Change-Id: I4d0bf8a2b535c44b5749cbd3bbab7e305bd137c6 Reviewed-by: Allan Sandfeld Jensen --- src/webenginewidgets/api/qwebenginedownloaditem.h | 8 ++++++-- .../widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 27fca6f8a..8d98799a3 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -118,8 +118,12 @@ public: qint64 receivedBytes() const; QUrl url() const; QString mimeType() const; - QString Q_DECL_DEPRECATED path() const; - void Q_DECL_DEPRECATED setPath(QString path); +#if QT_DEPRECATED_SINCE(5, 14) + QT_DEPRECATED_VERSION_X(5, 14, "Use downloadDirectory() and downloadFileName() instead") + QString path() const; + QT_DEPRECATED_VERSION_X(5, 14, "Use setDownloadDirectory() and setDownloadFileName() instead") + void setPath(QString path); +#endif bool isFinished() const; bool isPaused() const; SavePageFormat savePageFormat() const; diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index 4a5b4e3eb..d34e3cefe 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -77,7 +77,9 @@ private Q_SLOTS: void downloadToDefaultLocation(); void downloadToNonExistentDir(); void downloadToReadOnlyDir(); +#if QT_DEPRECATED_SINCE(5, 14) void downloadPathValidation(); +#endif void downloadToDirectoryWithFileName(); private: @@ -1135,6 +1137,7 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir() QFile(m_profile->downloadPath()).setPermissions(QFileDevice::WriteOwner); } +#if QT_DEPRECATED_SINCE(5, 14) void tst_QWebEngineDownloadItem::downloadPathValidation() { const QString fileName = "test.txt"; @@ -1251,6 +1254,7 @@ void tst_QWebEngineDownloadItem::downloadPathValidation() #endif // !defined(Q_OS_WIN) QDir::setCurrent(oldPath); } +#endif void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName() { -- cgit v1.2.3 From 296469f8ecef1f4d10cf8c24237fe9397b41f306 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 5 Nov 2019 14:51:34 +0100 Subject: More speculative fixes for MSVC 2019 CI Expand many more timeouts as loading basic test cases can now take many seconds. Task-number: QTBUG-79290 Change-Id: I749fe50525919b24a4a3fcba905745b6d6648121 Reviewed-by: Kirill Burtsev --- tests/auto/quick/inspectorserver/BLACKLIST | 1 + .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 42 +++++++++++----------- .../widgets/qwebengineview/tst_qwebengineview.cpp | 2 +- tests/auto/widgets/schemes/tst_schemes.cpp | 2 +- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/tests/auto/quick/inspectorserver/BLACKLIST b/tests/auto/quick/inspectorserver/BLACKLIST index f80823bf3..92c76505a 100644 --- a/tests/auto/quick/inspectorserver/BLACKLIST +++ b/tests/auto/quick/inspectorserver/BLACKLIST @@ -3,3 +3,4 @@ osx [openRemoteDebuggingSession] osx +msvc-2019 diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 931dbf7f0..0a65d4c02 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -322,7 +322,7 @@ void tst_QWebEnginePage::acceptNavigationRequest() page.setHtml(QString("
" "
"), QUrl()); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); evaluateJavaScriptSync(&page, "tstform.submit();"); QTRY_COMPARE(loadSpy.count(), 2); @@ -388,7 +388,7 @@ void tst_QWebEnginePage::geolocationRequestJS() QSignalSpy spyLoadFinished(newPage, SIGNAL(loadFinished(bool))); newPage->setHtml(QString("test"), QUrl("qrc://secure/origin")); - QTRY_COMPARE(spyLoadFinished.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spyLoadFinished.count(), 1, 20000); // Geolocation is only enabled for visible WebContents. view.show(); @@ -415,7 +415,7 @@ void tst_QWebEnginePage::loadFinished() page.load(QUrl("data:text/html,foo \">" "")); - QTRY_COMPARE(spyLoadFinished.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spyLoadFinished.count(), 1, 20000); QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue); QTRY_VERIFY_WITH_TIMEOUT(spyLoadStarted.count() > 1, 100); @@ -475,9 +475,9 @@ void tst_QWebEnginePage::pasteImage() QClipboard *clipboard = QGuiApplication::clipboard(); clipboard->setImage(origImage); QWebEnginePage *page = m_view->page(); - page->load(QUrl("qrc:///resources/pasteimage.html")); QSignalSpy spyFinished(m_view, &QWebEngineView::loadFinished); - QVERIFY(spyFinished.wait()); + page->load(QUrl("qrc:///resources/pasteimage.html")); + QTRY_VERIFY_WITH_TIMEOUT(!spyFinished.isEmpty(), 20000); page->triggerAction(QWebEnginePage::Paste); QTRY_VERIFY(evaluateJavaScriptSync(page, "window.myImageDataURL ? window.myImageDataURL.length : 0").toInt() > 0); @@ -568,11 +568,11 @@ void tst_QWebEnginePage::acceptNavigationRequestNavigationType() QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); page.load(QUrl("qrc:///resources/script.html")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); QTRY_COMPARE(page.navigations.count(), 1); page.load(QUrl("qrc:///resources/content.html")); - QTRY_COMPARE(loadSpy.count(), 2); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 2, 20000); QTRY_COMPARE(page.navigations.count(), 2); page.triggerAction(QWebEnginePage::Stop); @@ -587,7 +587,7 @@ void tst_QWebEnginePage::acceptNavigationRequestNavigationType() QTRY_COMPARE(page.navigations.count(), 4); page.load(QUrl("qrc:///resources/reload.html")); - QTRY_COMPARE(loadSpy.count(), 6); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 6, 20000); QTRY_COMPARE(page.navigations.count(), 6); QList expectedList; @@ -613,7 +613,7 @@ void tst_QWebEnginePage::popupFormSubmission() page.setHtml("
" " " "
"); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000); page.runJavaScript("window.open('', 'myNewWin', 'width=500,height=300,toolbar=0');"); evaluateJavaScriptSync(&page, "document.form1.submit();"); @@ -666,8 +666,8 @@ void tst_QWebEnginePage::multipleProfilesAndLocalStorage() page1.setHtml(QString(" "), QUrl("http://wwww.example.com")); page2.setHtml(QString(" "), QUrl("http://wwww.example.com")); - QTRY_COMPARE(loadSpy1.count(), 1); - QTRY_COMPARE(loadSpy2.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy1.count(), 1, 20000); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy2.count(), 1, 20000); evaluateJavaScriptSync(&page1, "localStorage.setItem('test', 'value1');"); evaluateJavaScriptSync(&page2, "localStorage.setItem('test', 'value2');"); @@ -727,7 +727,7 @@ void tst_QWebEnginePage::textSelection() page->setView(&view); QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool))); page->setHtml(content); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); // these actions must exist QVERIFY(page->action(QWebEnginePage::SelectAll) != 0); @@ -759,7 +759,7 @@ void tst_QWebEnginePage::backActionUpdate() QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool))); QUrl url = QUrl("qrc:///resources/framedindex.html"); page->load(url); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); QVERIFY(!action->isEnabled()); QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(10, 10)); QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue); @@ -782,8 +782,8 @@ void tst_QWebEnginePage::localStorageVisibility() QSignalSpy loadSpy2(&webPage2, &QWebEnginePage::loadFinished); webPage1.setHtml(QString("test"), QUrl("http://www.example.com/")); webPage2.setHtml(QString("test"), QUrl("http://www.example.com/")); - QTRY_COMPARE(loadSpy1.count(), 1); - QTRY_COMPARE(loadSpy2.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy1.count(), 1, 20000); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy2.count(), 1, 20000); // The attribute determines the visibility of the window.localStorage object. QVERIFY(evaluateJavaScriptSync(&webPage1, QString("(window.localStorage != undefined)")).toBool()); @@ -900,7 +900,7 @@ void tst_QWebEnginePage::testJSPrompt() bool res; QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); page.setHtml(QStringLiteral("")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); // OK + QString() res = evaluateJavaScriptSync(&page, @@ -1037,7 +1037,7 @@ void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks() CallbackSpy spy5; QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool))); m_view->setHtml(QString("
abcdefg abcdefg abcdefg abcdefg abcdefg
")); - QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000); m_page->findText("abcde", 0, spy1.ref()); m_page->findText("abcd", 0, spy2.ref()); m_page->findText("abc", 0, spy3.ref()); @@ -1339,7 +1339,7 @@ void tst_QWebEnginePage::loadSignalsOrder() QSignalSpy spyLoadSpy(&loadSpy, &SpyForLoadSignalsOrder::started); QVERIFY(spyLoadSpy.wait(500)); page.load(url); - QTRY_VERIFY(loadSpy.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(loadSpy.isFinished(), 20000); } void tst_QWebEnginePage::renderWidgetHostViewNotShowTopLevel() @@ -1486,7 +1486,7 @@ void tst_QWebEnginePage::getUserMediaRequest() QVERIFY(QTest::qWaitForWindowExposed(&view)); } - QTRY_VERIFY_WITH_TIMEOUT(page.loadSucceeded(), 20000); + QTRY_VERIFY_WITH_TIMEOUT(page.loadSucceeded(), 60000); page.settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true); // 1. Rejecting request on C++ side should reject promise on JS side. @@ -1827,7 +1827,7 @@ void tst_QWebEnginePage::runJavaScriptDisabled() // Settings changes take effect asynchronously. The load and wait ensure // that the settings are applied by the time we start to execute JavaScript. page.load(QStringLiteral("about:blank")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000); QCOMPARE(evaluateJavaScriptSyncInWorld(&page, QStringLiteral("1+1"), QWebEngineScript::MainWorld), QVariant()); QCOMPARE(evaluateJavaScriptSyncInWorld(&page, QStringLiteral("1+1"), QWebEngineScript::ApplicationWorld), @@ -1953,7 +1953,7 @@ void tst_QWebEnginePage::symmetricUrl() // loading is _not_ immediate, so the text isn't set just yet. QVERIFY(toPlainTextSync(view.page()).isEmpty()); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000); QCOMPARE(view.history()->count(), 1); QCOMPARE(toPlainTextSync(view.page()), QString("Test")); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 31438996f..044fac9d7 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -3125,7 +3125,7 @@ void tst_QWebEngineView::webUIURLs() view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool))); view.load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 12000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000); QCOMPARE(loadFinishedSpy.takeFirst().at(0).toBool(), supported); } diff --git a/tests/auto/widgets/schemes/tst_schemes.cpp b/tests/auto/widgets/schemes/tst_schemes.cpp index 6da34efd8..1b6093571 100644 --- a/tests/auto/widgets/schemes/tst_schemes.cpp +++ b/tests/auto/widgets/schemes/tst_schemes.cpp @@ -103,7 +103,7 @@ void tst_Schemes::unknownUrlSchemePolicy() }); } - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2, 15000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2, 60000); QCOMPARE(page.acceptNavigationRequestCalls, shouldAccept ? 1 : 0); } } -- cgit v1.2.3 From a935e06da0c0bd42be5b08a5ca871b75ee25d267 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 6 Nov 2019 14:24:35 +0100 Subject: Handle MSVC CI slowness in tst_origins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test now reports it would succeed with a longer timeout on loading. This should be investigated later as the timeout is really out of line, or what should be acceptable. Task-number: QTBUG-79852 Fixes: QTBUG-79719 Change-Id: I60c1e6e0f7026b5ad61db2e22512dd45e1162e1c Reviewed-by: Michael Brüning --- tests/auto/widgets/origins/tst_origins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp index 434d16495..c63f4d690 100644 --- a/tests/auto/widgets/origins/tst_origins.cpp +++ b/tests/auto/widgets/origins/tst_origins.cpp @@ -233,7 +233,7 @@ private: { QSignalSpy spy(m_page, &QWebEnginePage::loadFinished); m_page->load(url); - [&spy]() { QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), 30000); }(); + [&spy]() { QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), 90000); }(); return !spy.isEmpty() && spy.front().value(0).toBool(); } -- cgit v1.2.3 From 7f1a6eede94d448436d42691d76e4fd76190b5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 29 Oct 2019 16:22:40 +0100 Subject: Add tst_QWebEnginePage::setHtmlWithModuleImport Try importing JS modules from a setHtml page. Fixes: QTBUG-77282 Change-Id: I925bd3239688117c380ed3ae404dcb9547d99cac Reviewed-by: Allan Sandfeld Jensen --- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 0a65d4c02..27aa7a1f7 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -158,6 +158,7 @@ private Q_SLOTS: void setHtmlWithStylesheetResource(); void setHtmlWithBaseURL(); void setHtmlWithJSAlert(); + void setHtmlWithModuleImport(); void baseUrl_data(); void baseUrl(); void scrollPosition(); @@ -2283,6 +2284,41 @@ void tst_QWebEnginePage::setHtmlWithJSAlert() QCOMPARE(toHtmlSync(&page), html); } +void tst_QWebEnginePage::setHtmlWithModuleImport() +{ + HttpServer server; + connect(&server, &HttpServer::newRequest, [&](HttpReqRep *rr) { + if (rr->requestMethod() == "GET" && rr->requestPath() == "/fibonacci.mjs") { + rr->setResponseBody("export function fib(n) {\n" + " return n < 2 ? n : fib(n-1) + fib(n-2)\n" + "}\n"); + rr->setResponseHeader("Content-Type", "text/javascript"); + rr->sendResponse(); + } else { + rr->setResponseStatus(404); + rr->sendResponse(); + } + }); + QVERIFY(server.start()); + + QString html("\n" + " \n" + " \n" + " \n" + " \n" + "\n"); + + QWebEnginePage page; + QSignalSpy spy(&page, &QWebEnginePage::loadFinished); + page.setHtml(html, server.url()); + QVERIFY(spy.count() || spy.wait()); + + QCOMPARE(evaluateJavaScriptSync(&page, "fib7"), QVariant(13)); +} + void tst_QWebEnginePage::baseUrl_data() { QTest::addColumn("html"); -- cgit v1.2.3 From 025710fa77f80c0940705bc4ad405872b5aeecfe Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2019 10:17:41 +0100 Subject: Disable robustness again It again doesn't work and now causes extra problems, even on the intended hardware in the intended use-case. Change-Id: Ie915cb07bdbdfd1a5db83a8e565e43dfc74f042c Fixes: QTBUG-78461 Reviewed-by: Michal Klocek --- src/core/api/qtwebenginecoreglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index b27de4c23..9e2a4a5b1 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -126,7 +126,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() shareContext = new QOpenGLContext; QSurfaceFormat format = QSurfaceFormat::defaultFormat(); - format.setOption(QSurfaceFormat::ResetNotification); +// format.setOption(QSurfaceFormat::ResetNotification); shareContext->setFormat(format); shareContext->create(); qAddPostRoutine(deleteShareContext); -- cgit v1.2.3 From 85dbb7c99e25889b4b24594f46d2093c8c6febc9 Mon Sep 17 00:00:00 2001 From: Dmitriy Kuminov Date: Tue, 29 Oct 2019 11:17:38 +0100 Subject: Store favicon URL when serializing QWebEngineHistory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is to make QWebEngineHistoryItem::iconUrl of the deserialized QWebEngineHistory object return the same URL it had when serializing. Otherwise it's impossible to have favicons for URLs from the navigation history of a restored browser session until these URLs are visited again (so that Chromium refetches their favicons). These icons are usually needed much earlier - e.g. when showing a popup with the navigation history and having an icon URL allows to load it from a disk cache before visiting the page. Fixes: QTBUG-78998 Change-Id: Ief2d089d52f301826e5c131d401cafd08952a8b5 Reviewed-by: Michael Brüning --- src/core/web_contents_adapter.cpp | 26 +++++++++++++++++----- .../widgets/qwebenginehistory/resources/page5.html | 1 + .../qwebenginehistory/tst_qwebenginehistory.cpp | 8 +++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 3ad2d54d2..4cfcf6acd 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -134,7 +134,7 @@ namespace QtWebEngineCore { static const int kTestWindowWidth = 800; static const int kTestWindowHeight = 600; -static const int kHistoryStreamVersion = 3; +static const int kHistoryStreamVersion = 4; static QVariant fromJSValue(const base::Value *result) { @@ -279,6 +279,9 @@ static void serializeNavigationHistory(content::NavigationController &controller output << entry->GetIsOverridingUserAgent(); output << static_cast(entry->GetTimestamp().ToInternalValue()); output << entry->GetHttpStatusCode(); + // kHistoryStreamVersion >= 4 + content::FaviconStatus &favicon = entry->GetFavicon(); + output << (favicon.valid ? toQt(favicon.url) : QUrl()); } } } @@ -287,8 +290,8 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, { int version; input >> version; - if (version != kHistoryStreamVersion) { - // We do not try to decode previous history stream versions. + if (version < 3 || version > kHistoryStreamVersion) { + // We do not try to decode history stream versions before 3. // Make sure that our history is cleared and mark the rest of the stream as invalid. input.setStatus(QDataStream::ReadCorruptData); *currentIndex = -1; @@ -301,7 +304,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, entries->reserve(count); // Logic taken from SerializedNavigationEntry::ReadFromPickle and ToNavigationEntries. for (int i = 0; i < count; ++i) { - QUrl virtualUrl, referrerUrl, originalRequestUrl; + QUrl virtualUrl, referrerUrl, originalRequestUrl, iconUrl; QString title; QByteArray pageState; qint32 transitionType, referrerPolicy; @@ -319,6 +322,9 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, input >> isOverridingUserAgent; input >> timestamp; input >> httpStatusCode; + // kHistoryStreamVersion >= 4 + if (version >= 4) + input >> iconUrl; // If we couldn't unpack the entry successfully, abort everything. if (input.status() != QDataStream::Ok) { @@ -351,6 +357,14 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, entry->SetIsOverridingUserAgent(isOverridingUserAgent); entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); entry->SetHttpStatusCode(httpStatusCode); + if (iconUrl.isValid()) { + // Note: we don't set .image below as we don't have it and chromium will refetch favicon + // anyway. However, we set .url and .valid to let QWebEngineHistory items restored from + // a stream receive valid icon URLs via our getNavigationEntryIconUrl calls. + content::FaviconStatus &favicon = entry->GetFavicon(); + favicon.url = toGurl(iconUrl); + favicon.valid = true; + } entries->push_back(std::move(entry)); } } @@ -778,7 +792,7 @@ QUrl WebContentsAdapter::iconUrl() const { CHECK_INITIALIZED(QUrl()); if (content::NavigationEntry* entry = m_webContents->GetController().GetVisibleEntry()) { - content::FaviconStatus favicon = entry->GetFavicon(); + content::FaviconStatus &favicon = entry->GetFavicon(); if (favicon.valid) return toQt(favicon.url); } @@ -935,7 +949,7 @@ QUrl WebContentsAdapter::getNavigationEntryIconUrl(int index) content::NavigationEntry *entry = m_webContents->GetController().GetEntryAtIndex(index); if (!entry) return QUrl(); - content::FaviconStatus favicon = entry->GetFavicon(); + content::FaviconStatus &favicon = entry->GetFavicon(); return favicon.valid ? toQt(favicon.url) : QUrl(); } diff --git a/tests/auto/widgets/qwebenginehistory/resources/page5.html b/tests/auto/widgets/qwebenginehistory/resources/page5.html index 859355279..cad6d964e 100644 --- a/tests/auto/widgets/qwebenginehistory/resources/page5.html +++ b/tests/auto/widgets/qwebenginehistory/resources/page5.html @@ -1 +1,2 @@ + page5

page5

diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index 6209401cb..bdb486793 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -51,6 +51,7 @@ public Q_SLOTS: private Q_SLOTS: void title(); void lastVisited(); + void iconUrl(); void count(); void back(); void forward(); @@ -126,6 +127,11 @@ void tst_QWebEngineHistory::lastVisited() QVERIFY(qAbs(hist->itemAt(0).lastVisited().secsTo(QDateTime::currentDateTime())) < 60); } +void tst_QWebEngineHistory::iconUrl() +{ + QTRY_COMPARE(hist->currentItem().iconUrl(), QUrl("qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png")); +} + /** * Check QWebEngineHistory::count() method */ @@ -336,6 +342,7 @@ void tst_QWebEngineHistory::serialize_3() QDateTime lastVisited(a.lastVisited()); QUrl originalUrl(a.originalUrl()); QUrl url(a.url()); + QUrl iconUrl(a.iconUrl()); save << *hist; QVERIFY(save.status() == QDataStream::Ok); @@ -351,6 +358,7 @@ void tst_QWebEngineHistory::serialize_3() QTRY_COMPARE(b.lastVisited(), lastVisited); QTRY_COMPARE(b.originalUrl(), originalUrl); QTRY_COMPARE(b.url(), url); + QTRY_COMPARE(b.iconUrl(), iconUrl); //Check if all data was read QVERIFY(load.atEnd()); -- cgit v1.2.3 From 723a0d074ef96083eecae58d3dbed78339a68402 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 11 Nov 2019 11:31:31 +0100 Subject: Doc: Update required Windows 10 SDK version to 10.0.18362 Change-Id: Iff9de7663918999eebf8dd55789782f2a12f7111 Reviewed-by: Michal Klocek --- src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 5d32fa6c7..1b8320c0c 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -75,7 +75,7 @@ \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 + \li Windows 10 SDK version 10.0.18362 or later \endlist \QWE can only be built on 64-bit Windows, with a x64-bit toolchain. -- cgit v1.2.3 From 6b25e22685cfe434bb17db006c33db7341ca7028 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2019 13:20:57 +0100 Subject: Code-style cleanup in src/core/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picking suggested changes for a clang-format run. Change-Id: I3539dee65f153257015af4a8670312e74980a9e4 Reviewed-by: Michael Brüning --- src/core/net/client_cert_override.h | 2 - src/core/net/client_cert_store_data.cpp | 5 +- src/core/net/client_cert_store_data.h | 8 ++- src/core/net/cookie_monster_delegate_qt.cpp | 26 ++++---- src/core/net/cookie_monster_delegate_qt.h | 20 ++++--- src/core/net/custom_protocol_handler.h | 3 +- src/core/net/network_delegate_qt.cpp | 75 ++++++++++-------------- src/core/net/network_delegate_qt.h | 50 +++++++++------- src/core/net/proxy_config_service_qt.cpp | 16 ++--- src/core/net/proxy_config_service_qt.h | 8 +-- src/core/net/qrc_url_scheme_handler.h | 3 +- src/core/net/restricted_cookie_manager_qt.cpp | 5 +- src/core/net/restricted_cookie_manager_qt.h | 6 +- src/core/net/ssl_host_state_delegate_qt.cpp | 19 +++--- src/core/net/ssl_host_state_delegate_qt.h | 20 ++++--- src/core/net/url_request_context_getter_qt.h | 4 +- src/core/net/url_request_custom_job.cpp | 6 +- src/core/net/url_request_custom_job.h | 9 +-- src/core/net/url_request_custom_job_delegate.cpp | 2 +- src/core/net/url_request_custom_job_delegate.h | 5 +- src/core/net/url_request_custom_job_proxy.h | 4 +- src/core/net/url_request_notification.cpp | 19 +++--- src/core/net/url_request_notification.h | 3 +- src/core/net/webui_controller_factory_qt.cpp | 6 +- src/core/net/webui_controller_factory_qt.h | 5 +- 25 files changed, 168 insertions(+), 161 deletions(-) diff --git a/src/core/net/client_cert_override.h b/src/core/net/client_cert_override.h index 4f2734485..7fd28eaeb 100644 --- a/src/core/net/client_cert_override.h +++ b/src/core/net/client_cert_override.h @@ -71,5 +71,3 @@ private: } // QtWebEngineCore #endif - - diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 5a62cb6fe..314e64145 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -59,7 +59,8 @@ namespace { -class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate { +class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate +{ public: SSLPlatformKeyOverride(const QByteArray &sslKeyInBytes) { @@ -126,7 +127,7 @@ scoped_refptr wrapOpenSSLPrivateKey(const QByteArray &sslKey net::GetSSLPlatformKeyTaskRunner()); } -} // namespace +} // namespace namespace QtWebEngineCore { diff --git a/src/core/net/client_cert_store_data.h b/src/core/net/client_cert_store_data.h index 7f83f4b60..e47a909e4 100644 --- a/src/core/net/client_cert_store_data.h +++ b/src/core/net/client_cert_store_data.h @@ -57,8 +57,10 @@ class X509Certificate; namespace QtWebEngineCore { -struct ClientCertificateStoreData { - struct Entry { +struct ClientCertificateStoreData +{ + struct Entry + { QSslKey key; QSslCertificate certificate; scoped_refptr certPtr; @@ -69,7 +71,7 @@ struct ClientCertificateStoreData { void remove(const QSslCertificate &certificate); void clear(); - QVector extraCerts; + QVector extraCerts; }; } // namespace QtWebEngineCore diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 5f7b75f57..dad9a8db5 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -52,7 +52,8 @@ namespace QtWebEngineCore { -static GURL sourceUrlForCookie(const QNetworkCookie &cookie) { +static GURL sourceUrlForCookie(const QNetworkCookie &cookie) +{ QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path()); return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure()); } @@ -70,11 +71,10 @@ CookieMonsterDelegateQt::~CookieMonsterDelegateQt() void CookieMonsterDelegateQt::AddStore(net::CookieStore *store) { - std::unique_ptr sub = - store->GetChangeDispatcher().AddCallbackForAllChanges( + std::unique_ptr sub = store->GetChangeDispatcher().AddCallbackForAllChanges( base::Bind(&CookieMonsterDelegateQt::OnCookieChanged, - // this object's destruction will deregister the subscription. - base::Unretained(this))); + // this object's destruction will deregister the subscription. + base::Unretained(this))); m_subscriptions.push_back(std::move(sub)); } @@ -87,7 +87,7 @@ bool CookieMonsterDelegateQt::hasCookieMonster() void CookieMonsterDelegateQt::getAllCookies(quint64 callbackId) { net::CookieMonster::GetCookieListCallback callback = - base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId); + base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId); base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesOnIOThread, this, std::move(callback))); @@ -115,9 +115,8 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie gurl, cookie.toRawForm().toStdString(), std::move(callback))); } -void CookieMonsterDelegateQt::SetCookieOnIOThread( - const GURL& url, const std::string& cookie_line, - net::CookieMonster::SetCookiesCallback callback) +void CookieMonsterDelegateQt::SetCookieOnIOThread(const GURL &url, const std::string &cookie_line, + net::CookieMonster::SetCookiesCallback callback) { net::CookieOptions options; options.set_include_httponly(); @@ -138,7 +137,7 @@ void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const Q gurl, cookie.name().toStdString())); } -void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name) +void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name) { if (m_cookieMonster) { net::CookieMonster::GetCookieListCallback callback = @@ -147,7 +146,8 @@ void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std: } } -void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList) +void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies, + const net::CookieStatusList &statusList) { Q_UNUSED(statusList); if (!m_cookieMonster) @@ -197,7 +197,7 @@ void CookieMonsterDelegateQt::DeleteAllOnIOThread(net::CookieMonster::DeleteCall m_cookieMonster->DeleteAllAsync(std::move(callback)); } -void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster) +void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster *monster) { if (monster == m_cookieMonster) return; @@ -246,7 +246,7 @@ bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUr return m_client->d_func()->canAccessCookies(firstPartyUrl, url); } -void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, net::CookieChangeCause cause) +void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieChangeCause cause) { if (!m_client) return; diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index 2ac04acb4..23b803790 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -72,13 +72,14 @@ namespace QtWebEngineCore { // cookies for the file:// scheme, which is disabled by default in Chromium. // Since qrc:// is similar to file:// and there are some unknowns about how // to correctly handle file:// cookies, qrc:// should only be used for testing. -static const char* const kCookieableSchemes[] = - { "http", "https", "qrc", "ws", "wss" }; +static const char *const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; -class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe { +class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe +{ QPointer m_client; net::CookieMonster *m_cookieMonster; std::vector> m_subscriptions; + public: CookieMonsterDelegateQt(); ~CookieMonsterDelegateQt(); @@ -91,7 +92,7 @@ public: void deleteSessionCookies(quint64 callbackId); void deleteAllCookies(quint64 callbackId); - void setCookieMonster(net::CookieMonster* monster); + void setCookieMonster(net::CookieMonster *monster); void setClient(QWebEngineCookieStore *client); bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const; @@ -102,13 +103,16 @@ public: private: void GetAllCookiesOnIOThread(net::CookieMonster::GetCookieListCallback callback); - void SetCookieOnIOThread(const GURL& url, const std::string& cookie_line, net::CookieMonster::SetCookiesCallback callback); - void DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name); + void SetCookieOnIOThread(const GURL &url, const std::string &cookie_line, + net::CookieMonster::SetCookiesCallback callback); + void DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name); void DeleteSessionCookiesOnIOThread(net::CookieMonster::DeleteCallback callback); void DeleteAllOnIOThread(net::CookieMonster::DeleteCallback callback); - void GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList); - void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies, const net::CookieStatusList &statusList); + void GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies, + const net::CookieStatusList &statusList); + void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies, + const net::CookieStatusList &statusList); void SetCookieCallbackOnIOThread(qint64 callbackId, net::CanonicalCookie::CookieInclusionStatus status); void DeleteCookiesCallbackOnIOThread(qint64 callbackId, uint numCookies); diff --git a/src/core/net/custom_protocol_handler.h b/src/core/net/custom_protocol_handler.h index 7b189763c..625afc1d5 100644 --- a/src/core/net/custom_protocol_handler.h +++ b/src/core/net/custom_protocol_handler.h @@ -71,7 +71,8 @@ class ProfileAdapter; // Implements a ProtocolHandler for custom URL schemes. // If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED. -class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { +class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler +{ public: CustomProtocolHandler(QPointer profileAdapter); diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp index 772ef06aa..7d3801ffe 100644 --- a/src/core/net/network_delegate_qt.cpp +++ b/src/core/net/network_delegate_qt.cpp @@ -141,7 +141,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet // quick peek if deprecated if (m_profileIOData->isInterceptorDeprecated()) { - QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->acquireInterceptor(); + QWebEngineUrlRequestInterceptor *profileInterceptor = m_profileIOData->acquireInterceptor(); if (profileInterceptor && m_profileIOData->isInterceptorDeprecated()) { profileInterceptor->interceptRequest(requestInfo); m_profileIOData->releaseInterceptor(); @@ -197,25 +197,19 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet return net::ERR_IO_PENDING; } -void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest*) -{ -} +void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest *) {} -void NetworkDelegateQt::OnCompleted(net::URLRequest */*request*/, bool /*started*/, int /*net_error*/) -{ -} +void NetworkDelegateQt::OnCompleted(net::URLRequest * /*request*/, bool /*started*/, int /*net_error*/) {} -bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest& request, - const net::CanonicalCookie & /*cookie*/, - net::CookieOptions*, - bool allowedFromCaller) +bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie & /*cookie*/, + net::CookieOptions *, bool allowedFromCaller) { if (!allowedFromCaller) return false; return canSetCookies(request.site_for_cookies(), request.url(), std::string()); } -bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const net::CookieList&, bool allowedFromCaller) +bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest &request, const net::CookieList &, bool allowedFromCaller) { if (!allowedFromCaller) return false; @@ -225,8 +219,8 @@ bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const ne bool NetworkDelegateQt::OnForcePrivacyMode(const GURL &url, const GURL &site_for_cookies) const { return false; -// FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72) -// return !canGetCookies(site_for_cookies, url); + // FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72) + // return !canGetCookies(site_for_cookies, url); } bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const @@ -246,71 +240,64 @@ int NetworkDelegateQt::OnBeforeStartTransaction(net::URLRequest *, net::Completi return net::OK; } -void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, - const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) -{ -} +void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info, + const net::ProxyRetryInfoMap &proxy_retry_info, + net::HttpRequestHeaders *headers) +{} -void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) -{ -} +void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) {} -int NetworkDelegateQt::OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr*, GURL*) +int NetworkDelegateQt::OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *, + scoped_refptr *, GURL *) { return net::OK; } -void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest*, const GURL&) -{ -} +void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest *, const GURL &) {} -void NetworkDelegateQt::OnResponseStarted(net::URLRequest*, int) -{ -} +void NetworkDelegateQt::OnResponseStarted(net::URLRequest *, int) {} -void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest*, int64_t) -{ -} +void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest *, int64_t) {} -void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest*, int64_t) -{ -} +void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest *, int64_t) {} -void NetworkDelegateQt::OnPACScriptError(int, const base::string16&) -{ -} +void NetworkDelegateQt::OnPACScriptError(int, const base::string16 &) {} -net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*) +net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest *, + const net::AuthChallengeInfo &, + AuthCallback, net::AuthCredentials *) { return AUTH_REQUIRED_RESPONSE_NO_ACTION; } -bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const +bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const { return true; } -bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const +bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &, + const GURL &) const { return false; } -bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin& origin) const +bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin &origin) const { return false; } -void NetworkDelegateQt::OnCanSendReportingReports(std::set origins, base::OnceCallback)> result_callback) const +void NetworkDelegateQt::OnCanSendReportingReports(std::set origins, + base::OnceCallback)> result_callback) const { std::move(result_callback).Run(std::set()); } -bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const +bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const { return false; } -bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const +bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const { return false; } diff --git a/src/core/net/network_delegate_qt.h b/src/core/net/network_delegate_qt.h index 53debadcd..f294c6c7c 100644 --- a/src/core/net/network_delegate_qt.h +++ b/src/core/net/network_delegate_qt.h @@ -54,36 +54,44 @@ namespace QtWebEngineCore { class ProfileIODataQt; -class NetworkDelegateQt : public net::NetworkDelegate { +class NetworkDelegateQt : public net::NetworkDelegate +{ ProfileIODataQt *m_profileIOData; + public: NetworkDelegateQt(ProfileIODataQt *data); // net::NetworkDelegate implementation - int OnBeforeURLRequest(net::URLRequest* request, net::CompletionOnceCallback callback, GURL* new_url) override; - void OnURLRequestDestroyed(net::URLRequest* request) override; - bool OnCanSetCookie(const net::URLRequest& request, const net::CanonicalCookie& cookie, net::CookieOptions* options, bool) override; - int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback, net::HttpRequestHeaders *headers) override; - void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, - const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override; + int OnBeforeURLRequest(net::URLRequest *request, net::CompletionOnceCallback callback, GURL *new_url) override; + void OnURLRequestDestroyed(net::URLRequest *request) override; + bool OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie &cookie, net::CookieOptions *options, + bool) override; + int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback, + net::HttpRequestHeaders *headers) override; + void OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info, + const net::ProxyRetryInfoMap &proxy_retry_info, net::HttpRequestHeaders *headers) override; void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override; - int OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr*, GURL*) override; - void OnBeforeRedirect(net::URLRequest*, const GURL&) override; - void OnResponseStarted(net::URLRequest*, int) override; - void OnNetworkBytesReceived(net::URLRequest*, int64_t) override; + int OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *, + scoped_refptr *, GURL *) override; + void OnBeforeRedirect(net::URLRequest *, const GURL &) override; + void OnResponseStarted(net::URLRequest *, int) override; + void OnNetworkBytesReceived(net::URLRequest *, int64_t) override; void OnNetworkBytesSent(net::URLRequest *, int64_t) override; void OnCompleted(net::URLRequest *request, bool started, int net_error) override; - void OnPACScriptError(int, const base::string16&) override; - net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*) override; - bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&, bool) override; - bool OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const override; - bool OnForcePrivacyMode(const GURL&, const GURL&) const override; - bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override; + void OnPACScriptError(int, const base::string16 &) override; + net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest *, const net::AuthChallengeInfo &, + AuthCallback, net::AuthCredentials *) override; + bool OnCanGetCookies(const net::URLRequest &, const net::CookieList &, bool) override; + bool OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const override; + bool OnForcePrivacyMode(const GURL &, const GURL &) const override; + bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &, + const GURL &) const override; - bool OnCanQueueReportingReport(const url::Origin& origin) const override; - void OnCanSendReportingReports(std::set origins, base::OnceCallback)> result_callback) const override; - bool OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const override; - bool OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const override; + bool OnCanQueueReportingReport(const url::Origin &origin) const override; + void OnCanSendReportingReports(std::set origins, + base::OnceCallback)> result_callback) const override; + bool OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const override; + bool OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const override; bool canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const; bool canGetCookies(const GURL &first_party, const GURL &url) const; diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index 00ff1c54d..8016c7e83 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -70,14 +70,14 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt } ProxyConfigServiceQt::ProxyConfigServiceQt(std::unique_ptr baseService, - const net::ProxyConfigWithAnnotation& initialConfig, ProxyPrefs::ConfigState initialState) - : m_baseService(baseService.release()), - m_usesSystemConfiguration(false), - m_registeredObserver(false), - m_prefConfig(initialConfig), - m_perfState(initialState) -{ -} + const net::ProxyConfigWithAnnotation &initialConfig, + ProxyPrefs::ConfigState initialState) + : m_baseService(baseService.release()) + , m_usesSystemConfiguration(false) + , m_registeredObserver(false) + , m_prefConfig(initialConfig) + , m_perfState(initialState) +{} ProxyConfigServiceQt::~ProxyConfigServiceQt() { diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h index 09e88d445..4d8619055 100644 --- a/src/core/net/proxy_config_service_qt.h +++ b/src/core/net/proxy_config_service_qt.h @@ -51,14 +51,14 @@ #include class ProxyConfigServiceQt - : public net::ProxyConfigService - , public net::ProxyConfigService::Observer { + : public net::ProxyConfigService + , public net::ProxyConfigService::Observer +{ public: - static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &); explicit ProxyConfigServiceQt(std::unique_ptr baseService, - const net::ProxyConfigWithAnnotation& initialConfig, + const net::ProxyConfigWithAnnotation &initialConfig, ProxyPrefs::ConfigState initialState); ~ProxyConfigServiceQt() override; diff --git a/src/core/net/qrc_url_scheme_handler.h b/src/core/net/qrc_url_scheme_handler.h index f6ca92879..586147cdf 100644 --- a/src/core/net/qrc_url_scheme_handler.h +++ b/src/core/net/qrc_url_scheme_handler.h @@ -45,7 +45,8 @@ namespace QtWebEngineCore { -class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler { +class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler +{ public: void requestStarted(QWebEngineUrlRequestJob *) override; }; diff --git a/src/core/net/restricted_cookie_manager_qt.cpp b/src/core/net/restricted_cookie_manager_qt.cpp index e01969f4d..7f1ca163e 100644 --- a/src/core/net/restricted_cookie_manager_qt.cpp +++ b/src/core/net/restricted_cookie_manager_qt.cpp @@ -58,7 +58,8 @@ namespace QtWebEngineCore { -class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener { +class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener +{ public: RestrictedCookieManagerListenerQt(const GURL &url, const GURL &site_for_cookies, @@ -181,4 +182,4 @@ bool RestrictedCookieManagerQt::allowCookies(const GURL &url, const GURL &site_f return m_profileIoData->canGetCookies(toQt(site_for_cookies), toQt(url)); } -} // namespace QtWebEngineCore +} // namespace QtWebEngineCore diff --git a/src/core/net/restricted_cookie_manager_qt.h b/src/core/net/restricted_cookie_manager_qt.h index a277c7c96..9154f671d 100644 --- a/src/core/net/restricted_cookie_manager_qt.h +++ b/src/core/net/restricted_cookie_manager_qt.h @@ -85,7 +85,7 @@ public: CookiesEnabledForCallback callback) override; // Internal: - bool allowCookies(const GURL& url, const GURL &site_for_cookies) const; + bool allowCookies(const GURL &url, const GURL &site_for_cookies) const; private: base::WeakPtr m_profileIoData; @@ -95,6 +95,6 @@ private: DISALLOW_COPY_AND_ASSIGN(RestrictedCookieManagerQt); }; -} // namespace QtWebEngineCore +} // namespace QtWebEngineCore -#endif // RESTRICTED_COOKIE_MANAGER_QT_H +#endif // RESTRICTED_COOKIE_MANAGER_QT_H diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp index b6cdf68dc..0885475be 100644 --- a/src/core/net/ssl_host_state_delegate_qt.cpp +++ b/src/core/net/ssl_host_state_delegate_qt.cpp @@ -67,19 +67,15 @@ bool CertPolicy::Check(const net::X509Certificate &cert, int error) const return false; } -void CertPolicy::Allow(const net::X509Certificate& cert, int error) +void CertPolicy::Allow(const net::X509Certificate &cert, int error) { net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); m_allowed[fingerprint] |= error; } -SSLHostStateDelegateQt::SSLHostStateDelegateQt() -{ -} +SSLHostStateDelegateQt::SSLHostStateDelegateQt() {} -SSLHostStateDelegateQt::~SSLHostStateDelegateQt() -{ -} +SSLHostStateDelegateQt::~SSLHostStateDelegateQt() {} void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, int error) { @@ -87,7 +83,7 @@ void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509C } // Clear all allow preferences. -void SSLHostStateDelegateQt::Clear(const base::Callback& host_filter) +void SSLHostStateDelegateQt::Clear(const base::Callback &host_filter) { if (host_filter.is_null()) { m_certPolicyforHost.clear(); @@ -107,9 +103,10 @@ void SSLHostStateDelegateQt::Clear(const base::Callback 0; } private: std::map m_allowed; }; -class SSLHostStateDelegateQt : public content::SSLHostStateDelegate { +class SSLHostStateDelegateQt : public content::SSLHostStateDelegate +{ public: SSLHostStateDelegateQt(); @@ -65,11 +67,11 @@ public: // content::SSLHostStateDelegate implementation: void AllowCert(const std::string &, const net::X509Certificate &cert, int error) override; - void Clear(const base::Callback& host_filter) override; - CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, - int error, bool *expired_previous_decision) override; - void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; - bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; + void Clear(const base::Callback &host_filter) override; + CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error, + bool *expired_previous_decision) override; + void HostRanInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override; + bool DidHostRunInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override; void RevokeUserAllowExceptions(const std::string &host) override; bool HasAllowException(const std::string &host) override; diff --git a/src/core/net/url_request_context_getter_qt.h b/src/core/net/url_request_context_getter_qt.h index b6135cb16..a6ef6eae0 100644 --- a/src/core/net/url_request_context_getter_qt.h +++ b/src/core/net/url_request_context_getter_qt.h @@ -46,11 +46,13 @@ namespace QtWebEngineCore { class ProfileIODataQt; -class URLRequestContextGetterQt : public net::URLRequestContextGetter { +class URLRequestContextGetterQt : public net::URLRequestContextGetter +{ public: URLRequestContextGetterQt(ProfileIODataQt *data); net::URLRequestContext *GetURLRequestContext() override; scoped_refptr GetNetworkTaskRunner() const override; + private: virtual ~URLRequestContextGetterQt(); ProfileIODataQt *m_profileIOData; diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 37f7de256..607e8d232 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -132,7 +132,7 @@ bool URLRequestCustomJob::GetMimeType(std::string *mimeType) const return false; } -bool URLRequestCustomJob::GetCharset(std::string* charset) +bool URLRequestCustomJob::GetCharset(std::string *charset) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (m_charset.size() > 0) { @@ -142,7 +142,7 @@ bool URLRequestCustomJob::GetCharset(std::string* charset) return false; } -void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) +void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo *info) { // Based on net::URLRequestRedirectJob::StartAsync() @@ -173,7 +173,7 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(headers)); } -bool URLRequestCustomJob::IsRedirectResponse(GURL* location, int* http_status_code, bool* /*insecure_scheme_was_upgraded*/) +bool URLRequestCustomJob::IsRedirectResponse(GURL *location, int *http_status_code, bool * /*insecure_scheme_was_upgraded*/) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (m_redirect.is_valid()) { diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index 19a1a5776..af5a6f8e0 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -53,7 +53,8 @@ class URLRequestCustomJobDelegate; class URLRequestCustomJobProxy; // A request job that handles reading custom URL schemes -class URLRequestCustomJob : public net::URLRequestJob { +class URLRequestCustomJob : public net::URLRequestJob +{ public: URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, @@ -61,11 +62,11 @@ public: QPointer profileAdapter); void Start() override; void Kill() override; - int ReadRawData(net::IOBuffer *buf, int buf_size) override; + int ReadRawData(net::IOBuffer *buf, int buf_size) override; bool GetMimeType(std::string *mimeType) const override; bool GetCharset(std::string *charset) override; - void GetResponseInfo(net::HttpResponseInfo* info) override; - bool IsRedirectResponse(GURL* location, int* http_status_code, bool* insecure_scheme_was_upgraded) override; + void GetResponseInfo(net::HttpResponseInfo *info) override; + bool IsRedirectResponse(GURL *location, int *http_status_code, bool *insecure_scheme_was_upgraded) override; protected: virtual ~URLRequestCustomJob(); diff --git a/src/core/net/url_request_custom_job_delegate.cpp b/src/core/net/url_request_custom_job_delegate.cpp index b5a7a55a7..f73296cf0 100644 --- a/src/core/net/url_request_custom_job_delegate.cpp +++ b/src/core/net/url_request_custom_job_delegate.cpp @@ -117,7 +117,7 @@ void URLRequestCustomJobDelegate::redirect(const QUrl &url) void URLRequestCustomJobDelegate::fail(Error error) { - int net_error = 0; + int net_error = 0; switch (error) { case NoError: break; diff --git a/src/core/net/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h index 0ab1a82c7..93ae39e84 100644 --- a/src/core/net/url_request_custom_job_delegate.h +++ b/src/core/net/url_request_custom_job_delegate.h @@ -64,7 +64,8 @@ namespace QtWebEngineCore { class URLRequestCustomJobProxy; -class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject +{ Q_OBJECT public: ~URLRequestCustomJobDelegate(); @@ -84,7 +85,7 @@ public: QMap requestHeaders() const; void reply(const QByteArray &contentType, QIODevice *device); - void redirect(const QUrl& url); + void redirect(const QUrl &url); void abort(); void fail(Error); diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h index aa55db07c..d4cd7e208 100644 --- a/src/core/net/url_request_custom_job_proxy.h +++ b/src/core/net/url_request_custom_job_proxy.h @@ -56,8 +56,8 @@ class ProfileAdapter; // Used to comunicate between URLRequestCustomJob living on the IO thread // and URLRequestCustomJobDelegate living on the UI thread. -class URLRequestCustomJobProxy - : public base::RefCountedThreadSafe { +class URLRequestCustomJobProxy : public base::RefCountedThreadSafe +{ public: URLRequestCustomJobProxy(URLRequestCustomJob *job, diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp index 9d309e314..fa6d61f65 100644 --- a/src/core/net/url_request_notification.cpp +++ b/src/core/net/url_request_notification.cpp @@ -53,11 +53,13 @@ namespace QtWebEngineCore { // Calls cancel() when the URLRequest is destroyed. -class UserData : public base::SupportsUserData::Data { +class UserData : public base::SupportsUserData::Data +{ public: UserData(URLRequestNotification *ptr) : m_ptr(ptr) {} ~UserData() { m_ptr->cancel(); } static const char key[]; + private: URLRequestNotification *m_ptr; }; @@ -69,13 +71,10 @@ static content::ResourceType fromQt(QWebEngineUrlRequestInfo::ResourceType resou return static_cast(resourceType); } -URLRequestNotification::URLRequestNotification(net::URLRequest *request, - bool isMainFrameRequest, - GURL *newUrl, - QWebEngineUrlRequestInfo &&requestInfo, - content::ResourceRequestInfo::WebContentsGetter webContentsGetter, - net::CompletionOnceCallback callback, - QPointer adapter) +URLRequestNotification::URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, GURL *newUrl, + QWebEngineUrlRequestInfo &&requestInfo, + content::ResourceRequestInfo::WebContentsGetter webContentsGetter, + net::CompletionOnceCallback callback, QPointer adapter) : m_request(request) , m_isMainFrameRequest(isMainFrameRequest) , m_newUrl(newUrl) @@ -108,7 +107,7 @@ void URLRequestNotification::notify() if (webContents) { if (m_profileAdapter && m_profileAdapter->requestInterceptor()) { - QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor(); + QWebEngineUrlRequestInterceptor *interceptor = m_profileAdapter->requestInterceptor(); if (!interceptor->property("deprecated").toBool()) interceptor->interceptRequest(m_requestInfo); } @@ -152,7 +151,7 @@ void URLRequestNotification::notify() base::BindOnce(&URLRequestNotification::complete, base::Unretained(this), result)); } -void URLRequestNotification::cancel() +void URLRequestNotification::cancel() { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/src/core/net/url_request_notification.h b/src/core/net/url_request_notification.h index 1d9acf12f..673e07bf0 100644 --- a/src/core/net/url_request_notification.h +++ b/src/core/net/url_request_notification.h @@ -57,7 +57,8 @@ class ProfileAdapter; class ProfileIoDataQt; // Notifies WebContentsAdapterClient of a new URLRequest. -class URLRequestNotification { +class URLRequestNotification +{ public: URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 2bfd242e7..8c045bb7b 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -109,7 +109,7 @@ typedef std::unique_ptr (*WebUIFactoryFunction)(WebUI *web_ui, // Template for defining WebUIFactoryFunction. template -std::unique_ptr NewWebUI(WebUI *web_ui, const GURL &/*url*/) +std::unique_ptr NewWebUI(WebUI *web_ui, const GURL & /*url*/) { return std::unique_ptr(new T(web_ui)); } @@ -130,8 +130,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co return &NewWebUI; if (url.SchemeIs(content::kChromeDevToolsScheme)) { -// if (!DevToolsUIBindings::IsValidFrontendURL(url)) -// return nullptr; + // if (!DevToolsUIBindings::IsValidFrontendURL(url)) + // return nullptr; return &NewWebUI; } if (url.host() == chrome::kChromeUIAccessibilityHost) diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index 20ea62193..1cc76349b 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -55,7 +55,8 @@ class RefCountedMemory; namespace QtWebEngineCore { -class WebUIControllerFactoryQt : public content::WebUIControllerFactory { +class WebUIControllerFactoryQt : public content::WebUIControllerFactory +{ public: content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) override; bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) override; @@ -76,4 +77,4 @@ private: } // namespace QtWebEngineCore -#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_ +#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_ -- cgit v1.2.3