diff options
22 files changed, 219 insertions, 314 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject babffba0a1c1ee80f0ef6588df615bfd54574ad +Subproject a38b3b55d5905c1e8a429eff31a2bdf1ff2d6d0 diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index bd1d068d8..7d6c7bfbc 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -45,4 +45,4 @@ use?(system_snappy): GYP_CONFIG += use_system_snappy=1 use?(system_vpx): GYP_CONFIG += use_system_libvpx=1 use?(system_icu): GYP_CONFIG += use_system_icu=1 icu_use_data_file_flag=0 use?(system_ffmpeg): GYP_CONFIG += use_system_ffmpeg=1 - +use?(system_protobuf): GYP_CONFIG += use_system_protobuf=1 diff --git a/src/core/favicon_manager.cpp b/src/core/favicon_manager.cpp index 6cbb8bc1c..8469f054e 100644 --- a/src/core/favicon_manager.cpp +++ b/src/core/favicon_manager.cpp @@ -44,6 +44,8 @@ #include "web_contents_adapter_client.h" #include "base/bind.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkPixelRef.h" @@ -76,12 +78,12 @@ FaviconManagerPrivate::~FaviconManagerPrivate() { } -int FaviconManagerPrivate::downloadIcon(const QUrl &url, bool candidate) +int FaviconManagerPrivate::downloadIcon(const QUrl &url) { static int fakeId = 0; int id; - bool cached = candidate && m_icons.contains(url); + bool cached = m_icons.contains(url); if (isResourceUrl(url) || cached) { id = --fakeId; m_pendingRequests.insert(id, url); @@ -94,13 +96,8 @@ int FaviconManagerPrivate::downloadIcon(const QUrl &url, bool candidate) base::Bind(&FaviconManagerPrivate::iconDownloadFinished, m_weakFactory.GetWeakPtr())); } - if (candidate) { - Q_ASSERT(!m_inProgressCandidateRequests.contains(id)); - m_inProgressCandidateRequests.insert(id, url); - } else { - Q_ASSERT(!m_inProgressCustomRequests.contains(id)); - m_inProgressCustomRequests.insert(id, url); - } + Q_ASSERT(!m_inProgressRequests.contains(id)); + m_inProgressRequests.insert(id, url); return id; } @@ -118,12 +115,10 @@ void FaviconManagerPrivate::iconDownloadFinished(int id, storeIcon(id, toQIcon(bitmaps)); } -/* Pending requests are used as a workaround for avoiding signal iconChanged when - * accessing each cached icons or icons stored in qrc. They don't have to be downloaded - * thus the m_inProgressCustomRequests maybe emptied right before the next icon is added to - * in-progress-requests queue. The m_pendingRequests stores these requests until all - * candidates are added to the queue then pending requests should be cleaned up by this - * function. +/* Pending requests are used to mark icons that are already downloaded (cached icons or icons + * stored in qrc). These requests are also stored in the m_inProgressRequests but the corresponding + * icons are stored in m_icons explicitly by this function. It is necessary to avoid + * m_inProgressRequests being emptied right before the next icon is added by a downloadIcon() call. */ void FaviconManagerPrivate::downloadPendingRequests() { @@ -143,10 +138,9 @@ void FaviconManagerPrivate::downloadPendingRequests() void FaviconManagerPrivate::storeIcon(int id, const QIcon &icon) { Q_Q(FaviconManager); + Q_ASSERT(m_inProgressRequests.contains(id)); - bool candidate = m_inProgressCandidateRequests.contains(id); - - QUrl requestUrl = candidate ? m_inProgressCandidateRequests[id] : m_inProgressCustomRequests[id]; + QUrl requestUrl = m_inProgressRequests[id]; FaviconInfo &faviconInfo = q->m_faviconInfoMap[requestUrl]; unsigned iconCount = 0; @@ -168,29 +162,46 @@ void FaviconManagerPrivate::storeIcon(int id, const QIcon &icon) } } } - - q->m_hasDownloadedIcon = true; - } else if (id < 0) { - // Icon is cached - q->m_hasDownloadedIcon = true; - } else { + } else if (id >= 0) { // Reset size if icon cannot be downloaded faviconInfo.size = QSize(0, 0); } - if (candidate) { - m_inProgressCandidateRequests.remove(id); - if (m_inProgressCandidateRequests.isEmpty()) - m_viewClient->iconChanged(q->getProposedFaviconInfo().url); - } else { - m_inProgressCustomRequests.remove(id); + m_inProgressRequests.remove(id); + if (m_inProgressRequests.isEmpty()) + propagateIcon(); +} + +void FaviconManagerPrivate::propagateIcon() const +{ + Q_Q(const FaviconManager); + + QUrl iconUrl; + const QList<FaviconInfo> &faviconInfoList = q->getFaviconInfoList(true /* candidates only */); + + unsigned bestArea = 0; + for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) { + if (it->type != FaviconInfo::Favicon) + continue; + + if (it->isValid() && bestArea < area(it->size)) { + iconUrl = it->url; + bestArea = area(it->size); + } } - Q_EMIT q->iconDownloaded(requestUrl); + content::NavigationEntry *entry = m_webContents->GetController().GetVisibleEntry(); + if (entry) { + content::FaviconStatus &favicon = entry->GetFavicon(); + favicon.url = toGurl(iconUrl); + favicon.valid = true; + } + + m_viewClient->iconChanged(iconUrl); } FaviconManager::FaviconManager(FaviconManagerPrivate *d) - : m_hasDownloadedIcon(false) + : m_hasCandidate(false) { Q_ASSERT(d); d_ptr.reset(d); @@ -228,121 +239,59 @@ QList<FaviconInfo> FaviconManager::getFaviconInfoList(bool candidatesOnly) const return faviconInfoList; } - -void FaviconManager::downloadIcon(const QUrl &url, FaviconInfo::FaviconType iconType) -{ - Q_D(FaviconManager); - - // If the favicon cannot be found in the list that means that it is not a candidate - // for any visited page (including the current one). In this case the type of the icon - // is unknown: it has to be specified explicitly. - if (!m_faviconInfoMap.contains(url)) { - FaviconInfo newFaviconInfo(url, iconType); - m_faviconInfoMap.insert(url, newFaviconInfo); - } - - d->downloadIcon(url, false); - d->downloadPendingRequests(); -} - -void FaviconManager::removeIcon(const QUrl &url) -{ - Q_D(FaviconManager); - int removed = d->m_icons.remove(url); - - if (removed) { - Q_ASSERT(removed == 1); - Q_ASSERT(m_faviconInfoMap.contains(url)); - m_faviconInfoMap[url].size = QSize(0, 0); - } -} - -bool FaviconManager::hasAvailableCandidateIcon() const -{ - Q_D(const FaviconManager); - return m_hasDownloadedIcon || !d->m_inProgressCandidateRequests.isEmpty(); -} - void FaviconManager::update(const QList<FaviconInfo> &candidates) { Q_D(FaviconManager); updateCandidates(candidates); - for (auto it = m_faviconInfoMap.cbegin(), end = m_faviconInfoMap.cend(); it != end; ++it) { - const FaviconInfo &faviconInfo = it.value(); - if (!faviconInfo.candidate || faviconInfo.type != FaviconInfo::Favicon) + const QList<FaviconInfo> &faviconInfoList = getFaviconInfoList(true /* candidates only */); + for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) { + if (it->type != FaviconInfo::Favicon) continue; - if (faviconInfo.isValid()) - d->downloadIcon(faviconInfo.url, true); + if (it->isValid()) + d->downloadIcon(it->url); } d->downloadPendingRequests(); + + // Reset icon if nothing was downloaded + if (d->m_inProgressRequests.isEmpty()) { + content::NavigationEntry *entry = d->m_webContents->GetController().GetVisibleEntry(); + if (entry && !entry->GetFavicon().valid) + d->m_viewClient->iconChanged(QUrl()); + } } void FaviconManager::updateCandidates(const QList<FaviconInfo> &candidates) { + m_hasCandidate = candidates.count(); for (FaviconInfo candidateFaviconInfo : candidates) { - QUrl candidateUrl = candidateFaviconInfo.url; - if (m_faviconInfoMap.contains(candidateUrl)) { - m_faviconInfoMap[candidateUrl].candidate = true; - // Update type in case of the icon was downloaded manually + const QUrl &candidateUrl = candidateFaviconInfo.url; + + if (!m_faviconInfoMap.contains(candidateUrl)) + m_faviconInfoMap.insert(candidateUrl, candidateFaviconInfo); + else { + // The same icon can be used for more than one page with different types. m_faviconInfoMap[candidateUrl].type = candidateFaviconInfo.type; - continue; } - candidateFaviconInfo.candidate = true; - m_faviconInfoMap.insert(candidateUrl, candidateFaviconInfo); + m_faviconInfoMap[candidateUrl].candidate = true; } } void FaviconManager::resetCandidates() { - m_hasDownloadedIcon = false; + m_hasCandidate = false; for (auto it = m_faviconInfoMap.begin(), end = m_faviconInfoMap.end(); it != end; ++it) it->candidate = false; } - -FaviconInfo FaviconManager::getProposedFaviconInfo() const +bool FaviconManager::hasCandidate() const { - FaviconInfo proposedFaviconInfo = getFirstFaviconInfo(); - - // If nothing has been downloaded yet return the first favicon - // if there is available for dev-tools - if (!m_hasDownloadedIcon) - return proposedFaviconInfo; - - unsigned bestArea = area(proposedFaviconInfo.size); - for (auto it = m_faviconInfoMap.cbegin(), end = m_faviconInfoMap.cend(); it != end; ++it) { - const FaviconInfo &faviconInfo = it.value(); - if (!faviconInfo.candidate || faviconInfo.type != FaviconInfo::Favicon) - continue; - - if (faviconInfo.isValid() && bestArea < area(faviconInfo.size)) { - proposedFaviconInfo = faviconInfo; - bestArea = area(proposedFaviconInfo.size); - } - } - - return proposedFaviconInfo; + return m_hasCandidate; } -FaviconInfo FaviconManager::getFirstFaviconInfo() const -{ - for (auto it = m_faviconInfoMap.cbegin(), end = m_faviconInfoMap.cend(); it != end; ++it) { - const FaviconInfo &faviconInfo = it.value(); - if (!faviconInfo.candidate || faviconInfo.type != FaviconInfo::Favicon) - continue; - - if (faviconInfo.isValid()) - return faviconInfo; - } - - return FaviconInfo(); -} - - FaviconInfo::FaviconInfo() : url(QUrl()) diff --git a/src/core/favicon_manager.h b/src/core/favicon_manager.h index ff5c76a9b..dc702a0da 100644 --- a/src/core/favicon_manager.h +++ b/src/core/favicon_manager.h @@ -73,7 +73,7 @@ public: QUrl url; FaviconType type; - // Stores the size of the highest quality in case of multi-size icon + // Stores the largest size in case of multi-size icon QSize size; bool candidate; bool multiSize; @@ -88,25 +88,17 @@ public: QIcon getIcon(const QUrl &) const; FaviconInfo getFaviconInfo(const QUrl &) const; QList<FaviconInfo> getFaviconInfoList(bool) const; - void downloadIcon(const QUrl &url, FaviconInfo::FaviconType iconType = FaviconInfo::Favicon); - void removeIcon(const QUrl &); - -Q_SIGNALS: - void iconDownloaded(const QUrl &url); private: FaviconManager(FaviconManagerPrivate *); - bool hasAvailableCandidateIcon() const; void update(const QList<FaviconInfo> &); void updateCandidates(const QList<FaviconInfo> &); void resetCandidates(); - - FaviconInfo getProposedFaviconInfo() const; - FaviconInfo getFirstFaviconInfo() const; + bool hasCandidate() const; QMap<QUrl, FaviconInfo> m_faviconInfoMap; - bool m_hasDownloadedIcon; + bool m_hasCandidate; Q_DISABLE_COPY(FaviconManager) Q_DECLARE_PRIVATE(FaviconManager) diff --git a/src/core/favicon_manager_p.h b/src/core/favicon_manager_p.h index 8358245a2..80a012474 100644 --- a/src/core/favicon_manager_p.h +++ b/src/core/favicon_manager_p.h @@ -82,19 +82,19 @@ public: FaviconManagerPrivate(content::WebContents *, WebContentsAdapterClient *); ~FaviconManagerPrivate(); - int downloadIcon(const QUrl &, bool); + int downloadIcon(const QUrl &); void iconDownloadFinished(int, int, const GURL &, const std::vector<SkBitmap> &, const std::vector<gfx::Size> &); void storeIcon(int, const QIcon &); void downloadPendingRequests(); + void propagateIcon() const; content::WebContents *m_webContents; WebContentsAdapterClient *m_viewClient; base::WeakPtrFactory<FaviconManagerPrivate> m_weakFactory; QMap<QUrl, QIcon> m_icons; - QMap<int, QUrl> m_inProgressCandidateRequests; - QMap<int, QUrl> m_inProgressCustomRequests; + QMap<int, QUrl> m_inProgressRequests; QMap<int, QUrl> m_pendingRequests; Q_DECLARE_PUBLIC(FaviconManager) diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index 6cfafb0ca..7ed12cadb 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -8,6 +8,7 @@ 'dependencies': [ '<(chromium_src_dir)/base/base.gyp:base', '<(chromium_src_dir)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '<(chromium_src_dir)/chrome/tools/convert_dict/convert_dict.gyp:convert_dict', '<(chromium_src_dir)/components/components.gyp:devtools_discovery', '<(chromium_src_dir)/components/components.gyp:devtools_http_handler', '<(chromium_src_dir)/components/components.gyp:error_page_renderer', diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index a369f9550..51b9d5bd0 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -60,7 +60,6 @@ #include "components/web_cache/browser/web_cache_manager.h" #include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/public/browser/favicon_status.h" #include "content/public/browser/invalidate_type.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" @@ -241,16 +240,11 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame if (render_frame_host->GetParent()) return; + if (!m_faviconManager->hasCandidate()) + m_viewClient->iconChanged(QUrl()); + m_viewClient->loadProgressChanged(100); m_viewClient->loadFinished(true, toQt(validated_url)); - - content::NavigationEntry *entry = web_contents()->GetController().GetVisibleEntry(); - if (!entry) - return; - - // No available icon for the current entry - if (!entry->GetFavicon().valid && !m_faviconManager->hasAvailableCandidateIcon()) - m_viewClient->iconChanged(QUrl()); } void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<content::FaviconURL> &candidates) @@ -263,14 +257,6 @@ void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<content::Favic } m_faviconManager->update(faviconCandidates); - - content::NavigationEntry *entry = web_contents()->GetController().GetVisibleEntry(); - if (entry) { - FaviconInfo proposedFaviconInfo = m_faviconManager->getProposedFaviconInfo(); - content::FaviconStatus &favicon = entry->GetFavicon(); - favicon.url = toGurl(proposedFaviconInfo.url); - favicon.valid = proposedFaviconInfo.isValid(); - } } content::ColorChooser *WebContentsDelegateQt::OpenColorChooser(content::WebContents *source, SkColor color, const std::vector<content::ColorSuggestion> &suggestion) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 3f81f7a95..09e131272 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -58,6 +58,7 @@ #include "content/public/app/content_main.h" #include "content/public/app/content_main_runner.h" #include "content/public/browser/browser_main_runner.h" +#include "content/public/browser/plugin_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" @@ -149,6 +150,12 @@ bool usingQtQuick2DRenderer() return device == QLatin1String("softwarecontext"); } +#if defined(ENABLE_PLUGINS) +void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&) +{ +} +#endif + } // namespace namespace QtWebEngineCore { @@ -290,6 +297,16 @@ WebEngineContext::WebEngineContext() // first gets referenced on the IO thread. MediaCaptureDevicesDispatcher::GetInstance(); +#if defined(ENABLE_PLUGINS) + // Creating pepper plugins from the page (which calls PluginService::GetPluginInfoArray) + // might fail unless the page queried the list of available plugins at least once + // (which ends up calling PluginService::GetPlugins). Since the plugins list can only + // be created from the FILE thread, and that GetPluginInfoArray is synchronous, it + // can't loads plugins synchronously from the IO thread to serve the render process' request + // and we need to make sure that it happened beforehand. + content::PluginService::GetInstance()->GetPlugins(base::Bind(&dummyGetPluginCallback)); +#endif + #if defined(ENABLE_BASIC_PRINTING) m_printJobManager.reset(new printing::PrintJobManager()); #endif // defined(ENABLE_BASIC_PRINTING) diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index f1bd817b6..914b602ce 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -401,7 +401,9 @@ void QQuickWebEngineViewPrivate::urlChanged(const QUrl &url) void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url) { Q_Q(QQuickWebEngineView); - icon = url; + if (iconUrl == url) + return; + iconUrl = url; Q_EMIT q->iconChanged(); } @@ -846,7 +848,7 @@ void QQuickWebEngineView::setUrl(const QUrl& url) QUrl QQuickWebEngineView::icon() const { Q_D(const QQuickWebEngineView); - return d->icon; + return d->iconUrl; } void QQuickWebEngineView::loadHtml(const QString &html, const QUrl &baseUrl) diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index e4313a4bd..29fa9e881 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -209,7 +209,7 @@ public: QQmlComponent *contextMenuExtraItems; QtWebEngineCore::WebEngineContextMenuData contextMenuData; QUrl explicitUrl; - QUrl icon; + QUrl iconUrl; int loadProgress; bool m_fullscreenMode; bool isLoading; diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index fab2e9755..95059fad1 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -56,6 +56,11 @@ TestWebEngineView { signalName: "iconChanged" } + Image { + id: favicon + source: webEngineView.icon + } + TestCase { id: test name: "WebEngineFavicon" @@ -72,16 +77,43 @@ TestWebEngineView { iconChangedSpy.clear() } - function test_noFavicon() { + function test_faviconLoad() { compare(iconChangedSpy.count, 0) - var url = Qt.resolvedUrl("test1.html") + var url = Qt.resolvedUrl("favicon.html") webEngineView.url = url verify(webEngineView.waitForLoadSucceeded()) iconChangedSpy.wait() compare(iconChangedSpy.count, 1) + compare(favicon.width, 48) + compare(favicon.height, 48) + } + + function test_faviconLoadEncodedUrl() { + compare(iconChangedSpy.count, 0) + + var url = Qt.resolvedUrl("favicon2.html?favicon=load should work with#whitespace!") + webEngineView.url = url + verify(webEngineView.waitForLoadSucceeded()) + + iconChangedSpy.wait() + compare(iconChangedSpy.count, 1) + + compare(favicon.width, 16) + compare(favicon.height, 16) + } + + function test_noFavicon() { + compare(iconChangedSpy.count, 0) + + var url = Qt.resolvedUrl("test1.html") + webEngineView.url = url + verify(webEngineView.waitForLoadSucceeded()) + + compare(iconChangedSpy.count, 0) + var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) } @@ -93,8 +125,7 @@ TestWebEngineView { webEngineView.url = url verify(webEngineView.waitForLoadSucceeded()) - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) + compare(iconChangedSpy.count, 0) var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) @@ -107,27 +138,22 @@ TestWebEngineView { webEngineView.url = url verify(webEngineView.waitForLoadSucceeded()) - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) + compare(iconChangedSpy.count, 0) var iconUrl = webEngineView.icon - compare(iconUrl, Qt.resolvedUrl("icons/unavailable.ico")) + compare(iconUrl, Qt.resolvedUrl("")) } function test_errorPageEnabled() { - skip("Error page does not work properly: QTBUG-48995") WebEngine.settings.errorPageEnabled = true compare(iconChangedSpy.count, 0) - var url = Qt.resolvedUrl("http://non.existent/url") + var url = Qt.resolvedUrl("invalid://url") webEngineView.url = url verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded()) - iconChangedSpy.wait() - // Icon is reseted at load start. - // Load is started twice: once for unavailale page then error page - compare(iconChangedSpy.count, 2) + compare(iconChangedSpy.count, 0) var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) @@ -138,27 +164,57 @@ TestWebEngineView { compare(iconChangedSpy.count, 0) - var url = Qt.resolvedUrl("http://non.existent/url") + var url = Qt.resolvedUrl("invalid://url") webEngineView.url = url verify(webEngineView.waitForLoadFailed()) - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) + compare(iconChangedSpy.count, 0) var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) } - function test_touchIcon() { + function test_bestFavicon() { compare(iconChangedSpy.count, 0) + var url, iconUrl - var url = Qt.resolvedUrl("favicon-touch.html") + url = Qt.resolvedUrl("favicon-misc.html") webEngineView.url = url verify(webEngineView.waitForLoadSucceeded()) iconChangedSpy.wait() compare(iconChangedSpy.count, 1) + iconUrl = webEngineView.icon + // Touch icon is ignored + compare(iconUrl, Qt.resolvedUrl("icons/qt32.ico")) + compare(favicon.width, 32) + compare(favicon.height, 32) + + iconChangedSpy.clear() + + url = Qt.resolvedUrl("favicon-shortcut.html") + webEngineView.url = url + verify(webEngineView.waitForLoadSucceeded()) + + iconChangedSpy.wait() + verify(iconChangedSpy.count >= 1) + + iconUrl = webEngineView.icon + compare(iconUrl, Qt.resolvedUrl("icons/qt144.png")) + compare(favicon.width, 144) + compare(favicon.height, 144) + } + + function test_touchIcon() { + compare(iconChangedSpy.count, 0) + + var url = Qt.resolvedUrl("favicon-touch.html") + webEngineView.url = url + verify(webEngineView.waitForLoadSucceeded()) + + compare(iconChangedSpy.count, 0) + var iconUrl = webEngineView.icon compare(iconUrl, Qt.resolvedUrl("")) } diff --git a/tests/auto/quick/qmltests/data/tst_faviconImage.qml b/tests/auto/quick/qmltests/data/tst_faviconImage.qml deleted file mode 100644 index 603f76954..000000000 --- a/tests/auto/quick/qmltests/data/tst_faviconImage.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtTest 1.0 -import QtWebEngine 1.3 - -TestWebEngineView { - id: webEngineView - width: 200 - height: 400 - - SignalSpy { - id: iconChangedSpy - target: webEngineView - signalName: "iconChanged" - } - - Image { - id: faviconImage - source: webEngineView.icon - } - - TestCase { - id: test - name: "WebEngineFaviconImage" - when: windowShown - - function init() { - if (webEngineView.icon != '') { - // If this is not the first test, then load a blank page without favicon, restoring the initial state. - webEngineView.url = 'about:blank' - verify(webEngineView.waitForLoadSucceeded()) - iconChangedSpy.wait() - } - - iconChangedSpy.clear() - } - - function test_faviconImageLoad() { - compare(iconChangedSpy.count, 0) - - var url = Qt.resolvedUrl("favicon.html") - webEngineView.url = url - verify(webEngineView.waitForLoadSucceeded()) - - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) - - compare(faviconImage.width, 48) - compare(faviconImage.height, 48) - } - - function test_faviconImageLoadEncodedUrl() { - compare(iconChangedSpy.count, 0) - - var url = Qt.resolvedUrl("favicon2.html?favicon=load should work with#whitespace!") - webEngineView.url = url - verify(webEngineView.waitForLoadSucceeded()) - - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) - - compare(faviconImage.width, 16) - compare(faviconImage.height, 16) - } - - function test_bestFaviconImage() { - compare(iconChangedSpy.count, 0) - var url, iconUrl - - url = Qt.resolvedUrl("favicon-misc.html") - webEngineView.url = url - verify(webEngineView.waitForLoadSucceeded()) - - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) - - iconUrl = webEngineView.icon - // Touch icon is ignored - compare(iconUrl, Qt.resolvedUrl("icons/qt32.ico")) - compare(faviconImage.width, 32) - compare(faviconImage.height, 32) - - iconChangedSpy.clear() - - url = Qt.resolvedUrl("favicon-shortcut.html") - webEngineView.url = url - verify(webEngineView.waitForLoadSucceeded()) - - iconChangedSpy.wait() - compare(iconChangedSpy.count, 1) - - iconUrl = webEngineView.icon - compare(iconUrl, Qt.resolvedUrl("icons/qt144.png")) - compare(faviconImage.width, 144) - compare(faviconImage.height, 144) - } - } -} diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml index 7d0cc47b4..117df5776 100644 --- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml +++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml @@ -110,6 +110,7 @@ TestWebEngineView { webEngineView.reload() verify(webEngineView.waitForLoadSucceeded()) compare(JSDialogParams.dialogCount, 2) + expectFail("", "QTBUG-51749") compare(webEngineView.title, "prompt.html") } } diff --git a/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml b/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml index ae60e5f5e..86fb9281c 100644 --- a/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml +++ b/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml @@ -53,6 +53,7 @@ TestWebEngineView { } function test_keyboardModifierMapping() { + skip("runJavaScript bug: QTBUG-51746") webEngineView.url = Qt.resolvedUrl("keyboardModifierMapping.html") waitForLoadSucceeded(); titleSpy.wait() diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml index 0da9e841b..9b18870e4 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml @@ -140,7 +140,7 @@ TestWebEngineView { verify(loadRequest.isErrorPage) compare(webEngineView.url, unavailableUrl) - compare(webEngineView.title, unavailableUrl + " is not found") + compare(webEngineView.title, unavailableUrl + " failed to load") } } } diff --git a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml index beeebc049..2011d2a5c 100644 --- a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml +++ b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml @@ -44,6 +44,7 @@ TestWebEngineView { TestCase { name: "WebEngineViewRunJavaScript" function test_runJavaScript() { + skip("runJavaScript bug: QTBUG-51746") var testTitle = "Title to test runJavaScript"; runJavaScript("document.title = \"" + testTitle +"\""); _waitFor(function() { spy.count > 0; }); diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index d1849d020..d3307a339 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -39,7 +39,6 @@ OTHER_FILES += \ $$PWD/data/tst_desktopBehaviorLoadHtml.qml \ $$PWD/data/tst_download.qml \ $$PWD/data/tst_favicon.qml \ - $$PWD/data/tst_faviconImage.qml \ $$PWD/data/tst_filePicker.qml \ $$PWD/data/tst_formValidation.qml \ $$PWD/data/tst_geopermission.qml \ diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp index f435288f7..89a33134f 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp +++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp @@ -105,7 +105,7 @@ void tst_QWebEngineFaviconManager::faviconLoadFromResources() QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); - QUrl url = QUrl("qrc:/resources/favicon-single.html"); + QUrl url("qrc:/resources/favicon-single.html"); m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); @@ -124,7 +124,7 @@ void tst_QWebEngineFaviconManager::faviconLoadEncodedUrl() QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); QString urlString = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/favicon-single.html")).toString(); - QUrl url = QUrl(urlString + QLatin1String("?favicon=load should work with#whitespace!")); + QUrl url(urlString + QLatin1String("?favicon=load should work with#whitespace!")); m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); @@ -157,11 +157,11 @@ void tst_QWebEngineFaviconManager::aboutBlank() QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); - QUrl url = QUrl("about:blank"); + QUrl url("about:blank"); m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); - QTRY_COMPARE(iconUrlChangedSpy.count(), 0); + QCOMPARE(iconUrlChangedSpy.count(), 0); QVERIFY(m_page->iconUrl().isEmpty()); } @@ -178,11 +178,9 @@ void tst_QWebEngineFaviconManager::unavailableFavicon() m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); - QTRY_COMPARE(iconUrlChangedSpy.count(), 1); + QCOMPARE(iconUrlChangedSpy.count(), 0); - QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString(); - QCOMPARE(m_page->iconUrl(), iconUrl); - QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/icons/unavailable.ico"))); + QVERIFY(m_page->iconUrl().isEmpty()); } void tst_QWebEngineFaviconManager::errorPageEnabled() @@ -192,7 +190,7 @@ void tst_QWebEngineFaviconManager::errorPageEnabled() QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); - QUrl url = QUrl(QUrl("http://non.existent/url")); + QUrl url("invalid://url"); m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); @@ -208,7 +206,7 @@ void tst_QWebEngineFaviconManager::errorPageDisabled() QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); - QUrl url = QUrl(QUrl("http://non.existent/url")); + QUrl url("invalid://url"); m_page->load(url); QTRY_COMPARE(loadFinishedSpy.count(), 1); diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 5674ea3a5..b92c8af61 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -41,10 +41,16 @@ defineTest(runConfigure) { else: log("System libwebp or libwebpdemux not found. Using Chromium's copies.$${EOL}") packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += use_system_libxslt else: log("System libxml2 or libxslt not found. Using Chromium's copies.$${EOL}") - for(package, $$list("libevent jsoncpp opus")) { + for(package, $$list("libevent jsoncpp opus protobuf")) { packagesExist($$package): WEBENGINE_CONFIG += use_system_$$package else: log("System $$package not found. Using Chromium's copy.$${EOL}") } + use?(system_protobuf) { + !system("which protoc > /dev/null") { + log("Protobuf compiler not found. Using Chromium's copy of protobuf.$${EOL}") + WEBENGINE_CONFIG -= use_system_protobuf + } + } config_libvpx: WEBENGINE_CONFIG += use_system_vpx else: log("Compatible system libvpx not found. Using Chromium's copy.$${EOL}") config_srtp: WEBENGINE_CONFIG += use_system_libsrtp diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 2fb96b17d..d06b55565 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -23,16 +23,17 @@ defineTest(isPlatformSupported) { skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") } } else:osx { - lessThan(QMAKE_XCODE_VERSION, 7.0) { - skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 7.0 is required to build Qt WebEngine.") + lessThan(QMAKE_XCODE_VERSION, 5.1) { + skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 5.1 is required to build Qt WebEngine.") return(false) } - # We require OS X 10.10 (darwin version 14.0.0) or newer + # We require OS X 10.9 (darwin version 13.0.0) or newer darwin_major_version = $$section(QMAKE_HOST.version, ., 0, 0) - lessThan(darwin_major_version, 14) { - skipBuild("Qt WebEngine requires OS X version 10.10 or newer.") + lessThan(darwin_major_version, 13) { + skipBuild("Qt WebEngine requires OS X version 10.9 or newer.") return(false) } + !isOSXSDKVersionSupported(): return(false) } else { skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and OS X.") return(false) @@ -89,6 +90,25 @@ defineTest(isBuildingOnWin32) { return(false) } +defineTest(isOSXSDKVersionSupported) { + osx_sdk_product_version = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version ProductVersion 2>/dev/null") + isEmpty(osx_sdk_product_version) { + skipBuild("Could not resolve SDK product version for \'$$QMAKE_MAC_SDK\'.") + return(false) + } + major_version = $$section(osx_sdk_product_version, ., 0, 0) + minor_version = $$section(osx_sdk_product_version, ., 1, 1) + patch_version = $$section(osx_sdk_product_version, ., 2, 2) + + # Will work only for SDKs version >= 10.10.3 + greaterThan(major_version, 10):return(true) + equals(major_version, 10):greaterThan(minor_version, 10):return(true) + equals(major_version, 10):equals(minor_version, 10):greaterThan(patch_version, 2):return(true) + + skipBuild("Qt WebEngine requires an OS X SDK version 10.10.3 or newer. Current version is $${osx_sdk_product_version}.") + return(false) +} + # Map to the correct target type for gyp defineReplace(toGypTargetType) { equals(TEMPLATE, "app"):return("executable") diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 767742dc4..f5a1ed9d9 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -94,6 +94,7 @@ def isInChromiumBlacklist(file_path): not 'common/localized_error.' in file_path and not 'common/spellcheck_' in file_path and not '/spellchecker/' in file_path and + not '/tools/convert_dict/' in file_path and not file_path.endswith('cf_resources.rc') and not file_path.endswith('version.py') and not file_path.endswith('.grd') and diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 0aaaa58ee..d07ca67da 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -38,7 +38,7 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '49.0.2623.48' +chromium_version = '49.0.2623.91' chromium_branch = '2623' ninja_version = 'v1.6.0' |