From d35dc57354a3b982e98f76816d2a2ede9981d699 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 21 Nov 2016 13:49:32 +0100 Subject: Enable viewport-meta setting again We enabled this using a command-line argument in 5.6, but that argument is no longer available in 5.7, so instead set it to match viewport enabled. Task-number: QTBUG-57206 Change-Id: Ibef9e93bc96f74429870fdb340d6ea0c0030159c Reviewed-by: Jocelyn Turcotte (Woboq GmbH) --- src/core/web_engine_settings.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core') diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index c17177745..2e0669d4e 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -298,6 +298,11 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p { // Override for now prefs->touch_enabled = isTouchScreenAvailable(); + if (prefs->viewport_enabled) { + // We should enable viewport and viewport-meta together, but since 5.7 we + // no longer have a command-line flag for viewport-meta. + prefs->viewport_meta_enabled = true; + } // Attributes mapping. prefs->loads_images_automatically = testAttribute(AutoLoadImages); -- cgit v1.2.3 From cb83d3059112b6176b9602ec84acb31ad664860b Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Wed, 21 Dec 2016 15:24:14 +0100 Subject: Prevent accessing d when view closed during DnD operation When a WebEngineView is closed while a Drag-n-Drop operation is in progress, the this pointer and its d-pointer become invalid, so the accesses after drag->exec must be prevented from being executed. To achieve this, a lambda function is connected to dragSources &QObject::destroyed signal, which invalidates a bool on the stack (and cancels the Drag-n-Drop operation). Task-number: QTBUG-57713 Change-Id: I9cbb5e6aba99e307d62773bc18f4fec5f79cf703 Reviewed-by: Joerg Bornemann --- src/core/web_contents_adapter.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index cafaad93d..91e457726 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1108,6 +1108,12 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD d->currentDropAction = Qt::IgnoreAction; QDrag *drag = new QDrag(dragSource); // will be deleted by Qt's DnD implementation + bool dValid = true; + QMetaObject::Connection onDestroyed = QObject::connect(dragSource, &QObject::destroyed, [&dValid](){ + dValid = false; + QDrag::cancel(); + }); + drag->setMimeData(mimeDataFromDropData(*d->currentDropData)); if (!pixmap.isNull()) { drag->setPixmap(pixmap); @@ -1119,9 +1125,15 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD drag->exec(allowedActions); } - content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); - rvh->DragSourceSystemDragEnded(); - d->currentDropData.reset(); + QObject::disconnect(onDestroyed); + if (dValid) { + if (d->webContents) { + content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); + if (rvh) + rvh->DragSourceSystemDragEnded(); + } + d->currentDropData.reset(); + } } static blink::WebDragOperationsMask toWeb(const Qt::DropActions action) -- cgit v1.2.3 From 8f9166df03234978e0048570d2992db669a47423 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 2 Jan 2017 17:07:39 +0100 Subject: Check RWHV for NULL before dereferencing it Under exotic circumstances, the RenderWidgetHostView pointer returned by m_webContents->GetRenderWidgetHostView() can be NULL. Therefore, it must be tested for NULL, before its SetBackgroundColor method is called. Task-number: QTBUG-57826 Change-Id: I30e0d2174e80d7971f4e2b6f315a771dc1577814 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_contents_view_qt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index ed6fdabff..0c4cf29d3 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -95,8 +95,11 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host) { // The render process is done creating the RenderView and it's ready to be routed // messages at this point. - if (m_client) - m_webContents->GetRenderWidgetHostView()->SetBackgroundColor(toSk(m_client->backgroundColor())); + if (m_client && m_webContents) { + content::RenderWidgetHostView* rwhv = m_webContents->GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetBackgroundColor(toSk(m_client->backgroundColor())); + } } void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context) -- cgit v1.2.3 From 6541025ebc76bafdcdb38da5c05708df14406396 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Wed, 4 Jan 2017 12:41:02 +0100 Subject: Replace ASSERT in FaviconManager::setIcon by return MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ASSERT in FaviconManager::setIcon can be triggered by what seems to be a race condition. Apparently the old request can be gone (so m_inProgressRequests.contains(id) is false), but m_inProgressRequests can still be non-empty, because of a new request to the same URL, so this case is not covered by checking m_inProgressRequests.isEmpty() before. Task-number: QTBUG-57900 Change-Id: I2f26c05e5c97e4bd8d1cea03e8005cf61f2b0c98 Reviewed-by: Michael BrĂ¼ning --- src/core/favicon_manager.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/favicon_manager.cpp b/src/core/favicon_manager.cpp index be8d17725..214fd5fa7 100644 --- a/src/core/favicon_manager.cpp +++ b/src/core/favicon_manager.cpp @@ -138,11 +138,9 @@ void FaviconManagerPrivate::storeIcon(int id, const QIcon &icon) Q_Q(FaviconManager); // Icon download has been interrupted - if (m_inProgressRequests.isEmpty()) + if (!m_inProgressRequests.contains(id)) return; - Q_ASSERT(m_inProgressRequests.contains(id)); - QUrl requestUrl = m_inProgressRequests[id]; FaviconInfo &faviconInfo = q->m_faviconInfoMap[requestUrl]; -- cgit v1.2.3 From 5c2cbfccf9aafb547b0b30914c4056abd25942a4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 6 Jan 2017 15:30:47 +0100 Subject: Avoid overriding new and delete As a minimum this produces valgrind warnings of mismatched new and delete. No runtime issues have been observed outside of valgrind though. Change-Id: I5ebb6b380f25f117434633e55dd7fdf04260f0bc Reviewed-by: David Faure --- src/core/config/linux.pri | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 59417997a..b91e795ca 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -21,7 +21,9 @@ GYP_CONFIG += \ use_gnome_keyring=0 \ use_kerberos=0 \ use_pango=0 \ - use_openssl=1 + use_openssl=1 \ + use_allocator=none \ + use_experimental_allocator_shim=0 use?(nss) { GYP_CONFIG += \ -- cgit v1.2.3 From 42c6033724e2b5a54702d626c57806e53f163c62 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 16 Jan 2017 14:39:09 +0100 Subject: QWebEngineDownloadItem::path() should not be percentage encoded If the name of the download item is derived from the URL, we currently end up reporting a partially percentage encoded name. This is problematic if our users try to undo the the percentage encoding and opens them out to download-folder escaping files that can install hooks in the user's home directory. [ChangeLog][DownloadItem] (QWebEngine)DownloadItem::path() was previously incorrectly returning percentage encoded file-names when the suggested path was based on URL. This has been corrected. Note percentage decoding the path generally before is not just incorrect when the path is not based on URL, but also dangerous as it can lead to downloads that escape the download folder. Task-number: QTBUG-58155 Change-Id: Ie23a4ff5d4e4c353df72e617bb2b00e1935cd6c1 Reviewed-by: Joerg Bornemann --- src/core/download_manager_delegate_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 2cbfd121b..a1445d609 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -129,7 +129,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i suggestedFilename = toQt(item->GetTargetFilePath().AsUTF8Unsafe()); if (suggestedFilename.isEmpty()) - suggestedFilename = toQt(item->GetURL().ExtractFileName()); + suggestedFilename = QUrl::fromPercentEncoding(toQByteArray(item->GetURL().ExtractFileName())); if (suggestedFilename.isEmpty()) { suggestedFilename = QStringLiteral("qwe_download"); -- cgit v1.2.3