diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-03-11 10:25:38 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-03-11 10:25:38 +0000 |
commit | c305cc06c74cb95ef2ddfacee0ede1d82e3dbb3c (patch) | |
tree | e09e2ccbc9bda8f46737c89e8b2297061d6daade | |
parent | f658dcb0893e7869cc0c029bfe0be82838af4bb8 (diff) | |
parent | ccf12049b662fe1b03b5b0ea199d29b32f072eda (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
35 files changed, 705 insertions, 141 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 867ce4cc6..342c2c311 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,11 +1,14 @@ TEMPLATE=subdirs qtHaveModule(webengine) { - SUBDIRS += webengine/quicknanobrowser + SUBDIRS += \ + webengine/minimal \ + webengine/quicknanobrowser } qtHaveModule(webenginewidgets) { SUBDIRS += \ + webenginewidgets/minimal \ webenginewidgets/contentmanipulation \ webenginewidgets/cookiebrowser \ webenginewidgets/demobrowser \ diff --git a/examples/webengine/minimal/doc/src/minimal.qdoc b/examples/webengine/minimal/doc/src/minimal.qdoc new file mode 100644 index 000000000..c0b89ba5a --- /dev/null +++ b/examples/webengine/minimal/doc/src/minimal.qdoc @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webengine/minimal + \title WebEngine Qt Quick Minimal Example + \ingroup webengine-examples + \brief Displays a web page using the Qt Quick integration of Qt WebEngine + + \image minimal-example.png + + \e {WebEngine Qt Quick Minimal Example} demonstrates how to use the + \l{WebEngineView} item to render a web page. It shows the minimum amount of + code needed to load and display an HTML page, and can be used as a basis for + further experimentation. + + \include examples-run.qdocinc + + \section1 C++ Code + + In \c main.cpp we use only the QGuiApplication and QQmlApplicationEngine + classes. We also include \c qtwebengineglobal.h to be able to use + \l{QtWebEngine::initialize}. + + \quotefromfile webengine/minimal/main.cpp + \skipto #include + \printto main + + In the main function we first instantiate a QGuiApplication object. + We then call \l{QtWebEngine::initialize}, which makes sure that OpenGL + contexts can be shared between the main process and the dedicated renderer + process (\c QtWebEngineProcess). This method needs to be called before + any OpenGL context is created. + + Then we create a QQmlApplicationEngine, and tell it to load \c main.qml + from the \l{The Qt Resource System}{Qt Resource System}. + + Finally, QGuiApplication::exec() launches the main event loop. + + \printuntil } + + \section1 QML Code + + In \c main.qml we create the top level window, set a sensible default size + and make it visible. The window will be filled by a WebEngineView item + loading the \l{Qt Homepage}. + + \quotefromfile webengine/minimal/main.qml + \skipto import + \printuntil } + \printline } + + \section1 Requirements + + The example requires a working internet connection to render the + \l{Qt Homepage}. + An optional system proxy should be picked up automatically. +*/ diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp new file mode 100644 index 000000000..cc5a1f61e --- /dev/null +++ b/examples/webengine/minimal/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <qtwebengineglobal.h> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + QtWebEngine::initialize(); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} + diff --git a/examples/webengine/minimal/main.qml b/examples/webengine/minimal/main.qml new file mode 100644 index 000000000..f2d9f40b1 --- /dev/null +++ b/examples/webengine/minimal/main.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.0 +import QtWebEngine 1.0 + +Window { + width: 1024 + height: 750 + visible: true + WebEngineView { + anchors.fill: parent + url: "http://www.qt.io" + } +} diff --git a/examples/webengine/minimal/minimal.pro b/examples/webengine/minimal/minimal.pro new file mode 100644 index 000000000..23ce01d5b --- /dev/null +++ b/examples/webengine/minimal/minimal.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += webengine + +SOURCES += main.cpp + +RESOURCES += qml.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/webengine/minimal +INSTALLS += target diff --git a/examples/webengine/minimal/qml.qrc b/examples/webengine/minimal/qml.qrc new file mode 100644 index 000000000..0ff3892d9 --- /dev/null +++ b/examples/webengine/minimal/qml.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> + diff --git a/examples/webenginewidgets/minimal/doc/images/minimal-example.png b/examples/webenginewidgets/minimal/doc/images/minimal-example.png Binary files differnew file mode 100644 index 000000000..18ac9b177 --- /dev/null +++ b/examples/webenginewidgets/minimal/doc/images/minimal-example.png diff --git a/examples/webenginewidgets/minimal/doc/src/minimal.qdoc b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc new file mode 100644 index 000000000..22f28e604 --- /dev/null +++ b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webenginewidgets/minimal + \title WebEngine Widgets Minimal Example + \ingroup webengine-widgetexamples + \brief Displays a web page using Qt WebEngine Widgets + + \image minimal-example.png + + \e {WebEngine Widgets Minimal Example} demonstrates how to use + \l{QWebEngineView} to render a web page. It shows the minimum amount of code + needed to load and display an HTML page, and can be used as a basis for + further experimentation. + + \include examples-run.qdocinc + + \section1 The Code + + In \c main.cpp we instantiate a QApplication and a QWebEngineView. The URL + to load is set by calling \l QWebEngineView::setUrl. The view widget is + given a reasonable default size, and shown. + Finally, QApplication::exec() launches the main event loop. + + \quotefromfile webenginewidgets/minimal/main.cpp + \skipto #include + + \printuntil } + + \section1 Requirements + + The example requires a working internet connection to render + the \l{Qt Homepage}. + An optional system proxy should be picked up automatically. + However, for proxies that require a username or password, + you need to connect to + QWebEnginePage::proxyAuthenticationRequired. + + \l{Qt WebEngine Widgets} uses the \l{Qt Quick Scene Graph} to compose the + page. Therefore, OpenGL support is required. +*/ diff --git a/examples/webenginewidgets/minimal/main.cpp b/examples/webenginewidgets/minimal/main.cpp new file mode 100644 index 000000000..d9a137739 --- /dev/null +++ b/examples/webenginewidgets/minimal/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QWebEngineView> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QWebEngineView view; + view.setUrl(QUrl(QStringLiteral("http://www.qt.io"))); + view.resize(1024, 750); + view.show(); + + return app.exec(); +} diff --git a/examples/webenginewidgets/minimal/minimal.pro b/examples/webenginewidgets/minimal/minimal.pro new file mode 100644 index 000000000..849f4b9b6 --- /dev/null +++ b/examples/webenginewidgets/minimal/minimal.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += webenginewidgets + +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/minimal +INSTALLS += target diff --git a/qtwebengine.pro b/qtwebengine.pro index 5156e4620..3d20cc2f4 100644 --- a/qtwebengine.pro +++ b/qtwebengine.pro @@ -1,2 +1,12 @@ load(qt_build_config) load(qt_parts) + +OTHER_FILES = \ + tools/buildscripts/* \ + tools/scripts/* \ + tools/qmake/config.tests/khr/* \ + tools/qmake/config.tests/libcap/* \ + tools/qmake/config.tests/libvpx/* \ + tools/qmake/config.tests/snappy/* \ + tools/qmake/config.tests/srtp/* \ + tools/qmake/mkspecs/features/* diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index de6c06dd7..5685c2dcd 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -44,6 +44,7 @@ #include "permission_manager_qt.h" #include "qtwebenginecoreglobal_p.h" #include "resource_context_qt.h" +#include "ssl_host_state_delegate_qt.h" #include "type_conversion.h" #include "url_request_context_getter_qt.h" @@ -172,7 +173,9 @@ content::PushMessagingService *BrowserContextQt::GetPushMessagingService() content::SSLHostStateDelegate* BrowserContextQt::GetSSLHostStateDelegate() { - return 0; + if (!sslHostStateDelegate) + sslHostStateDelegate.reset(new SSLHostStateDelegateQt(m_adapter)); + return sslHostStateDelegate.get(); } scoped_ptr<content::ZoomLevelDelegate> BrowserContextQt::CreateZoomLevelDelegate(const base::FilePath&) diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h index 044a3adac..08ac05fd4 100644 --- a/src/core/browser_context_qt.h +++ b/src/core/browser_context_qt.h @@ -59,6 +59,7 @@ namespace QtWebEngineCore { class BrowserContextAdapter; class PermissionManagerQt; +class SSLHostStateDelegateQt; class URLRequestContextGetterQt; class BrowserContextQt : public content::BrowserContext @@ -104,6 +105,7 @@ private: scoped_ptr<content::ResourceContext> resourceContext; scoped_refptr<URLRequestContextGetterQt> url_request_getter_; scoped_ptr<PermissionManagerQt> permissionManager; + scoped_ptr<SSLHostStateDelegateQt> sslHostStateDelegate; BrowserContextAdapter *m_adapter; #if defined(ENABLE_SPELLCHECK) scoped_refptr<TestingPrefStore> m_prefStore; diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index ac476a110..7d6c7bfbc 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -43,6 +43,6 @@ use?(system_jsoncpp): GYP_CONFIG += use_system_jsoncpp=1 use?(system_opus): GYP_CONFIG += use_system_opus=1 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 +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/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 03d142c0b..f5f490ccf 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -423,13 +423,14 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont const base::Callback<void(bool)>& callback, content::CertificateRequestResultType* result) { - // We leave the result with its default value. - Q_UNUSED(result); - WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); QSharedPointer<CertificateErrorController> errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, callback))); contentsDelegate->allowCertificateError(errorController); + + // If we don't give the user a chance to allow it, we can reject it right away. + if (result && (!overridable || strict_enforcement)) + *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; } content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvider() diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 2f61e1e5e..0560c3f6b 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -97,10 +97,17 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie return new ContentRendererClientQt; } +// see icu_util.cc +#define ICU_UTIL_DATA_FILE 0 +#define ICU_UTIL_DATA_SHARED 1 +#define ICU_UTIL_DATA_STATIC 2 + bool ContentMainDelegateQt::BasicStartupComplete(int *exit_code) { PathService::Override(base::FILE_EXE, WebEngineLibraryInfo::getPath(base::FILE_EXE)); +#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE PathService::Override(base::DIR_QT_LIBRARY_DATA, WebEngineLibraryInfo::getPath(base::DIR_QT_LIBRARY_DATA)); +#endif PathService::Override(content::DIR_MEDIA_LIBS, WebEngineLibraryInfo::getPath(content::DIR_MEDIA_LIBS)); PathService::Override(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES)); #if defined(ENABLE_SPELLCHECK) diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 327ad9625..e04e34c5a 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -81,6 +81,7 @@ SOURCES = \ resource_bundle_qt.cpp \ resource_context_qt.cpp \ resource_dispatcher_host_delegate_qt.cpp \ + ssl_host_state_delegate_qt.cpp \ stream_video_node.cpp \ surface_factory_qt.cpp \ type_conversion.cpp \ @@ -160,6 +161,7 @@ HEADERS = \ renderer/web_channel_ipc_transport.h \ resource_context_qt.h \ resource_dispatcher_host_delegate_qt.h \ + ssl_host_state_delegate_qt.h \ stream_video_node.h \ surface_factory_qt.h \ type_conversion.h \ diff --git a/src/core/core_module.pro b/src/core/core_module.pro index f30af83fc..174c00afb 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -77,9 +77,9 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat INSTALLS += icu locales resources } - !contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) { + !contains(QT_CONFIG, qt_framework):!force_independent { # - # Copy essential files to the qtbase build directory (for non-installed developer builds) + # Copy essential files to the qtbase build directory for non-prefix builds # icudt2build.input = icu.files @@ -97,3 +97,11 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat QMAKE_EXTRA_COMPILERS += icudt2build resources2build } } + +OTHER_FILES = \ + $$files(../3rdparty/chromium/*.h, true) \ + $$files(../3rdparty/chromium/*.cc, true) \ + $$files(../3rdparty/chromium/*.mm, true) \ + $$files(../3rdparty/chromium/*.py, true) \ + $$files(../3rdparty/chromium/*.gyp, true) \ + $$files(../3rdparty/chromium/*.gypi, true) diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index e83db387b..02d1e41d6 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -83,9 +83,22 @@ contains(QT_ARCH, "arm") { contains(QMAKE_CFLAGS, "-mthumb"): GYP_CONFIG += arm_thumb=1 } +contains(QT_ARCH, "mips") { + !cross_compile: GYP_CONFIG += sysroot=\"\" + GYP_CONFIG += target_arch=mipsel + + contains(QMAKE_CFLAGS, "mips32r6"): mips_arch_variant=\"r6\" + else: contains(QMAKE_CFLAGS, "mips32r2"): mips_arch_variant=\"r2\" + else: contains(QMAKE_CFLAGS, "mips32"): mips_arch_variant=\"r1\" + + contains(QMAKE_CFLAGS, "-mdsp2"): GYP_CONFIG += mips_dsp_rev=2 + else: contains(QMAKE_CFLAGS, "-mdsp"): GYP_CONFIG += mips_dsp_rev=1 +} + contains(QT_ARCH, "x86_64"): GYP_CONFIG += target_arch=x64 contains(QT_ARCH, "i386"): GYP_CONFIG += target_arch=ia32 contains(QT_ARCH, "arm64"): GYP_CONFIG += target_arch=arm64 +contains(QT_ARCH, "mips64"): GYP_CONFIG += target_arch=mips64el contains(WEBENGINE_CONFIG, use_proprietary_codecs): GYP_CONFIG += proprietary_codecs=1 ffmpeg_branding=Chrome diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index be4555be2..7ed12cadb 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -134,5 +134,16 @@ 'renderer/print_web_view_helper_delegate_qt.h', ] }], + ['icu_use_data_file_flag==1', { + 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE'], + }, { # else icu_use_data_file_flag !=1 + 'conditions': [ + ['OS=="win"', { + 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_SHARED'], + }, { + 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC'], + }], + ], + }], ], } diff --git a/src/core/ssl_host_state_delegate_qt.cpp b/src/core/ssl_host_state_delegate_qt.cpp new file mode 100644 index 000000000..cf17b944c --- /dev/null +++ b/src/core/ssl_host_state_delegate_qt.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ssl_host_state_delegate_qt.h" + +#include "type_conversion.h" + +namespace QtWebEngineCore { + +// Mirrors implementation in aw_ssl_host_state_delegate.cc + +static net::SHA256HashValue getChainFingerprint256(const net::X509Certificate &cert) +{ + net::SHA256HashValue fingerprint = + net::X509Certificate::CalculateChainFingerprint256(cert.os_cert_handle(), cert.GetIntermediateCertificates()); + return fingerprint; +} + +CertPolicy::CertPolicy() +{ +} + +CertPolicy::~CertPolicy() +{ +} + +bool CertPolicy::Check(const net::X509Certificate& cert, net::CertStatus error) const +{ + net::SHA256HashValue fingerprint = getChainFingerprint256(cert); + auto allowed_iter = m_allowed.find(fingerprint); + if ((allowed_iter != m_allowed.end()) && (allowed_iter->second & error) && ((allowed_iter->second & error) == error)) + return true; + return false; +} + +void CertPolicy::Allow(const net::X509Certificate& cert, net::CertStatus error) +{ + net::SHA256HashValue fingerprint = getChainFingerprint256(cert); + m_allowed[fingerprint] |= error; +} + +SSLHostStateDelegateQt::SSLHostStateDelegateQt(BrowserContextAdapter *contextAdapter) + : m_contextAdapter(contextAdapter) +{ +} + +SSLHostStateDelegateQt::~SSLHostStateDelegateQt() +{ +} + +void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, net::CertStatus error) +{ + m_certPolicyforHost[host].Allow(cert, error); +} + +// Clear all allow preferences. +void SSLHostStateDelegateQt::Clear() +{ + m_certPolicyforHost.clear(); +} + +// Queries whether |cert| is allowed for |host| and |error|. Returns true in +// |expired_previous_decision| if a previous user decision expired immediately +// prior to this query, otherwise false. +content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy( + const std::string &host, const net::X509Certificate &cert, + net::CertStatus error,bool *expired_previous_decision) +{ + return m_certPolicyforHost[host].Check(cert, error) ? SSLHostStateDelegate::ALLOWED : SSLHostStateDelegate::DENIED; +} + +// Records that a host has run insecure content. +void SSLHostStateDelegateQt::HostRanInsecureContent(const std::string &host, int pid) +{ +} + +// Returns whether the specified host ran insecure content. +bool SSLHostStateDelegateQt::DidHostRunInsecureContent(const std::string &host, int pid) const +{ + return false; +} + +// Revokes all SSL certificate error allow exceptions made by the user for +// |host|. +void SSLHostStateDelegateQt::RevokeUserAllowExceptions(const std::string &host) +{ + m_certPolicyforHost.erase(host); +} + +// Returns whether the user has allowed a certificate error exception for +// |host|. This does not mean that *all* certificate errors are allowed, just +// that there exists an exception. To see if a particular certificate and +// error combination exception is allowed, use QueryPolicy(). +bool SSLHostStateDelegateQt::HasAllowException(const std::string &host) const +{ + auto policy_iterator = m_certPolicyforHost.find(host); + return policy_iterator != m_certPolicyforHost.end() && + policy_iterator->second.HasAllowException(); +} + + +} // namespace QtWebEngineCore diff --git a/src/core/ssl_host_state_delegate_qt.h b/src/core/ssl_host_state_delegate_qt.h new file mode 100644 index 000000000..7c91fcb2d --- /dev/null +++ b/src/core/ssl_host_state_delegate_qt.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SSL_HOST_STATE_DELEGATE_QT_H +#define SSL_HOST_STATE_DELEGATE_QT_H + +#include "content/public/browser/ssl_host_state_delegate.h" +#include "browser_context_adapter.h" + +namespace QtWebEngineCore { + +class CertPolicy { +public: + CertPolicy(); + ~CertPolicy(); + bool Check(const net::X509Certificate& cert, net::CertStatus error) const; + void Allow(const net::X509Certificate& cert, net::CertStatus error); + bool HasAllowException() const { return m_allowed.size() > 0; } + +private: + std::map<net::SHA256HashValue, net::CertStatus, net::SHA256HashValueLessThan> m_allowed; +}; + +class SSLHostStateDelegateQt : public content::SSLHostStateDelegate { + +public: + SSLHostStateDelegateQt(BrowserContextAdapter *); + ~SSLHostStateDelegateQt(); + + // content::SSLHostStateDelegate implementation: + virtual void AllowCert(const std::string &, const net::X509Certificate &cert, net::CertStatus error) override; + virtual void Clear() override; + virtual CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, + net::CertStatus error,bool *expired_previous_decision) override; + virtual void HostRanInsecureContent(const std::string &host, int pid) override; + virtual bool DidHostRunInsecureContent(const std::string &host, int pid) const override; + virtual void RevokeUserAllowExceptions(const std::string &host) override; + virtual bool HasAllowException(const std::string &host) const override; + +private: + BrowserContextAdapter *m_contextAdapter; + std::map<std::string, CertPolicy> m_certPolicyforHost; +}; + +} // namespace QtWebEngineCore + +#endif // SSL_HOST_STATE_DELEGATE_QT_H diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 14405251e..0275d8a2a 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -62,17 +62,29 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC /*! \class QQuickWebEngineProfile - \brief The QQuickWebEngineProfile class provides a web-engine profile shared by multiple pages. + \brief The QQuickWebEngineProfile class provides a web engine profile shared by multiple pages. \since 5.6 \inmodule QtWebEngine - QQuickWebEngineProfile contains settings, scripts, and the list of visited links shared by all - web engine pages that belong to the profile. As such, profiles can be used to isolate pages - from each other. A typical use case is a dedicated profile for a 'private browsing' mode. + A web engine profile contains properties and functionality shared by a group of web engine + pages. + + Information about visited links is stored together with persistent cookies and other persistent + data in a storage described by the persistentStoragePath property. + + Profiles can be used to isolate pages from each other. A typical use case is a dedicated + \e {off-the-record profile} for a \e {private browsing} mode. An off-the-record profile forces + cookies, the HTTP cache, and other normally persistent data to be stored only in memory. The + offTheRecord property holds whether a profile is off-the-record. + + The default profile can be accessed by defaultProfile(). It is a built-in profile that all + web pages not specifically created with another profile belong to. - The default profile is a built-in profile that all web pages not specifically created with - another profile belong to. + A WebEngineProfile instance can be created and accessed from C++ through the + QQuickWebEngineProfile class, which exposes further functionality in C++. This allows Qt Quick + applications to intercept URL requests (QQuickWebEngineProfile::setRequestInterceptor), or + register custom URL schemes (QQuickWebEngineProfile::installUrlSchemeHandler). */ /*! diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp index 33f48471a..46ffb06f4 100644 --- a/src/webengine/api/qquickwebenginetestsupport.cpp +++ b/src/webengine/api/qquickwebenginetestsupport.cpp @@ -51,6 +51,7 @@ void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url) { // Loading of the error page should not fail. Q_ASSERT(success); + Q_UNUSED(success); QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus); Q_EMIT loadingChanged(&loadRequest); diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 1f2d9dcf2..673215dd7 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -50,6 +50,9 @@ \li OS X: Xcode version 5.1 or later on OS X 10.9 or later \endlist + \note Qt WebEngine cannot be built for the 32-bit mode of OS X (using the + macx-clang-32 mkspec). + \section1 Pepper Plugin API Support Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins. The plugins must be loaded diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 62836c5f9..50da38f22 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -63,17 +63,39 @@ using QtWebEngineCore::BrowserContextAdapter; /*! \class QWebEngineProfile - \brief The QWebEngineProfile class provides a web-engine profile shared by multiple pages. + \brief The QWebEngineProfile class provides a web engine profile shared by multiple pages. \since 5.5 \inmodule QtWebEngineWidgets - QWebEngineProfile contains settings, scripts, and the list of visited links shared by all - web engine pages that belong to the profile. As such, profiles can be used to isolate pages - from each other. A typical use case is a dedicated profile for a 'private browsing' mode. + A web engine profile contains settings, scripts, persistent cookie policy, and the list of + visited links shared by all web engine pages that belong to the profile. - The default profile is a built-in profile that all web pages not specifically created with - another profile belong to. + All pages that belong to the profile share a common QWebEngineSettings instance, which can + be accessed with the settings() method. Likewise, the scripts() method provides access + to a common QWebEngineScriptCollection instance. + + Information about visited links is stored together with persistent cookies and other persistent + data in a storage returned by persistentStoragePath(). The cache can be cleared of links by + clearVisitedLinks() or clearAllVisitedLinks(). PersistentCookiesPolicy describes whether + session and persistent cookies are saved to and restored from memory or disk. + + Profiles can be used to isolate pages from each other. A typical use case is a dedicated + \e {off-the-record profile} for a \e {private browsing} mode. Using QWebEngineProfile() without + defining a storage name constructs a new off-the-record profile that leaves no record on the + local machine, and has no persistent data or cache. The isOffTheRecord() method can be used + to check whether a profile is off-the-record. + + The default profile can be accessed by defaultProfile(). It is a built-in profile that all + web pages not specifically created with another profile belong to. + + Implementing the QWebEngineUrlRequestInterceptor interface and registering the interceptor on a + profile by setRequestInterceptor() enables intercepting, blocking, and modifying URL + requests (QWebEngineUrlRequestInfo) before they reach the networking stack of Chromium. + + A QWebEngineUrlSchemeHandler can be registered for a profile by installUrlSchemeHandler() + to add support for custom URL schemes. Requests for the scheme are then issued to + QWebEngineUrlSchemeHandler::requestStarted() as QWebEngineUrlRequestJob objects. */ /*! diff --git a/tests/auto/quick/inspectorserver/BLACKLIST b/tests/auto/quick/inspectorserver/BLACKLIST new file mode 100644 index 000000000..f80823bf3 --- /dev/null +++ b/tests/auto/quick/inspectorserver/BLACKLIST @@ -0,0 +1,5 @@ +[testRemoteDebuggingMessage] +osx + +[openRemoteDebuggingSession] +osx diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 15c1680f9..47d44cd7f 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -230,10 +230,12 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineDownloadItem.state --> DownloadState" << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong" << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong" + << "QQuickWebEngineDownloadItem.mimeType --> QString" << "QQuickWebEngineDownloadItem.path --> QString" << "QQuickWebEngineDownloadItem.stateChanged() --> void" << "QQuickWebEngineDownloadItem.receivedBytesChanged() --> void" << "QQuickWebEngineDownloadItem.totalBytesChanged() --> void" + << "QQuickWebEngineDownloadItem.mimeTypeChanged() --> void" << "QQuickWebEngineDownloadItem.pathChanged() --> void" << "QQuickWebEngineDownloadItem.accept() --> void" << "QQuickWebEngineDownloadItem.cancel() --> void" @@ -278,7 +280,6 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void" << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void" - << "QQuickWebEngineProfile.cookieStore() --> QWebEngineCookieStore*" << "QQuickWebEngineScript.Deferred --> InjectionPoint" << "QQuickWebEngineScript.DocumentReady --> InjectionPoint" << "QQuickWebEngineScript.DocumentCreation --> InjectionPoint" diff --git a/tests/auto/quick/qmltests/BLACKLIST b/tests/auto/quick/qmltests/BLACKLIST new file mode 100644 index 000000000..3abcd82d0 --- /dev/null +++ b/tests/auto/quick/qmltests/BLACKLIST @@ -0,0 +1,9 @@ +[DesktopWebEngineViewLinkHovered::test_linkHovered] +* + +[WebViewGeopermission::test_deniedGeolocationByUser] +osx + +[WebViewGeopermission::test_geoPermissionRequest] +osx +windows diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml index 6df654ae6..7d1e24b4d 100644 --- a/tests/auto/quick/qmltests/data/tst_download.qml +++ b/tests/auto/quick/qmltests/data/tst_download.qml @@ -114,7 +114,7 @@ TestWebEngineView { compare(downloadState[1], WebEngineDownloadItem.DownloadInProgress) downloadFinishedSpy.wait() compare(totalBytes, receivedBytes) - compare(downloadState[2], WebEngineDownloadItem.DownloadCompleted) + tryCompare(downloadState, 2, WebEngineDownloadItem.DownloadCompleted) } function test_downloadCancelled() { diff --git a/tests/auto/quick/qmltests/data/tst_geopermission.qml b/tests/auto/quick/qmltests/data/tst_geopermission.qml index 1d4703e95..5e5e1a321 100644 --- a/tests/auto/quick/qmltests/data/tst_geopermission.qml +++ b/tests/auto/quick/qmltests/data/tst_geopermission.qml @@ -37,7 +37,7 @@ TestWebEngineView { property bool deniedGeolocation: false property bool geoPermissionRequested: false - property string consoleErrorMessage: "" + signal consoleErrorMessage(string message) SignalSpy { id: featurePermissionSpy @@ -45,6 +45,12 @@ TestWebEngineView { signalName: "featurePermissionRequested" } + SignalSpy { + id: consoleErrorMessageSpy + target: webEngineView + signalName: "consoleErrorMessage" + } + onFeaturePermissionRequested: { if (feature === WebEngineView.Geolocation) { geoPermissionRequested = true @@ -59,7 +65,7 @@ TestWebEngineView { onJavaScriptConsoleMessage: { if (level === WebEngineView.ErrorMessageLevel) - consoleErrorMessage = message + consoleErrorMessage(message) } TestCase { @@ -68,8 +74,8 @@ TestWebEngineView { function init() { deniedGeolocation = false - consoleErrorMessage = "" featurePermissionSpy.clear() + consoleErrorMessageSpy.clear() } function test_geoPermissionRequest() { @@ -78,15 +84,16 @@ TestWebEngineView { featurePermissionSpy.wait() verify(geoPermissionRequested) compare(featurePermissionSpy.count, 1) - if (consoleErrorMessage) // Print the error message if it fails to get user's location - fail(consoleErrorMessage) + if (consoleErrorMessageSpy.count) // Print the error message if it fails to get user's location + fail(consoleErrorMessageSpy.signalArguments[0][0]) } function test_deniedGeolocationByUser() { deniedGeolocation = true webEngineView.url = Qt.resolvedUrl("geolocation.html") featurePermissionSpy.wait() - compare(consoleErrorMessage, "User denied Geolocation") + consoleErrorMessageSpy.wait() + compare(consoleErrorMessageSpy.signalArguments[0][0], "User denied Geolocation") } } } diff --git a/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro b/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro index cbd11cdca..9471def00 100644 --- a/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro +++ b/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro @@ -1,3 +1,4 @@ include(../tests.pri) +CONFIG -= testcase # remove, once this passes in the CI exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc QT_PRIVATE += webengine-private diff --git a/tests/auto/quick/tests.pri b/tests/auto/quick/tests.pri index 56eee7199..3c56aef97 100644 --- a/tests/auto/quick/tests.pri +++ b/tests/auto/quick/tests.pri @@ -1,8 +1,6 @@ TEMPLATE = app -# FIXME: Re-enable once we want to run tests on the CI -# CONFIG += testcase - +CONFIG += testcase CONFIG += c++11 VPATH += $$_PRO_FILE_PWD_ diff --git a/tests/auto/widgets/positionplugin/positionplugin.pro b/tests/auto/widgets/positionplugin/positionplugin.pro index bca3e5756..6f2e736c6 100644 --- a/tests/auto/widgets/positionplugin/positionplugin.pro +++ b/tests/auto/widgets/positionplugin/positionplugin.pro @@ -1,12 +1,13 @@ TARGET = qtwebengine_positioning_testplugin -QT += positioning -PLUGIN_TYPE = position -PLUGIN_CLASS_NAME = TestPositionPlugin -PLUGIN_EXTENDS = - -load(qt_plugin) +QT += positioning SOURCES += plugin.cpp OTHER_FILES += \ plugin.json + +PLUGIN_TYPE = position +PLUGIN_CLASS_NAME = TestPositionPlugin +PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index cb0e2a5f4..270fd4458 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -128,7 +128,6 @@ private Q_SLOTS: void modified(); void contextMenuCrash(); void updatePositionDependentActionsCrash(); - void database(); void createPluginWithPluginsEnabled(); void createPluginWithPluginsDisabled(); void destroyPlugin_data(); @@ -214,9 +213,6 @@ private Q_SLOTS: void setHtmlWithBaseURL(); void setHtmlWithJSAlert(); void metaData(); -#if !defined(QT_NO_COMBOBOX) - void popupFocus(); -#endif void inputFieldFocus(); void hitTestContent(); void baseUrl_data(); @@ -794,64 +790,6 @@ void tst_QWebEnginePage::contextMenuCrash() #endif } -void tst_QWebEnginePage::database() -{ -#if !defined(QWEBENGINEDATABASE) - QSKIP("QWEBENGINEDATABASE"); -#else - QString path = tmpDirPath(); - m_page->settings()->setOfflineStoragePath(path); - QVERIFY(m_page->settings()->offlineStoragePath() == path); - - QWebEngineSettings::setOfflineStorageDefaultQuota(1024 * 1024); - QVERIFY(QWebEngineSettings::offlineStorageDefaultQuota() == 1024 * 1024); - - m_page->settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); - m_page->settings()->setAttribute(QWebEngineSettings::OfflineStorageDatabaseEnabled, true); - - QString dbFileName = path + "Databases.db"; - - if (QFile::exists(dbFileName)) - QFile::remove(dbFileName); - - qRegisterMetaType<QWebEngineFrame*>("QWebEngineFrame*"); - QSignalSpy spy(m_page, SIGNAL(databaseQuotaExceeded(QWebEngineFrame*,QString))); - m_view->setHtml(QString("<html><head><script>var db; db=openDatabase('testdb', '1.0', 'test database API', 50000); </script></head><body><div></div></body></html>"), QUrl("http://www.myexample.com")); - QTRY_COMPARE(spy.count(), 1); - evaluateJavaScriptSync(m_page, "var db2; db2=openDatabase('testdb', '1.0', 'test database API', 50000);"); - QTRY_COMPARE(spy.count(),1); - - evaluateJavaScriptSync(m_page, "localStorage.test='This is a test for local storage';"); - m_view->setHtml(QString("<html><body id='b'>text</body></html>"), QUrl("http://www.myexample.com")); - - QVariant s1 = evaluateJavaScriptSync(m_page, "localStorage.test"); - QCOMPARE(s1.toString(), QString("This is a test for local storage")); - - evaluateJavaScriptSync(m_page, "sessionStorage.test='This is a test for session storage';"); - m_view->setHtml(QString("<html><body id='b'>text</body></html>"), QUrl("http://www.myexample.com")); - QVariant s2 = evaluateJavaScriptSync(m_page, "sessionStorage.test"); - QCOMPARE(s2.toString(), QString("This is a test for session storage")); - - m_view->setHtml(QString("<html><head></head><body><div></div></body></html>"), QUrl("http://www.myexample.com")); - evaluateJavaScriptSync(m_page, "var db3; db3=openDatabase('testdb', '1.0', 'test database API', 50000);db3.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Test (text TEXT)', []); }, function(tx, result) { }, function(tx, error) { });"); - QTest::qWait(200); - - // Remove all databases. - QWebEngineSecurityOrigin origin = m_page->mainFrame()->securityOrigin(); - QList<QWebEngineDatabase> dbs = origin.databases(); - for (int i = 0; i < dbs.count(); i++) { - QString fileName = dbs[i].fileName(); - QVERIFY(QFile::exists(fileName)); - QWebEngineDatabase::removeDatabase(dbs[i]); - QVERIFY(!QFile::exists(fileName)); - } - QVERIFY(!origin.databases().size()); - // Remove removed test :-) - QWebEngineDatabase::removeAllDatabases(); - QVERIFY(!origin.databases().size()); -#endif -} - #if defined(QWEBENGINEPAGE_CREATEPLUGIN) class PluginPage : public QWebEnginePage { @@ -4202,49 +4140,6 @@ void tst_QWebEnginePage::metaData() #endif } -#if !defined(QT_NO_COMBOBOX) -void tst_QWebEnginePage::popupFocus() -{ -#if !defined(QWEBENGINEELEMENT) - QSKIP("QWEBENGINEELEMENT"); -#else - QWebEngineView view; - view.setHtml("<html>" - " <body>" - " <select name=\"select\">" - " <option>1</option>" - " <option>2</option>" - " </select>" - " <input type=\"text\"> </input>" - " <textarea name=\"text_area\" rows=\"3\" cols=\"40\">" - "This test checks whether showing and hiding a popup" - "takes the focus away from the webpage." - " </textarea>" - " </body>" - "</html>"); - view.resize(400, 100); - // Call setFocus before show to work around http://bugreports.qt.nokia.com/browse/QTBUG-14762 - view.setFocus(); - view.show(); - QTest::qWaitForWindowExposed(&view); - view.activateWindow(); - QTRY_VERIFY(view.hasFocus()); - - // open the popup by clicking. check if focus is on the popup - const QWebEngineElement webCombo = view.page()->documentElement().findFirst(QLatin1String("select[name=select]")); - QTest::mouseClick(&view, Qt::LeftButton, 0, webCombo.geometry().center()); - - QComboBox* combo = view.findChild<QComboBox*>(); - QVERIFY(combo != 0); - QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup - - // hide the popup and check if focus is on the page - combo->hidePopup(); - QTRY_VERIFY(view.hasFocus()); // Focus should be back on the WebView -#endif -} -#endif - void tst_QWebEnginePage::inputFieldFocus() { #if !defined(QWEBENGINEELEMENT) |