summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-10-02 16:23:09 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-10-22 18:03:15 +0200
commit229621361562d0e89aeb5f2d2f0ace0115bf164c (patch)
tree4bf2425711971e24a83138cd20811cecf676eb33 /src
parentb3f9b66e6b43087873c7fc6518c0197201fd04c7 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
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 <juri.valdmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp2
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/net/url_request_custom_job.cpp20
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp15
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp9
5 files changed, 30 insertions, 18 deletions
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 <QCoreApplication>
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);