diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:28:30 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:28:56 +0200 |
commit | c727b8dea9df50ca9a08bff483128bba6263ac65 (patch) | |
tree | b2e2b7c20ba400a33721ed86ca51a8da8e8b0d79 /src | |
parent | d364c05de52f9ab39034e56cac4e0a7981dc541d (diff) | |
parent | e3d94abf9356bb8ee6e402fb7b9813c96919faf2 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I2843a633721212850db77c772caf24e0ea82b450
Diffstat (limited to 'src')
-rw-r--r-- | src/core/api/qtwebenginecoreglobal.cpp | 2 | ||||
-rw-r--r-- | src/core/browser_context_adapter.cpp | 2 | ||||
-rw-r--r-- | src/core/network_delegate_qt.cpp | 3 | ||||
-rw-r--r-- | src/core/url_request_context_getter_qt.cpp | 171 | ||||
-rw-r--r-- | src/core/url_request_context_getter_qt.h | 39 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 1 | ||||
-rw-r--r-- | src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 60 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebengineview.cpp | 1 |
8 files changed, 222 insertions, 57 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 8f004777f..f5d1e6d39 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -79,9 +79,11 @@ QWEBENGINE_PRIVATE_EXPORT void initialize() return; } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 1)) // Bail out silently if the user did not construct a QGuiApplication. if (!qobject_cast<QGuiApplication *>(app)) return; +#endif if (app->thread() != QThread::currentThread()) { qFatal("QtWebEngine::initialize() must be called from the Qt gui thread."); diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index fe667c570..ba9d671ae 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -151,6 +151,8 @@ QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor() void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { m_requestInterceptor = interceptor; + if (m_browserContext->url_request_getter_.get()) + m_browserContext->url_request_getter_->updateRequestInterceptor(); } void BrowserContextAdapter::addClient(BrowserContextAdapterClient *adapterClient) diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index b1a2faf8d..ff0e8320c 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -90,7 +90,6 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Q_ASSERT(m_requestContextGetter); - Q_ASSERT(m_requestContextGetter->m_browserContext); const content::ResourceRequestInfo *resourceInfo = content::ResourceRequestInfo::ForRequest(request); @@ -104,7 +103,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C const QUrl qUrl = toQt(request->url()); - QWebEngineUrlRequestInterceptor* interceptor = m_requestContextGetter->m_browserContext->requestInterceptor(); + QWebEngineUrlRequestInterceptor* interceptor = m_requestContextGetter->m_requestInterceptor; if (interceptor) { QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType) , static_cast<QWebEngineUrlRequestInfo::NavigationType>(navigationType) diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index afbb66b95..579e33b66 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -91,14 +91,23 @@ using content::BrowserThread; URLRequestContextGetterQt::URLRequestContextGetterQt(QSharedPointer<BrowserContextAdapter> browserContext, content::ProtocolHandlerMap *protocolHandlers, content::URLRequestInterceptorScopedVector request_interceptors) : m_ignoreCertificateErrors(false) + , m_mutex(QMutex::Recursive) + , m_contextInitialized(false) + , m_updateAllStorage(false) + , m_updateCookieStore(false) + , m_updateHttpCache(false) + , m_updateJobFactory(true) + , m_updateUserAgent(false) , m_browserContext(browserContext) , m_baseJobFactory(0) , m_cookieDelegate(new CookieMonsterDelegateQt()) , m_requestInterceptors(std::move(request_interceptors)) { std::swap(m_protocolHandlers, *protocolHandlers); - m_cookieDelegate->setClient(m_browserContext->cookieStore()); + QMutexLocker lock(&m_mutex); + m_cookieDelegate->setClient(browserContext->cookieStore()); + setFullConfiguration(browserContext); updateStorageSettings(); } @@ -108,6 +117,23 @@ URLRequestContextGetterQt::~URLRequestContextGetterQt() delete m_proxyConfigService.fetchAndStoreAcquire(0); } + +void URLRequestContextGetterQt::setFullConfiguration(QSharedPointer<BrowserContextAdapter> browserContext) +{ + if (!browserContext) + return; + + m_requestInterceptor = browserContext->requestInterceptor(); + m_persistentCookiesPolicy = browserContext->persistentCookiesPolicy(); + m_cookiesPath = browserContext->cookiesPath(); + m_httpAcceptLanguage = browserContext->httpAcceptLanguage(); + m_httpUserAgent = browserContext->httpUserAgent(); + m_httpCacheType = browserContext->httpCacheType(); + m_httpCachePath = browserContext->httpCachePath(); + m_httpCacheMaxSize = browserContext->httpCacheMaxSize(); + m_customUrlSchemes = browserContext->customUrlSchemes(); +} + net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); @@ -117,8 +143,10 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() m_networkDelegate.reset(new NetworkDelegateQt(this)); m_urlRequestContext->set_network_delegate(m_networkDelegate.get()); - generateStorage(); + QMutexLocker lock(&m_mutex); + generateAllStorage(); generateJobFactory(); + m_contextInitialized = true; } return m_urlRequestContext.get(); @@ -127,24 +155,31 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() void URLRequestContextGetterQt::updateStorageSettings() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // m_proxyConfigService having a non-null value is used to indicate - // storage is already being updated. - if (!m_proxyConfigService.loadAcquire()) { + + QMutexLocker lock(&m_mutex); + setFullConfiguration(m_browserContext.toStrongRef()); + + if (!m_updateAllStorage) { + m_updateAllStorage = true; // We must create the proxy config service on the UI loop on Linux because it // must synchronously run on the glib message loop. This will be passed to // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). - m_proxyConfigService.storeRelease(new ProxyConfigServiceQt(net::ProxyService::CreateSystemProxyConfigService( - content::BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), - content::BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) - ))); - if (m_storage) { - content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateStorage, this)); - } + Q_ASSERT(m_proxyConfigService == 0); + m_proxyConfigService = + new ProxyConfigServiceQt( + net::ProxyService::CreateSystemProxyConfigService( + content::BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), + content::BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) + )); + if (m_contextInitialized) + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::Bind(&URLRequestContextGetterQt::generateAllStorage, this)); } } void URLRequestContextGetterQt::cancelAllUrlRequests() { + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Q_ASSERT(m_urlRequestContext); std::set<const net::URLRequest*>* url_requests = m_urlRequestContext->url_requests(); @@ -158,6 +193,17 @@ void URLRequestContextGetterQt::cancelAllUrlRequests() } +void URLRequestContextGetterQt::generateAllStorage() +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + QMutexLocker lock(&m_mutex); + generateStorage(); + generateCookieStore(); + generateUserAgent(); + generateHttpCache(); + m_updateAllStorage = false; +} + void URLRequestContextGetterQt::generateStorage() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); @@ -175,8 +221,6 @@ void URLRequestContextGetterQt::generateStorage() net::ProxyConfigService *proxyConfigService = m_proxyConfigService.fetchAndStoreAcquire(0); Q_ASSERT(proxyConfigService); - generateCookieStore(); - generateUserAgent(); m_storage->set_channel_id_service(scoped_ptr<net::ChannelIDService>(new net::ChannelIDService( new net::DefaultChannelIDStore(NULL), @@ -207,16 +251,20 @@ void URLRequestContextGetterQt::generateStorage() // Give |m_storage| ownership at the end in case it's |mapped_host_resolver|. m_storage->set_host_resolver(std::move(host_resolver)); - - generateHttpCache(); } void URLRequestContextGetterQt::updateCookieStore() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // Do not trigger an update if another is already triggered, or we are not yet initialized. - if (m_urlRequestContext && !m_proxyConfigService && !m_updateCookieStore.fetchAndStoreRelaxed(1)) - content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateCookieStore, this)); + QMutexLocker lock(&m_mutex); + m_httpAcceptLanguage = m_browserContext.data()->httpAcceptLanguage(); + m_httpUserAgent = m_browserContext.data()->httpUserAgent(); + + if (m_contextInitialized && !m_updateAllStorage && !m_updateCookieStore) { + m_updateCookieStore = true; + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::Bind(&URLRequestContextGetterQt::generateCookieStore, this)); + } } void URLRequestContextGetterQt::generateCookieStore() @@ -224,14 +272,16 @@ void URLRequestContextGetterQt::generateCookieStore() Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Q_ASSERT(m_urlRequestContext); Q_ASSERT(m_storage); - m_updateCookieStore = 0; + + QMutexLocker lock(&m_mutex); + m_updateCookieStore = false; // Unset it first to get a chance to destroy and flush the old cookie store before opening a new on possibly the same file. m_storage->set_cookie_store(0); m_cookieDelegate->setCookieMonster(0); net::CookieStore* cookieStore = 0; - switch (m_browserContext->persistentCookiesPolicy()) { + switch (m_persistentCookiesPolicy) { case BrowserContextAdapter::NoPersistentCookies: cookieStore = content::CreateCookieStore(content::CookieStoreConfig( @@ -244,7 +294,7 @@ void URLRequestContextGetterQt::generateCookieStore() case BrowserContextAdapter::AllowPersistentCookies: cookieStore = content::CreateCookieStore(content::CookieStoreConfig( - toFilePath(m_browserContext->cookiesPath()), + toFilePath(m_cookiesPath), content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, NULL, m_cookieDelegate.get()) @@ -253,7 +303,7 @@ void URLRequestContextGetterQt::generateCookieStore() case BrowserContextAdapter::ForcePersistentCookies: cookieStore = content::CreateCookieStore(content::CookieStoreConfig( - toFilePath(m_browserContext->cookiesPath()), + toFilePath(m_cookiesPath), content::CookieStoreConfig::RESTORED_SESSION_COOKIES, NULL, m_cookieDelegate.get()) @@ -270,9 +320,15 @@ void URLRequestContextGetterQt::generateCookieStore() void URLRequestContextGetterQt::updateUserAgent() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // Do not trigger an update if all storage settings are already being updated - if (m_urlRequestContext && !m_proxyConfigService) - content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateUserAgent, this)); + QMutexLocker lock(&m_mutex); + m_httpAcceptLanguage = m_browserContext.data()->httpAcceptLanguage(); + m_httpUserAgent = m_browserContext.data()->httpUserAgent(); + + if (m_contextInitialized && !m_updateAllStorage && !m_updateUserAgent) { + m_updateUserAgent = true; + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::Bind(&URLRequestContextGetterQt::generateUserAgent, this)); + } } void URLRequestContextGetterQt::generateUserAgent() @@ -281,26 +337,48 @@ void URLRequestContextGetterQt::generateUserAgent() Q_ASSERT(m_urlRequestContext); Q_ASSERT(m_storage); + QMutexLocker lock(&m_mutex); + m_updateUserAgent = true; + m_storage->set_http_user_agent_settings(scoped_ptr<net::HttpUserAgentSettings>( - new net::StaticHttpUserAgentSettings(m_browserContext->httpAcceptLanguage().toStdString(), m_browserContext->httpUserAgent().toStdString()))); + new net::StaticHttpUserAgentSettings(m_httpAcceptLanguage.toStdString(), m_httpUserAgent.toStdString()))); } void URLRequestContextGetterQt::updateHttpCache() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // Do not trigger a new update if another is already triggered - if (m_urlRequestContext && !m_proxyConfigService && !m_updateHttpCache.fetchAndStoreRelaxed(1)) - content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateHttpCache, this)); + QMutexLocker lock(&m_mutex); + m_httpCacheType = m_browserContext.data()->httpCacheType(); + m_httpCachePath = m_browserContext.data()->httpCachePath(); + m_httpCacheMaxSize = m_browserContext.data()->httpCacheMaxSize(); + + if (m_contextInitialized && !m_updateAllStorage && !m_updateHttpCache) { + m_updateHttpCache = true; + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::Bind(&URLRequestContextGetterQt::generateHttpCache, this)); + } } void URLRequestContextGetterQt::updateJobFactory() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + QMutexLocker lock(&m_mutex); + m_customUrlSchemes = m_browserContext.data()->customUrlSchemes(); - if (m_urlRequestContext && !m_updateJobFactory.fetchAndStoreRelaxed(1)) + if (m_contextInitialized && !m_updateJobFactory) { + m_updateJobFactory = true; content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, - base::Bind(&URLRequestContextGetterQt::regenerateJobFactory, - this, m_browserContext->customUrlSchemes())); + base::Bind(&URLRequestContextGetterQt::regenerateJobFactory, this)); + } +} + +void URLRequestContextGetterQt::updateRequestInterceptor() +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + QMutexLocker lock(&m_mutex); + m_requestInterceptor = m_browserContext.data()->requestInterceptor(); + + // We in this case do not need to regenerate any Chromium classes. } static bool doNetworkSessionParamsMatch(const net::HttpNetworkSession::Params &first, const net::HttpNetworkSession::Params &second) @@ -355,15 +433,18 @@ void URLRequestContextGetterQt::generateHttpCache() Q_ASSERT(m_urlRequestContext); Q_ASSERT(m_storage); + QMutexLocker lock(&m_mutex); + m_updateHttpCache = false; + net::HttpCache::DefaultBackend* main_backend = 0; - switch (m_browserContext->httpCacheType()) { + switch (m_httpCacheType) { case BrowserContextAdapter::MemoryHttpCache: main_backend = new net::HttpCache::DefaultBackend( net::MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT, base::FilePath(), - m_browserContext->httpCacheMaxSize(), + m_httpCacheMaxSize, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) ); break; @@ -372,8 +453,8 @@ void URLRequestContextGetterQt::generateHttpCache() new net::HttpCache::DefaultBackend( net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, - toFilePath(m_browserContext->httpCachePath()), - m_browserContext->httpCacheMaxSize(), + toFilePath(m_httpCachePath), + m_httpCacheMaxSize, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) ); break; @@ -393,7 +474,6 @@ void URLRequestContextGetterQt::generateHttpCache() cache = new net::HttpCache(m_httpNetworkSession.get(), scoped_ptr<net::HttpCache::DefaultBackend>(main_backend), false); m_storage->set_http_transaction_factory(scoped_ptr<net::HttpCache>(cache)); - m_updateHttpCache = 0; } void URLRequestContextGetterQt::clearHttpCache() @@ -419,6 +499,9 @@ void URLRequestContextGetterQt::generateJobFactory() Q_ASSERT(m_urlRequestContext); Q_ASSERT(!m_jobFactory); + QMutexLocker lock(&m_mutex); + m_updateJobFactory = false; + scoped_ptr<net::URLRequestJobFactoryImpl> jobFactory(new net::URLRequestJobFactoryImpl()); { @@ -437,7 +520,7 @@ void URLRequestContextGetterQt::generateJobFactory() jobFactory->SetProtocolHandler(url::kFtpScheme, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver())))); - m_installedCustomSchemes = m_browserContext->customUrlSchemes(); + m_installedCustomSchemes = m_customUrlSchemes; Q_FOREACH (const QByteArray &scheme, m_installedCustomSchemes) { jobFactory->SetProtocolHandler(scheme.toStdString(), scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new CustomProtocolHandler(m_browserContext))); } @@ -457,22 +540,24 @@ void URLRequestContextGetterQt::generateJobFactory() m_urlRequestContext->set_job_factory(m_jobFactory.get()); } -void URLRequestContextGetterQt::regenerateJobFactory(const QList<QByteArray> customSchemes) +void URLRequestContextGetterQt::regenerateJobFactory() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Q_ASSERT(m_urlRequestContext); Q_ASSERT(m_jobFactory); Q_ASSERT(m_baseJobFactory); - m_updateJobFactory.storeRelease(0); - if (customSchemes == m_installedCustomSchemes) + QMutexLocker lock(&m_mutex); + m_updateJobFactory = false; + + if (m_customUrlSchemes == m_installedCustomSchemes) return; Q_FOREACH (const QByteArray &scheme, m_installedCustomSchemes) { m_baseJobFactory->SetProtocolHandler(scheme.toStdString(), nullptr); } - m_installedCustomSchemes = customSchemes; + m_installedCustomSchemes = m_customUrlSchemes; Q_FOREACH (const QByteArray &scheme, m_installedCustomSchemes) { m_baseJobFactory->SetProtocolHandler(scheme.toStdString(), scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(new CustomProtocolHandler(m_browserContext))); } diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h index 7078c7a44..eca956ea6 100644 --- a/src/core/url_request_context_getter_qt.h +++ b/src/core/url_request_context_getter_qt.h @@ -55,9 +55,10 @@ #include "cookie_monster_delegate_qt.h" #include "network_delegate_qt.h" +#include "browser_context_adapter.h" -#include <QtCore/qglobal.h> #include <QtCore/qatomic.h> +#include <QtCore/qmutex.h> #include <QtCore/qsharedpointer.h> namespace net { @@ -67,8 +68,7 @@ class ProxyConfigService; namespace QtWebEngineCore { -class BrowserContextAdapter; - +// FIXME: This class should be split into a URLRequestContextGetter and a ProfileIOData, similar to what chrome does. class URLRequestContextGetterQt : public net::URLRequestContextGetter { public: URLRequestContextGetterQt(QSharedPointer<BrowserContextAdapter> browserContext, content::ProtocolHandlerMap *protocolHandlers, content::URLRequestInterceptorScopedVector request_interceptors); @@ -83,26 +83,36 @@ public: void updateHttpCache(); void clearHttpCache(); void updateJobFactory(); + void updateRequestInterceptor(); private: virtual ~URLRequestContextGetterQt(); // Called on the IO thread: + void generateAllStorage(); void generateStorage(); void generateCookieStore(); void generateHttpCache(); void generateUserAgent(); void generateJobFactory(); - void regenerateJobFactory(const QList<QByteArray> customSchemes); + void regenerateJobFactory(); void clearCurrentCacheBackend(); void cancelAllUrlRequests(); net::HttpNetworkSession::Params generateNetworkSessionParams(); + void setFullConfiguration(QSharedPointer<BrowserContextAdapter> browserContext); + bool m_ignoreCertificateErrors; - QAtomicInt m_updateCookieStore; - QAtomicInt m_updateHttpCache; - QAtomicInt m_updateJobFactory; - QSharedPointer<BrowserContextAdapter> m_browserContext; + + QMutex m_mutex; + bool m_contextInitialized; + bool m_updateAllStorage; + bool m_updateCookieStore; + bool m_updateHttpCache; + bool m_updateJobFactory; + bool m_updateUserAgent; + + QWeakPointer<BrowserContextAdapter> m_browserContext; content::ProtocolHandlerMap m_protocolHandlers; QAtomicPointer<net::ProxyConfigService> m_proxyConfigService; @@ -115,7 +125,20 @@ private: scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate; content::URLRequestInterceptorScopedVector m_requestInterceptors; scoped_ptr<net::HttpNetworkSession> m_httpNetworkSession; + QList<QByteArray> m_installedCustomSchemes; + QWebEngineUrlRequestInterceptor* m_requestInterceptor; + + // Configuration values to setup URLRequestContext in IO thread, copied from browserContext + // FIXME: Should later be moved to a separate ProfileIOData class. + BrowserContextAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy; + QString m_cookiesPath; + QString m_httpAcceptLanguage; + QString m_httpUserAgent; + BrowserContextAdapter::HttpCacheType m_httpCacheType; + QString m_httpCachePath; + int m_httpCacheMaxSize; + QList<QByteArray> m_customUrlSchemes; friend class NetworkDelegateQt; }; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 116cd704e..82d21696c 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -520,6 +520,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; d->webContents->GetController().LoadURLWithParams(params); d->webContents->Focus(); + d->webContents->Unselect(); } void WebContentsAdapter::save() diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index dec9d0407..4bb449016 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -46,6 +46,8 @@ \section1 Building Qt WebEngine from Source + Static builds are not supported. + The requirements for building Qt 5 modules from source are listed separately for each supported platform: @@ -58,13 +60,63 @@ In addition, the following tools are required for building the \l {Qt WebEngine} module: \list - \li Windows: Visual Studio 2013 or Visual Studio 2015 - \li Linux: Clang or GCC version 4.7 or later - \li OS X: Xcode version 5.1 or later on OS X 10.9 or later + \li \l {All Platforms} + \li \l {Windows} + \li \l {Linux} + \li \l {OS X} + \endlist + + The tests for skipping the Qt WebEngine build are located in the + \c qtwebengine repository, in the \c tools\qmake\mkspecs subdirectory. + They can be found by searching for \c skipBuild. + + \section2 All Platforms + + On all platforms, the following tools are required: + + \list + \li \l Python 2.7 or later + \li Bison, Flex + \li GPerf + \endlist + + \section2 Windows + + On Windows, Visual Studio 2013 or Visual Studio 2015 is required. + + \section2 Linux + + On Linux, Clang or GCC version 4.7 or later is required. + + Qt WebEngine requires \c pkg-config to detect most of its dependencies. The + following \c pkg-config files are required: + + \list + \li \c dbus-1 + \li \c fontconfig \endlist + If Qt was configured for \c xcb, the following \c pkg-config files are also + required: + + \list + \li \c libdrm + \li \c xcomposite + \li \c xcursor + \li \c xi + \li \c xrandr + \li \c xscrnsaver + \li \c xtst + \endlist + + Further, development packages for \c khr and \c libcap need to be installed. + + \section2 OS X + + On OS X, Xcode version 5.1 or later on OS X 10.9 or later is required. + \note Qt WebEngine cannot be built for the 32-bit mode of OS X (using the - macx-clang-32 mkspec). + \c macx-clang-32 \c mkspec). \section1 Pepper Plugin API Support diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 396e6950d..6171391e3 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -321,6 +321,7 @@ bool QWebEngineView::event(QEvent *ev) void QWebEngineView::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = page()->createStandardContextMenu(); + connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); menu->popup(event->globalPos()); } |