diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-16 13:09:44 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-16 17:01:24 +0100 |
commit | 819e00f71e37f5230b9b2c2ff756db4cc4cfda5e (patch) | |
tree | ed8f247651f06581c462c6cbefde4fa097000946 /src/webengine/api | |
parent | 9ed734bfdd7b70f4f7f8e78529ead40031607f99 (diff) | |
parent | 2620f6baa55dc13d65ea0d4b09a23ddfae580279 (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/3rdparty
src/core/web_contents_adapter.cpp
src/webengine/api/qquickwebengineprofile.cpp
src/webenginewidgets/api/qwebengineprofile.cpp
tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
Change-Id: I56c093ebab5ee8b577783ce71761719159cd3ddd
Diffstat (limited to 'src/webengine/api')
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 20 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile_p.h | 7 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 57ad009b7..7f591efe3 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -142,9 +142,8 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<BrowserContextAdapter> browserContext) : m_settings(new QQuickWebEngineSettings()) - , m_browserContextRef(browserContext) + , m_browserContext(new QWebEngineBrowserContext(browserContext, this)) { - m_browserContextRef->addClient(this); m_settings->d_ptr->initDefaults(); // Fullscreen API was implemented before the supported setting, so we must // make it default true to avoid change in default API behavior. @@ -153,21 +152,26 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() { - m_browserContextRef->setRequestInterceptor(nullptr); - - m_browserContextRef->removeClient(this); - - Q_FOREACH (QQuickWebEngineDownloadItem* download, m_ongoingDownloads) { + Q_FOREACH (QQuickWebEngineDownloadItem *download, m_ongoingDownloads) { if (download) download->cancel(); } m_ongoingDownloads.clear(); + + if (m_browserContext) + m_browserContext->shutdown(); +} + +QSharedPointer<QtWebEngineCore::BrowserContextAdapter> QQuickWebEngineProfilePrivate::browserContext() const +{ + return m_browserContext ? m_browserContext->browserContextRef : nullptr; } void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId) { - browserContext()->cancelDownload(downloadId); + if (m_browserContext) + m_browserContext->browserContextRef->cancelDownload(downloadId); } void QQuickWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId) diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h index 1828f8085..660433fd9 100644 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ b/src/webengine/api/qquickwebengineprofile_p.h @@ -52,8 +52,9 @@ // #include "browser_context_adapter_client.h" -#include "qquickwebengineprofile_p.h" #include "browser_context_adapter.h" +#include "qwebenginebrowsercontext_p.h" +#include "qquickwebengineprofile_p.h" #include <QExplicitlySharedDataPointer> #include <QMap> @@ -71,7 +72,7 @@ public: QQuickWebEngineProfilePrivate(QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext); ~QQuickWebEngineProfilePrivate(); - QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext() const { return m_browserContextRef; } + QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext() const; QQuickWebEngineSettings *settings() const { return m_settings.data(); } void cancelDownload(quint32 downloadId); @@ -90,7 +91,7 @@ private: friend class QQuickWebEngineViewPrivate; QQuickWebEngineProfile *q_ptr; QScopedPointer<QQuickWebEngineSettings> m_settings; - QSharedPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef; + QPointer<QWebEngineBrowserContext> m_browserContext; QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads; QList<QQuickWebEngineScript *> m_userScripts; }; |