diff options
Diffstat (limited to 'src/webengine/api/qquickwebengineprofile.cpp')
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 186 |
1 files changed, 110 insertions, 76 deletions
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index dd405f5d7..ed2600e49 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -44,23 +44,23 @@ #include "qquickwebengineprofile_p.h" #include "qquickwebenginescript_p.h" #include "qquickwebenginesettings_p.h" +#include "qquickwebengineview_p_p.h" #include "qwebenginecookiestore.h" #include <QQmlEngine> -#include "browser_context_adapter.h" -#include <qtwebenginecoreglobal.h> +#include "profile_adapter.h" #include "renderer_host/user_resource_controller_host.h" #include "web_engine_settings.h" -using QtWebEngineCore::BrowserContextAdapter; +using QtWebEngineCore::ProfileAdapter; QT_BEGIN_NAMESPACE -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::UnknownSavePageFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::SingleHtmlSaveFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::CompleteHtmlSaveFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::MimeHtmlSaveFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat) /*! \class QQuickWebEngineProfile @@ -148,10 +148,11 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC The \a download argument holds the state of the finished download instance. */ -QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<BrowserContextAdapter> browserContext) +QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter) : m_settings(new QQuickWebEngineSettings()) - , m_browserContext(new QWebEngineBrowserContext(browserContext, this)) + , m_profileAdapter(profileAdapter) { + profileAdapter->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. @@ -160,26 +161,53 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() { - Q_FOREACH (QQuickWebEngineDownloadItem *download, m_ongoingDownloads) { + + while (!m_webContentsAdapterClients.isEmpty()) { + m_webContentsAdapterClients.first()->destroy(); + } + + if (m_profileAdapter) { + // In the case the user sets this profile as the parent of the interceptor + // it can be deleted before the browser-context still referencing it is. + m_profileAdapter->setRequestInterceptor(nullptr); + m_profileAdapter->removeClient(this); + } + + for (QQuickWebEngineDownloadItem *download : qAsConst(m_ongoingDownloads)) { if (download) download->cancel(); } m_ongoingDownloads.clear(); - if (m_browserContext) - m_browserContext->shutdown(); + if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter()) + delete m_profileAdapter; +} + +void QQuickWebEngineProfilePrivate::addWebContentsAdapterClient(QQuickWebEngineViewPrivate *adapter) +{ + m_webContentsAdapterClients.append(adapter); } -QSharedPointer<QtWebEngineCore::BrowserContextAdapter> QQuickWebEngineProfilePrivate::browserContext() const +void QQuickWebEngineProfilePrivate::removeWebContentsAdapterClient(QQuickWebEngineViewPrivate*adapter) { - return m_browserContext ? m_browserContext->browserContextRef : nullptr; + m_webContentsAdapterClients.removeAll(adapter); +} + +QtWebEngineCore::ProfileAdapter *QQuickWebEngineProfilePrivate::profileAdapter() const +{ + return m_profileAdapter; +} + +QQuickWebEngineSettings *QQuickWebEngineProfilePrivate::settings() const +{ + return m_settings.data(); } void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId) { - if (m_browserContext) - m_browserContext->browserContextRef->cancelDownload(downloadId); + if (m_profileAdapter) + m_profileAdapter->cancelDownload(downloadId); } void QQuickWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId) @@ -201,6 +229,10 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) itemPrivate->savePageFormat = static_cast<QQuickWebEngineDownloadItem::SavePageFormat>( info.savePageFormat); itemPrivate->type = static_cast<QQuickWebEngineDownloadItem::DownloadType>(info.downloadType); + if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient) + itemPrivate->view = static_cast<QQuickWebEngineViewPrivate *>(info.page)->q_ptr; + else + itemPrivate->view = nullptr; QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q); @@ -239,7 +271,7 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info download->d_func()->update(info); - if (info.state != BrowserContextAdapterClient::DownloadInProgress) { + if (info.state != ProfileAdapterClient::DownloadInProgress) { Q_EMIT q->downloadFinished(download); m_ongoingDownloads.remove(info.id); } @@ -249,7 +281,7 @@ void QQuickWebEngineProfilePrivate::userScripts_append(QQmlListProperty<QQuickWe { Q_ASSERT(p && p->data); QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->browserContext()->userResourceController(); + QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); d->m_userScripts.append(script); script->d_func()->bind(resourceController); } @@ -272,7 +304,7 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb { Q_ASSERT(p && p->data); QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->browserContext()->userResourceController(); + QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); resourceController->clearAllScripts(NULL); d->m_userScripts.clear(); } @@ -329,10 +361,8 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb */ QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent) : QObject(parent), - d_ptr(new QQuickWebEngineProfilePrivate(QSharedPointer<BrowserContextAdapter>::create(false))) + d_ptr(new QQuickWebEngineProfilePrivate(new QtWebEngineCore::ProfileAdapter())) { - // Sets up the global WebEngineContext - QQuickWebEngineProfile::defaultProfile(); d_ptr->q_ptr = this; } @@ -371,23 +401,23 @@ QQuickWebEngineProfile::~QQuickWebEngineProfile() QString QQuickWebEngineProfile::storageName() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->storageName(); + return d->profileAdapter()->storageName(); } void QQuickWebEngineProfile::setStorageName(const QString &name) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->storageName() == name) + if (d->profileAdapter()->storageName() == name) return; - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setStorageName(name); + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setStorageName(name); emit storageNameChanged(); emit persistentStoragePathChanged(); emit cachePathChanged(); - if (d->browserContext()->httpCacheType() != oldCacheType) + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -411,21 +441,21 @@ void QQuickWebEngineProfile::setStorageName(const QString &name) bool QQuickWebEngineProfile::isOffTheRecord() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->isOffTheRecord(); + return d->profileAdapter()->isOffTheRecord(); } void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->isOffTheRecord() == offTheRecord) + if (d->profileAdapter()->isOffTheRecord() == offTheRecord) return; - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setOffTheRecord(offTheRecord); + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setOffTheRecord(offTheRecord); emit offTheRecordChanged(); - if (d->browserContext()->httpCacheType() != oldCacheType) + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -454,7 +484,7 @@ void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord) QString QQuickWebEngineProfile::persistentStoragePath() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->dataPath(); + return d->profileAdapter()->dataPath(); } void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) @@ -462,7 +492,7 @@ void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) Q_D(QQuickWebEngineProfile); if (persistentStoragePath() == path) return; - d->browserContext()->setDataPath(path); + d->profileAdapter()->setDataPath(path); emit persistentStoragePathChanged(); } @@ -489,7 +519,7 @@ void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) QString QQuickWebEngineProfile::cachePath() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->cachePath(); + return d->profileAdapter()->cachePath(); } void QQuickWebEngineProfile::setCachePath(const QString &path) @@ -497,7 +527,7 @@ void QQuickWebEngineProfile::setCachePath(const QString &path) Q_D(QQuickWebEngineProfile); if (cachePath() == path) return; - d->browserContext()->setCachePath(path); + d->profileAdapter()->setCachePath(path); emit cachePathChanged(); } @@ -520,15 +550,15 @@ void QQuickWebEngineProfile::setCachePath(const QString &path) QString QQuickWebEngineProfile::httpUserAgent() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->httpUserAgent(); + return d->profileAdapter()->httpUserAgent(); } void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpUserAgent() == userAgent) + if (d->profileAdapter()->httpUserAgent() == userAgent) return; - d->browserContext()->setHttpUserAgent(userAgent); + d->profileAdapter()->setHttpUserAgent(userAgent); emit httpUserAgentChanged(); } @@ -558,15 +588,15 @@ void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent) QQuickWebEngineProfile::HttpCacheType QQuickWebEngineProfile::httpCacheType() const { const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::HttpCacheType(d->browserContext()->httpCacheType()); + return QQuickWebEngineProfile::HttpCacheType(d->profileAdapter()->httpCacheType()); } void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheType httpCacheType) { Q_D(QQuickWebEngineProfile); - BrowserContextAdapter::HttpCacheType oldCacheType = d->browserContext()->httpCacheType(); - d->browserContext()->setHttpCacheType(BrowserContextAdapter::HttpCacheType(httpCacheType)); - if (d->browserContext()->httpCacheType() != oldCacheType) + ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); + d->profileAdapter()->setHttpCacheType(ProfileAdapter::HttpCacheType(httpCacheType)); + if (d->profileAdapter()->httpCacheType() != oldCacheType) emit httpCacheTypeChanged(); } @@ -595,15 +625,15 @@ void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheT QQuickWebEngineProfile::PersistentCookiesPolicy QQuickWebEngineProfile::persistentCookiesPolicy() const { const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::PersistentCookiesPolicy(d->browserContext()->persistentCookiesPolicy()); + return QQuickWebEngineProfile::PersistentCookiesPolicy(d->profileAdapter()->persistentCookiesPolicy()); } void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy newPersistentCookiesPolicy) { Q_D(QQuickWebEngineProfile); - BrowserContextAdapter::PersistentCookiesPolicy oldPolicy = d->browserContext()->persistentCookiesPolicy(); - d->browserContext()->setPersistentCookiesPolicy(BrowserContextAdapter::PersistentCookiesPolicy(newPersistentCookiesPolicy)); - if (d->browserContext()->persistentCookiesPolicy() != oldPolicy) + ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); + d->profileAdapter()->setPersistentCookiesPolicy(ProfileAdapter::PersistentCookiesPolicy(newPersistentCookiesPolicy)); + if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) emit persistentCookiesPolicyChanged(); } @@ -628,15 +658,15 @@ void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile:: int QQuickWebEngineProfile::httpCacheMaximumSize() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->httpCacheMaxSize(); + return d->profileAdapter()->httpCacheMaxSize(); } void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpCacheMaxSize() == maximumSize) + if (d->profileAdapter()->httpCacheMaxSize() == maximumSize) return; - d->browserContext()->setHttpCacheMaxSize(maximumSize); + d->profileAdapter()->setHttpCacheMaxSize(maximumSize); emit httpCacheMaximumSizeChanged(); } @@ -657,15 +687,15 @@ void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize) QString QQuickWebEngineProfile::httpAcceptLanguage() const { Q_D(const QQuickWebEngineProfile); - return d->browserContext()->httpAcceptLanguage(); + return d->profileAdapter()->httpAcceptLanguage(); } void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage) { Q_D(QQuickWebEngineProfile); - if (d->browserContext()->httpAcceptLanguage() == httpAcceptLanguage) + if (d->profileAdapter()->httpAcceptLanguage() == httpAcceptLanguage) return; - d->browserContext()->setHttpAcceptLanguage(httpAcceptLanguage); + d->profileAdapter()->setHttpAcceptLanguage(httpAcceptLanguage); emit httpAcceptLanguageChanged(); } @@ -679,8 +709,8 @@ void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLang QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() { static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile( - new QQuickWebEngineProfilePrivate(BrowserContextAdapter::defaultContext()), - BrowserContextAdapter::globalQObjectRoot()); + new QQuickWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()), + ProfileAdapter::globalQObjectRoot()); return profile; } @@ -710,8 +740,8 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() void QQuickWebEngineProfile::setSpellCheckLanguages(const QStringList &languages) { Q_D(QQuickWebEngineProfile); - if (languages != d->browserContext()->spellCheckLanguages()) { - d->browserContext()->setSpellCheckLanguages(languages); + if (languages != d->profileAdapter()->spellCheckLanguages()) { + d->profileAdapter()->setSpellCheckLanguages(languages); emit spellCheckLanguagesChanged(); } } @@ -724,7 +754,7 @@ void QQuickWebEngineProfile::setSpellCheckLanguages(const QStringList &languages QStringList QQuickWebEngineProfile::spellCheckLanguages() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->spellCheckLanguages(); + return d->profileAdapter()->spellCheckLanguages(); } /*! @@ -745,7 +775,7 @@ void QQuickWebEngineProfile::setSpellCheckEnabled(bool enable) { Q_D(QQuickWebEngineProfile); if (enable != isSpellCheckEnabled()) { - d->browserContext()->setSpellCheckEnabled(enable); + d->profileAdapter()->setSpellCheckEnabled(enable); emit spellCheckEnabledChanged(); } } @@ -753,7 +783,7 @@ void QQuickWebEngineProfile::setSpellCheckEnabled(bool enable) bool QQuickWebEngineProfile::isSpellCheckEnabled() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->isSpellCheckEnabled(); + return d->profileAdapter()->isSpellCheckEnabled(); } /*! @@ -763,7 +793,7 @@ bool QQuickWebEngineProfile::isSpellCheckEnabled() const QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const { const Q_D(QQuickWebEngineProfile); - return d->browserContext()->cookieStore(); + return d->profileAdapter()->cookieStore(); } /*! @@ -785,7 +815,7 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const void QQuickWebEngineProfile::clearHttpCache() { Q_D(QQuickWebEngineProfile); - d->browserContext()->clearHttpCache(); + d->profileAdapter()->clearHttpCache(); } @@ -799,7 +829,7 @@ void QQuickWebEngineProfile::clearHttpCache() void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { Q_D(QQuickWebEngineProfile); - d->browserContext()->setRequestInterceptor(interceptor); + d->profileAdapter()->setRequestInterceptor(interceptor); } /*! @@ -808,8 +838,8 @@ void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestIntercept const QWebEngineUrlSchemeHandler *QQuickWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const { const Q_D(QQuickWebEngineProfile); - if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) - return d->browserContext()->customUrlSchemeHandlers().value(scheme); + if (d->profileAdapter()->customUrlSchemeHandlers().contains(scheme)) + return d->profileAdapter()->customUrlSchemeHandlers().value(scheme); return 0; } @@ -826,22 +856,26 @@ static bool checkInternalScheme(const QByteArray &scheme) /*! Registers a handler \a handler for custom URL scheme \a scheme in the profile. + + It is recommended to first register the scheme with \l + QWebEngineUrlScheme::registerScheme at application startup. */ void QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) { Q_D(QQuickWebEngineProfile); Q_ASSERT(handler); - if (checkInternalScheme(scheme)) { + QByteArray canonicalScheme = scheme.toLower(); + if (checkInternalScheme(canonicalScheme)) { qWarning("Cannot install a URL scheme handler overriding internal scheme: %s", scheme.constData()); return; } - if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) { - if (d->browserContext()->customUrlSchemeHandlers().value(scheme) != handler) + if (d->profileAdapter()->customUrlSchemeHandlers().contains(canonicalScheme)) { + if (d->profileAdapter()->customUrlSchemeHandlers().value(canonicalScheme) != handler) qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData()); return; } - d->browserContext()->addCustomUrlSchemeHandler(scheme, handler); + d->profileAdapter()->addCustomUrlSchemeHandler(canonicalScheme, handler); connect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } @@ -854,7 +888,7 @@ void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler * { Q_D(QQuickWebEngineProfile); Q_ASSERT(handler); - if (!d->browserContext()->removeCustomUrlSchemeHandler(handler)) + if (!d->profileAdapter()->removeCustomUrlSchemeHandler(handler)) return; disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } @@ -867,7 +901,7 @@ void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler * void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) { Q_D(QQuickWebEngineProfile); - QWebEngineUrlSchemeHandler *handler = d->browserContext()->takeCustomUrlSchemeHandler(scheme); + QWebEngineUrlSchemeHandler *handler = d->profileAdapter()->takeCustomUrlSchemeHandler(scheme); if (!handler) return; disconnect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); @@ -879,7 +913,7 @@ void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) void QQuickWebEngineProfile::removeAllUrlSchemeHandlers() { Q_D(QQuickWebEngineProfile); - d->browserContext()->clearCustomUrlSchemeHandlers(); + d->profileAdapter()->clearCustomUrlSchemeHandlers(); } void QQuickWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj) |