summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-02-15 14:57:23 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-02-17 09:12:12 +0100
commitcd12379d43f8c2df14b19ebced316aa94b3f6043 (patch)
treef8ff1ac93a1a5502e60c243c32c54f80b1bd332d
parent4e6e907001d4cf0833465407f8a0fa68e6ce564b (diff)
parent4c94370394ccf1e00233669df01599cb6141a5dc (diff)
downloadqtwebengine-cd12379d43f8c2df14b19ebced316aa94b3f6043.tar.gz
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Idee0142b0e33fdf8ca663f1ef1bcd8b932985043
-rw-r--r--configure.pri1
-rw-r--r--mkspecs/features/functions.prf1
m---------src/3rdparty0
-rw-r--r--src/buildtools/config/support.pri2
-rw-r--r--src/buildtools/configure.json1
-rw-r--r--src/core/api/qwebenginepage.cpp8
-rw-r--r--src/core/api/qwebenginepage_p.h3
-rw-r--r--src/core/api/qwebengineurlschemehandler.h4
-rw-r--r--src/core/chromium_overrides.cpp78
-rw-r--r--src/core/content_browser_client_qt.cpp173
-rw-r--r--src/core/content_browser_client_qt.h15
-rw-r--r--src/core/content_client_qt.cpp12
-rw-r--r--src/core/devtools_manager_delegate_qt.cpp2
-rw-r--r--src/core/find_text_helper.cpp12
-rw-r--r--src/core/net/plugin_response_interceptor_url_loader_throttle.cpp6
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp188
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.h18
-rw-r--r--src/core/net/system_network_context_manager.cpp20
-rw-r--r--src/core/net/system_network_context_manager.h10
-rw-r--r--src/core/net/webui_controller_factory_qt.cpp34
-rw-r--r--src/core/net/webui_controller_factory_qt.h8
-rw-r--r--src/core/profile_io_data_qt.h1
-rw-r--r--src/core/qtwebengine_resources.gni11
-rw-r--r--src/core/qtwebengine_sources.gni50
-rw-r--r--src/core/render_widget_host_view_qt.cpp2
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp24
-rw-r--r--src/core/renderer/content_renderer_client_qt.h12
-rw-r--r--src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp10
-rw-r--r--src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h8
-rw-r--r--src/core/resource_context_qt.h15
-rw-r--r--src/core/user_notification_controller.h2
-rw-r--r--src/core/web_contents_adapter.cpp31
-rw-r--r--src/core/web_contents_adapter_client.h3
-rw-r--r--src/core/web_contents_delegate_qt.cpp28
-rw-r--r--src/core/web_contents_delegate_qt.h6
-rw-r--r--src/core/web_contents_view_qt.cpp5
-rw-r--r--src/core/web_engine_context.cpp21
-rw-r--r--src/core/web_engine_context.h7
-rw-r--r--src/webengine/api/qquickwebengineloadrequest.cpp9
-rw-r--r--src/webengine/api/qquickwebengineview.cpp4
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h3
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp12
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp5
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp127
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp106
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp47
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp6
-rw-r--r--tests/auto/widgets/qwebengineview/resources/dummy.html6
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp44
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc1
-rwxr-xr-xtools/scripts/take_snapshot.py5
51 files changed, 814 insertions, 393 deletions
diff --git a/configure.pri b/configure.pri
index 87dc4d8d0..55766de30 100644
--- a/configure.pri
+++ b/configure.pri
@@ -143,6 +143,7 @@ defineTest(qtConfTest_detectArch) {
contains(QT_ARCH, "i386")|contains(QT_ARCH, "x86_64"): return(true)
contains(QT_ARCH, "arm")|contains(QT_ARCH, "arm64"): return(true)
contains(QT_ARCH, "mips"): return(true)
+ contains(QT_ARCH, "mips64"): return(true)
qtLog("Architecture not supported.")
return(false)
}
diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
index b7509d4d0..6c3ef3cbc 100644
--- a/mkspecs/features/functions.prf
+++ b/mkspecs/features/functions.prf
@@ -109,6 +109,7 @@ defineReplace(gnArch) {
contains(qtArch, "arm64"): return(arm64)
contains(qtArch, "mips"): return(mipsel)
contains(qtArch, "mips64"): return(mips64el)
+ contains(qtArch, "mips64el"): return(mips64el)
return(unknown)
}
diff --git a/src/3rdparty b/src/3rdparty
-Subproject f9845463789f5dc3e8e3858280f23700bcb5ed5
+Subproject a38752bff0fd3ae3e98ce973a437413e074403a
diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
index 4ba387fc2..54b5738cd 100644
--- a/src/buildtools/config/support.pri
+++ b/src/buildtools/config/support.pri
@@ -22,6 +22,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) {
!qtwebengine_checkForBison(QtWebEngine):return(false)
!qtwebengine_checkForFlex(QtWebEngine):return(false)
!qtwebengine_checkForPython2(QtWebEngine):return(false)
+ !qtwebengine_checkForNodejs(QtWebEngine):return(false)
!qtwebengine_checkForSanitizer(QtWebEngine):return(false)
linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
linux:!qtwebengine_checkForHostPkgCfg(QtWebEngine):return(false)
@@ -54,6 +55,7 @@ defineReplace(qtwebengine_checkPdfError) {
!qtwebengine_checkForSanitizer(QtPdf):return(false)
linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false)
linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false)
+ linux:!qtwebengine_checkForPackage(QtPdf,nss):return(false)
win32:!qtwebengine_checkForWinVersion(QtPdf):return(false)
return(true)
}
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
index 5819fb860..a7f1d623a 100644
--- a/src/buildtools/configure.json
+++ b/src/buildtools/configure.json
@@ -399,6 +399,7 @@
&& (!config.sanitizer || features.webengine-sanitizer)
&& (!config.linux || features.pkg-config)
&& (!config.linux || features.webengine-host-pkg-config)
+ && (!config.linux || features.webengine-system-nss)
&& (!config.win32 || features.webengine-winversion)",
"output": [ "privateFeature" ]
},
diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp
index aa3fba24e..c168ca93e 100644
--- a/src/core/api/qwebenginepage.cpp
+++ b/src/core/api/qwebenginepage.cpp
@@ -305,7 +305,8 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isError
QTimer::singleShot(0, q, &QWebEnginePage::loadStarted);
}
-void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription)
+void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
+ const QString &errorDescription, bool triggersErrorPage)
{
Q_Q(QWebEnginePage);
Q_UNUSED(url);
@@ -320,9 +321,8 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
}
isLoading = false;
- // Delay notifying failure until the error-page is done loading.
- // Error-pages are not loaded on failures due to abort.
- if (success || errorCode == -3 /* ERR_ABORTED*/ || !settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)) {
+ Q_ASSERT((success && !triggersErrorPage) || !success);
+ if (!triggersErrorPage) {
QTimer::singleShot(0, q, [q, success](){
emit q->loadFinished(success);
});
diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h
index d2101e49f..c0652ccc6 100644
--- a/src/core/api/qwebenginepage_p.h
+++ b/src/core/api/qwebenginepage_p.h
@@ -134,7 +134,8 @@ public:
void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
void loadCommitted() override { }
void didFirstVisuallyNonEmptyPaint() override { }
- void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
+ void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
+ const QString &errorDescription, bool triggersErrorPage) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
QSharedPointer<QtWebEngineCore::WebContentsAdapter>
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index 09c5b08cb..4574bf8b0 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -44,10 +44,6 @@
#include <QtCore/qobject.h>
-namespace QtWebEngineCore {
-class URLRequestContextGetterQt;
-}
-
QT_BEGIN_NAMESPACE
class QWebEngineUrlRequestJob;
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 019c7aac1..4dd3cadbb 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -70,6 +70,10 @@
#include "net/ssl/openssl_client_key_store.h"
#endif
+#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+#include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h"
+#endif
+
void *GetQtXDisplay()
{
return GLContextHelper::getXDisplay();
@@ -196,3 +200,77 @@ std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::C
{
return nullptr;
}
+
+#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+namespace extensions {
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetMetaDataFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStoreFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadStoredFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateUploadFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateDiscardFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartRtpDumpFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopRtpDumpFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartAudioDebugRecordingsFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStopAudioDebugRecordingsFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateStartEventLoggingFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+
+ExtensionFunction::ResponseAction WebrtcLoggingPrivateGetLogsDirectoryFunction::Run()
+{
+ return RespondNow(NoArguments());
+}
+} // namespace extensions
+#endif // !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 0c1c8b111..b70f8a290 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -39,69 +39,38 @@
#include "content_browser_client_qt.h"
-#include "base/memory/ptr_util.h"
#include "base/optional.h"
-#include "base/path_service.h"
-#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
-#include "base/threading/thread_restrictions.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
-#if QT_CONFIG(webengine_spellchecker)
-#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
-#endif
-#include "components/guest_view/browser/guest_view_base.h"
+#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "components/network_hints/browser/simple_network_hints_handler_impl.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/performance_manager/public/performance_manager.h"
-#include "components/spellcheck/spellcheck_buildflags.h"
-#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/url_schemes.h"
#include "content/public/browser/browser_main_runner.h"
-#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/file_url_loader.h"
#include "content/public/browser/media_observer.h"
-#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/shared_cors_origin_access_list.h"
-#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/browser/web_ui_url_loader_factory.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
-#include "content/public/common/service_manager_connection.h"
#include "content/public/common/service_names.mojom.h"
-#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
-#include "media/media_buildflags.h"
#include "extensions/buildflags/buildflags.h"
-#include "extensions/browser/extension_protocols.h"
-#include "extensions/browser/guest_view/web_view/web_view_guest.h"
-#include "extensions/browser/process_map.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/bindings/remote.h"
-#include "printing/buildflags/buildflags.h"
-#include "qtwebengine/browser/qtwebengine_content_browser_overlay_manifest.h"
-#include "qtwebengine/browser/qtwebengine_content_renderer_overlay_manifest.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/client_cert_store.h"
-#include "sandbox/policy/switches.h"
#include "services/network/network_service.h"
-#include "services/network/public/cpp/features.h"
-#include "services/service_manager/switches.h"
-#include "services/service_manager/public/cpp/connector.h"
-#include "services/service_manager/public/cpp/service.h"
-#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
@@ -109,6 +78,8 @@
#include "ui/base/ui_base_switches.h"
#include "url/url_util_qt.h"
+#include "qtwebengine/browser/qtwebengine_content_browser_overlay_manifest.h"
+#include "qtwebengine/browser/qtwebengine_content_renderer_overlay_manifest.h"
#include "qtwebengine/common/renderer_configuration.mojom.h"
#include "qtwebengine/grit/qt_webengine_resources.h"
@@ -124,12 +95,9 @@
#include "net/custom_url_loader_factory.h"
#include "net/proxying_restricted_cookie_manager_qt.h"
#include "net/proxying_url_loader_factory_qt.h"
-#include "net/qrc_url_scheme_handler.h"
#include "net/system_network_context_manager.h"
+#include "ozone/gl_share_context_qt.h"
#include "platform_notification_service_qt.h"
-#if QT_CONFIG(webengine_printing_and_pdf)
-#include "printing/printing_message_filter_qt.h"
-#endif
#include "profile_qt.h"
#include "profile_io_data_qt.h"
#include "quota_permission_context_qt.h"
@@ -138,16 +106,20 @@
#include "web_contents_adapter_client.h"
#include "web_contents_adapter.h"
#include "web_contents_delegate_qt.h"
-#include "web_engine_context.h"
#include "web_contents_view_qt.h"
+#include "web_engine_context.h"
#include "web_engine_library_info.h"
#include "api/qwebenginecookiestore.h"
#include "api/qwebenginecookiestore_p.h"
-#include "api/qwebengineurlscheme.h"
-#include "ozone/gl_share_context_qt.h"
-#if defined(Q_OS_LINUX)
-#include "global_descriptors_qt.h"
-#include "ui/base/resource/resource_bundle.h"
+
+#if QT_CONFIG(opengl)
+#include <QOpenGLContext>
+#include <QOpenGLExtraFunctions>
+#endif
+
+#if QT_CONFIG(webengine_geolocation)
+#include "base/memory/ptr_util.h"
+#include "location_provider_qt.h"
#endif
#if QT_CONFIG(webengine_pepper_plugins)
@@ -156,22 +128,36 @@
#include "renderer_host/pepper/pepper_host_factory_qt.h"
#endif
-#if QT_CONFIG(webengine_geolocation)
-#include "location_provider_qt.h"
+#if QT_CONFIG(webengine_printing_and_pdf)
+#include "printing/printing_message_filter_qt.h"
+#endif
+
+#if QT_CONFIG(webengine_spellchecker)
+#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
+#include "components/spellcheck/common/spellcheck.mojom.h"
+#endif
+
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+#include "chrome/browser/media/webrtc/webrtc_logging_controller.h"
+#endif
+
+#if defined(Q_OS_LINUX)
+#include "global_descriptors_qt.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
-#include "content/public/browser/file_url_loader.h"
+#include "common/extensions/extensions_client_qt.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
#include "extensions/browser/extension_message_filter.h"
-#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
+#include "extensions/browser/guest_view/web_view/web_view_guest.h"
+#include "extensions/browser/process_map.h"
#include "extensions/browser/url_loader_factory_manager.h"
#include "extensions/common/constants.h"
-
-#include "common/extensions/extensions_client_qt.h"
#include "extensions/extension_web_contents_observer_qt.h"
#include "extensions/extensions_browser_client_qt.h"
#include "net/plugin_response_interceptor_url_loader_throttle.h"
@@ -182,14 +168,13 @@
#include "media/mojo/services/media_service_factory.h"
#endif
-#if BUILDFLAG(ENABLE_SPELLCHECK)
-#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
-#include "components/spellcheck/common/spellcheck.mojom.h"
-#endif
-
#include <QGuiApplication>
-#include <QLocale>
#include <QStandardPaths>
+#include <qpa/qplatformnativeinterface.h>
+
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+QT_END_NAMESPACE
// Implement IsHandledProtocol as declared in //url/url_util_qt.h.
namespace url {
@@ -248,6 +233,10 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost
const int id = host->GetID();
Profile *profile = Profile::FromBrowserContext(host->GetBrowserContext());
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ WebRtcLoggingController::AttachToRenderProcessHost(host, WebEngineContext::current()->webRtcLogUploader());
+#endif
+
// Allow requesting custom schemes.
const auto policy = content::ChildProcessSecurityPolicy::GetInstance();
const auto profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -478,12 +467,12 @@ WEB_CONTENTS_USER_DATA_KEY_IMPL(ServiceDriver)
void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver)
{
-#if BUILDFLAG(ENABLE_SPELLCHECK)
+#if QT_CONFIG(webengine_spellchecker)
if (auto host_receiver = receiver.As<spellcheck::mojom::SpellCheckHost>()) {
SpellCheckHostChromeImpl::Create(render_process_host->GetID(), std::move(host_receiver));
return;
}
-#endif // BUILDFLAG(ENABLE_SPELLCHECK)
+#endif
}
static void BindNetworkHintsHandler(content::RenderFrameHost *frame_host,
@@ -747,7 +736,6 @@ bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url,
const base::Optional<url::Origin> &initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory)
{
-// Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
Q_UNUSED(child_id);
Q_UNUSED(navigation_data);
Q_UNUSED(initiating_origin);
@@ -945,6 +933,16 @@ bool ContentBrowserClientQt::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(base::
#endif
}
+bool ContentBrowserClientQt::DoesSchemeAllowCrossOriginSharedWorker(const std::string &scheme)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ // Extensions are allowed to start cross-origin shared workers.
+ return scheme == extensions::kExtensionScheme;
+#else
+ return false;
+#endif
+}
+
void ContentBrowserClientQt::OverrideURLLoaderFactoryParams(content::BrowserContext *browser_context,
const url::Origin &origin,
bool is_for_isolated_world,
@@ -1042,6 +1040,24 @@ void ContentBrowserClientQt::RegisterNonNetworkWorkerMainResourceURLLoaderFactor
for (const QByteArray &scheme : profileAdapter->customUrlSchemes())
factories->emplace(scheme.toStdString(), CreateCustomURLLoaderFactory(profileAdapter));
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ factories->emplace(
+ extensions::kExtensionScheme,
+ extensions::CreateExtensionWorkerMainResourceURLLoaderFactory(browser_context));
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+}
+
+void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(content::BrowserContext* browser_context,
+ NonNetworkURLLoaderFactoryMap* factories)
+{
+ DCHECK(browser_context);
+ DCHECK(factories);
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ factories->emplace(
+ extensions::kExtensionScheme,
+ extensions::CreateExtensionServiceWorkerScriptURLLoaderFactory(browser_context));
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
}
void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
@@ -1135,32 +1151,14 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
bool *disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr *factory_override)
{
- auto *web_contents = content::WebContents::FromRenderFrameHost(frame);
- ProfileQt *profile = static_cast<ProfileQt *>(browser_context);
-
- QWebEngineUrlRequestInterceptor *profile_interceptor = profile->profileAdapter()->requestInterceptor();
- QWebEngineUrlRequestInterceptor *page_interceptor = nullptr;
-
- if (web_contents) {
- WebContentsAdapterClient *client =
- WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(web_contents)->GetView())->client();
- if (!client)
- return false;
-
- page_interceptor = client->webContentsAdapter()->requestInterceptor();
- }
-
- if (profile_interceptor || page_interceptor) {
- int process_id = type == URLLoaderFactoryType::kNavigation ? 0 : render_process_id;
- auto proxied_receiver = std::move(*factory_receiver);
- mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_url_loader_factory;
- *factory_receiver = pending_url_loader_factory.InitWithNewPipeAndPassReceiver();
- // Will manage its own lifetime
- new ProxyingURLLoaderFactoryQt(process_id, profile_interceptor, page_interceptor, std::move(proxied_receiver),
- std::move(pending_url_loader_factory));
- return true;
- }
- return false;
+ auto adapter = static_cast<ProfileQt *>(browser_context)->profileAdapter();
+ int process_id = type == URLLoaderFactoryType::kNavigation ? 0 : render_process_id;
+ auto proxied_receiver = std::move(*factory_receiver);
+ mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_url_loader_factory;
+ *factory_receiver = pending_url_loader_factory.InitWithNewPipeAndPassReceiver();
+ // Will manage its own lifetime
+ new ProxyingURLLoaderFactoryQt(adapter, process_id, std::move(proxied_receiver), std::move(pending_url_loader_factory));
+ return true;
}
void ContentBrowserClientQt::SiteInstanceGotProcess(content::SiteInstance *site_instance)
@@ -1195,4 +1193,13 @@ void ContentBrowserClientQt::SiteInstanceDeleting(content::SiteInstance *site_in
#endif
}
+content::WebContentsViewDelegate *ContentBrowserClientQt::GetWebContentsViewDelegate(content::WebContents *web_contents)
+{
+ FormInteractionTabHelper::CreateForWebContents(web_contents);
+ if (auto *registry = performance_manager::PerformanceManagerRegistry::GetInstance())
+ registry->MaybeCreatePageNodeForWebContents(web_contents);
+
+ return nullptr;
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 05a814ead..75007989d 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -41,13 +41,8 @@
#define CONTENT_BROWSER_CLIENT_QT_H
#include "qtwebenginecoreglobal_p.h"
-#include "base/memory/ref_counted.h"
#include "content/public/browser/content_browser_client.h"
-namespace net {
-class URLRequestContextGetter;
-}
-
namespace content {
class BrowserContext;
class BrowserMainParts;
@@ -59,10 +54,7 @@ class BrowserPpapiHost;
class DevToolsManagerDelegate;
class RenderFrameHost;
class RenderProcessHost;
-class RenderViewHostDelegateView;
class ResourceContext;
-class ResourceDispatcherHostDelegate;
-class WebContentsViewPort;
class WebContents;
struct MainFunctionParams;
struct Referrer;
@@ -74,8 +66,6 @@ class GLShareGroup;
namespace QtWebEngineCore {
-class BrowserMainPartsQt;
-class ProfileQt;
class ShareGroupQt;
class ContentBrowserClientQt : public content::ContentBrowserClient
@@ -187,6 +177,7 @@ public:
bool ShouldUseSpareRenderProcessHost(content::BrowserContext *browser_context, const GURL& site_url) override;
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(base::StringPiece scheme,
bool is_embedded_origin_secure) override;
+ bool DoesSchemeAllowCrossOriginSharedWorker(const std::string &scheme) override;
void OverrideURLLoaderFactoryParams(content::BrowserContext *browser_context,
const url::Origin &origin,
bool is_for_isolated_world,
@@ -260,9 +251,13 @@ public:
NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) override;
+ void RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(content::BrowserContext* browser_context,
+ NonNetworkURLLoaderFactoryMap* factories) override;
void SiteInstanceGotProcess(content::SiteInstance *site_instance) override;
void SiteInstanceDeleting(content::SiteInstance *site_instance) override;
+ content::WebContentsViewDelegate* GetWebContentsViewDelegate(content::WebContents* web_contents) override;
+
static std::string getUserAgent();
std::string GetUserAgent() override { return getUserAgent(); }
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index d74e7eb76..83c367de0 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -48,6 +48,8 @@
#include "base/version.h"
#include "content/public/common/cdm_info.h"
#include "content/public/common/content_constants.h"
+#include "extensions/buildflags/buildflags.h"
+#include "extensions/common/constants.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "media/media_buildflags.h"
@@ -445,7 +447,15 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
void ContentClientQt::AddAdditionalSchemes(Schemes* schemes)
{
- schemes->standard_schemes.push_back("chrome-extension");
+ // Matching ChromeContentClient::AddAdditionalSchemes
+ schemes->standard_schemes.push_back(extensions::kExtensionScheme);
+ schemes->secure_schemes.push_back(extensions::kExtensionScheme);
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ schemes->service_worker_schemes.push_back(extensions::kExtensionScheme);
+ schemes->cors_enabled_schemes.push_back(extensions::kExtensionScheme);
+ schemes->csp_bypassing_schemes.push_back(extensions::kExtensionScheme);
+#endif
}
base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ScaleFactor scale_factor)
diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp
index 8c4037879..51f00d3e5 100644
--- a/src/core/devtools_manager_delegate_qt.cpp
+++ b/src/core/devtools_manager_delegate_qt.cpp
@@ -181,7 +181,7 @@ void DevToolsManagerDelegateQt::Initialized(const net::IPEndPoint *ip_address)
std::string DevToolsManagerDelegateQt::GetDiscoveryPageHTML()
{
- return ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string();
+ return ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_DEVTOOLS_DISCOVERY_PAGE_HTML);
}
bool DevToolsManagerDelegateQt::HasBundledFrontendResources()
diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp
index c3b407ab1..534e25862 100644
--- a/src/core/find_text_helper.cpp
+++ b/src/core/find_text_helper.cpp
@@ -97,18 +97,18 @@ void FindTextHelper::startFinding(const QString &findText, bool caseSensitively,
void FindTextHelper::startFinding(const QString &findText, bool caseSensitively, bool findBackward)
{
- if (findText.isEmpty()) {
- stopFinding();
- return;
- }
+ Q_ASSERT(!findText.isEmpty());
- if (m_currentFindRequestId > m_lastCompletedFindRequestId) {
+ const bool findNext = !m_previousFindText.isEmpty() && findText == m_previousFindText;
+ if (isFindTextInProgress()) {
// There are cases where the render process will overwrite a previous request
// with the new search and we'll have a dangling callback, leaving the application
// waiting for it forever.
// Assume that any unfinished find has been unsuccessful when a new one is started
// to cover that case.
m_lastCompletedFindRequestId = m_currentFindRequestId;
+ if (!findNext)
+ m_webContents->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
m_viewClient->findTextFinished(QWebEngineFindTextResult());
invokeResultCallback(m_currentFindRequestId, 0);
}
@@ -116,7 +116,7 @@ void FindTextHelper::startFinding(const QString &findText, bool caseSensitively,
blink::mojom::FindOptionsPtr options = blink::mojom::FindOptions::New();
options->forward = !findBackward;
options->match_case = caseSensitively;
- options->new_session = findText != m_previousFindText;
+ options->new_session = !findNext;
m_previousFindText = findText;
m_currentFindRequestId = m_findRequestIdCounter++;
diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
index f6bddd7b2..334b147a5 100644
--- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
+++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
@@ -41,7 +41,7 @@
#include "base/bind.h"
#include "base/task/post_task.h"
-#include "content/public/browser/browser_task_traits.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_request_utils.h"
@@ -49,10 +49,6 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
-#include "extensions/extension_system_qt.h"
-#include "profile_adapter.h"
-#include "profile_io_data_qt.h"
-#include "profile_qt.h"
#include "web_contents_delegate_qt.h"
#include <string>
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index f174df46c..bc70928ab 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -42,24 +42,17 @@
#include <utility>
#include "base/bind.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/global_request_id.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/content_constants.h"
-#include "content/public/common/url_utils.h"
-#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
-#include "net/http/http_util.h"
+#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "api/qwebengineurlrequestinfo_p.h"
-#include "profile_qt.h"
#include "type_conversion.h"
+#include "web_contents_adapter.h"
#include "web_contents_adapter_client.h"
#include "web_contents_view_qt.h"
@@ -114,11 +107,10 @@ class InterceptedRequest : public network::mojom::URLLoader
, public network::mojom::URLLoaderClient
{
public:
- InterceptedRequest(int process_id, uint64_t request_id, int32_t routing_id, uint32_t options,
+ InterceptedRequest(ProfileAdapter *profile_adapter,
+ int process_id, uint64_t request_id, int32_t routing_id, uint32_t options,
const network::ResourceRequest &request,
const net::MutableNetworkTrafficAnnotationTag &traffic_annotation,
- QWebEngineUrlRequestInterceptor *profile_request_interceptor,
- QWebEngineUrlRequestInterceptor *page_request_interceptor,
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory);
@@ -144,6 +136,8 @@ public:
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
+ static inline void cleanup(QWebEngineUrlRequestInfo *info) { delete info; }
+
private:
void InterceptOnUIThread();
void ContinueAfterIntercept();
@@ -161,12 +155,15 @@ private:
void SendErrorAndCompleteImmediately(int error_code);
+ content::WebContents* webContents();
+ QWebEngineUrlRequestInterceptor* getProfileInterceptor();
+ QWebEngineUrlRequestInterceptor* getPageInterceptor();
+
+ QPointer<ProfileAdapter> profile_adapter_;
const int process_id_;
const uint64_t request_id_;
const int32_t routing_id_;
const uint32_t options_;
- bool input_stream_previously_failed_ = false;
- bool request_was_redirected_ = false;
// If the |target_loader_| called OnComplete with an error this stores it.
// That way the destructor can send it to OnReceivedError if safe browsing
@@ -177,9 +174,8 @@ private:
const net::MutableNetworkTrafficAnnotationTag traffic_annotation_;
- QWebEngineUrlRequestInfo request_info_;
- QPointer<QWebEngineUrlRequestInterceptor> profile_request_interceptor_;
- QPointer<QWebEngineUrlRequestInterceptor> page_request_interceptor_;
+ QScopedPointer<QWebEngineUrlRequestInfo, InterceptedRequest> request_info_;
+
mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_;
mojo::Remote<network::mojom::URLLoaderClient> target_client_;
mojo::Receiver<network::mojom::URLLoaderClient> proxied_client_receiver_{this};
@@ -190,22 +186,20 @@ private:
DISALLOW_COPY_AND_ASSIGN(InterceptedRequest);
};
-InterceptedRequest::InterceptedRequest(int process_id, uint64_t request_id, int32_t routing_id, uint32_t options,
+InterceptedRequest::InterceptedRequest(ProfileAdapter *profile_adapter,
+ int process_id, uint64_t request_id, int32_t routing_id, uint32_t options,
const network::ResourceRequest &request,
const net::MutableNetworkTrafficAnnotationTag &traffic_annotation,
- QWebEngineUrlRequestInterceptor *profile_request_interceptor,
- QWebEngineUrlRequestInterceptor *page_request_interceptor,
mojo::PendingReceiver<network::mojom::URLLoader> loader_receiver,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory)
- : process_id_(process_id)
+ : profile_adapter_(profile_adapter)
+ , process_id_(process_id)
, request_id_(request_id)
, routing_id_(routing_id)
, options_(options)
, request_(request)
, traffic_annotation_(traffic_annotation)
- , profile_request_interceptor_(profile_request_interceptor)
- , page_request_interceptor_(page_request_interceptor)
, proxied_loader_receiver_(this, std::move(loader_receiver))
, target_client_(std::move(client))
, target_factory_(std::move(target_factory))
@@ -224,35 +218,61 @@ InterceptedRequest::~InterceptedRequest()
weak_factory_.InvalidateWeakPtrs();
}
+content::WebContents* InterceptedRequest::webContents()
+{
+ if (process_id_) {
+ content::RenderFrameHost *frameHost = content::RenderFrameHost::FromID(process_id_, request_.render_frame_id);
+ return content::WebContents::FromRenderFrameHost(frameHost);
+ }
+
+ return content::WebContents::FromFrameTreeNodeId(request_.render_frame_id);
+}
+
+QWebEngineUrlRequestInterceptor* InterceptedRequest::getProfileInterceptor()
+{
+ return profile_adapter_ ? profile_adapter_->requestInterceptor() : nullptr;
+}
+
+QWebEngineUrlRequestInterceptor* InterceptedRequest::getPageInterceptor()
+{
+ if (auto wc = webContents()) {
+ auto view = static_cast<content::WebContentsImpl *>(wc)->GetView();
+ if (WebContentsAdapterClient *client = WebContentsViewQt::from(view)->client())
+ return client->webContentsAdapter()->requestInterceptor();
+ }
+ return nullptr;
+}
+
void InterceptedRequest::Restart()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- blink::mojom::ResourceType resourceType = blink::mojom::ResourceType(request_.resource_type);
- WebContentsAdapterClient::NavigationType navigationType =
- pageTransitionToNavigationType(ui::PageTransition(request_.transition_type));
+ // MEMO since all codepatch leading to Restart scheduled and executed as asynchronous tasks in main thread,
+ // interceptors may change in meantime and also during intercept call, so they should be resolved anew.
+ // Set here only profile's interceptor since it runs first without going to user code.
+ auto profileInterceptor = getProfileInterceptor();
+ if (!profileInterceptor && !getPageInterceptor()) {
+ ContinueAfterIntercept();
+ return;
+ }
+
+ auto resourceType = toQt(blink::mojom::ResourceType(request_.resource_type));
+ auto navigationType = toQt(pageTransitionToNavigationType(ui::PageTransition(request_.transition_type)));
const QUrl originalUrl = toQt(request_.url);
const QUrl initiator = request_.request_initiator.has_value() ? toQt(request_.request_initiator->GetURL()) : QUrl();
- content::WebContents *webContents = nullptr;
- if (process_id_) {
- content::RenderFrameHost *frameHost = content::RenderFrameHost::FromID(process_id_, request_.render_frame_id);
- webContents = content::WebContents::FromRenderFrameHost(frameHost);
- } else {
- webContents = content::WebContents::FromFrameTreeNodeId(request_.render_frame_id);
- }
-
- GURL top_document_url = webContents ? webContents->GetVisibleURL() : GURL();
+ auto wc = webContents();
+ GURL top_document_url = wc ? wc->GetVisibleURL() : GURL();
QUrl firstPartyUrl;
if (!top_document_url.is_empty())
firstPartyUrl = toQt(top_document_url);
else
firstPartyUrl = toQt(request_.site_for_cookies.RepresentativeUrl()); // m_topDocumentUrl can be empty for the main-frame.
- QWebEngineUrlRequestInfoPrivate *infoPrivate =
- new QWebEngineUrlRequestInfoPrivate(toQt(resourceType), toQt(navigationType), originalUrl, firstPartyUrl,
- initiator, QByteArray::fromStdString(request_.method));
- request_info_ = QWebEngineUrlRequestInfo(infoPrivate);
+ auto info = new QWebEngineUrlRequestInfoPrivate(resourceType, navigationType, originalUrl, firstPartyUrl,
+ initiator, QByteArray::fromStdString(request_.method));
+ Q_ASSERT(!request_info_);
+ request_info_.reset(new QWebEngineUrlRequestInfo(info));
InterceptOnUIThread();
ContinueAfterIntercept();
@@ -261,52 +281,59 @@ void InterceptedRequest::Restart()
void InterceptedRequest::InterceptOnUIThread()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (profile_request_interceptor_)
- profile_request_interceptor_->interceptRequest(request_info_);
+ if (auto interceptor = getProfileInterceptor())
+ interceptor->interceptRequest(*request_info_);
- if (!request_info_.changed() && page_request_interceptor_)
- page_request_interceptor_->interceptRequest(request_info_);
+ if (!request_info_->changed()) {
+ if (auto interceptor = getPageInterceptor())
+ interceptor->interceptRequest(*request_info_);
+ }
}
void InterceptedRequest::ContinueAfterIntercept()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (request_info_.changed()) {
- QWebEngineUrlRequestInfoPrivate &info = *request_info_.d_ptr;
- if (info.shouldBlockRequest)
- return SendErrorAndCompleteImmediately(net::ERR_BLOCKED_BY_CLIENT);
-
- for (auto header = info.extraHeaders.constBegin(); header != info.extraHeaders.constEnd(); ++header) {
- std::string h = header.key().toStdString();
- if (base::LowerCaseEqualsASCII(h, "referer")) {
- request_.referrer = GURL(header.value().toStdString());
- } else {
- request_.headers.SetHeader(h, header.value().toStdString());
+ if (request_info_) {
+ // cleanup in scope because of delete this and it's not needed else where after
+ decltype(request_info_) scoped_request_info(request_info_.take());
+ QWebEngineUrlRequestInfoPrivate &info = *scoped_request_info->d_ptr;
+
+ if (info.changed) {
+ if (info.shouldBlockRequest)
+ return SendErrorAndCompleteImmediately(net::ERR_BLOCKED_BY_CLIENT);
+
+ for (auto header = info.extraHeaders.constBegin(); header != info.extraHeaders.constEnd(); ++header) {
+ std::string h = header.key().toStdString();
+ if (base::LowerCaseEqualsASCII(h, "referer")) {
+ request_.referrer = GURL(header.value().toStdString());
+ } else {
+ request_.headers.SetHeader(h, header.value().toStdString());
+ }
}
- }
- if (info.shouldRedirectRequest) {
- net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy =
- request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT
- : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL;
- net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo(
- request_.method, request_.url, request_.site_for_cookies,
- first_party_url_policy, request_.referrer_policy, request_.referrer.spec(),
- net::HTTP_TEMPORARY_REDIRECT, toGurl(request_info_.requestUrl()), base::nullopt,
- false /*insecure_scheme_was_upgraded*/);
-
- // FIXME: Should probably create a new header.
- current_response_->encoded_data_length = 0;
- request_.method = redirectInfo.new_method;
- request_.url = redirectInfo.new_url;
- request_.site_for_cookies = redirectInfo.new_site_for_cookies;
- request_.referrer = GURL(redirectInfo.new_referrer);
- request_.referrer_policy = redirectInfo.new_referrer_policy;
- if (request_.method == net::HttpRequestHeaders::kGetMethod)
- request_.request_body = nullptr;
- target_client_->OnReceiveRedirect(redirectInfo, std::move(current_response_));
- return;
+ if (info.shouldRedirectRequest) {
+ net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy =
+ request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT
+ : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL;
+ net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo(
+ request_.method, request_.url, request_.site_for_cookies,
+ first_party_url_policy, request_.referrer_policy, request_.referrer.spec(),
+ net::HTTP_TEMPORARY_REDIRECT, toGurl(info.url), base::nullopt,
+ false /*insecure_scheme_was_upgraded*/);
+
+ // FIXME: Should probably create a new header.
+ current_response_->encoded_data_length = 0;
+ request_.method = redirectInfo.new_method;
+ request_.url = redirectInfo.new_url;
+ request_.site_for_cookies = redirectInfo.new_site_for_cookies;
+ request_.referrer = GURL(redirectInfo.new_referrer);
+ request_.referrer_policy = redirectInfo.new_referrer_policy;
+ if (request_.method == net::HttpRequestHeaders::kGetMethod)
+ request_.request_body = nullptr;
+ target_client_->OnReceiveRedirect(redirectInfo, std::move(current_response_));
+ return;
+ }
}
}
@@ -329,7 +356,6 @@ void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr he
void InterceptedRequest::OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head)
{
// TODO(timvolodine): handle redirect override.
- request_was_redirected_ = true;
current_response_ = head.Clone();
target_client_->OnReceiveRedirect(redirect_info, std::move(head));
request_.url = redirect_info.new_url;
@@ -459,10 +485,10 @@ void InterceptedRequest::SendErrorAndCompleteImmediately(int error_code)
delete this;
}
-ProxyingURLLoaderFactoryQt::ProxyingURLLoaderFactoryQt(int process_id, QWebEngineUrlRequestInterceptor *profile, QWebEngineUrlRequestInterceptor *page,
+ProxyingURLLoaderFactoryQt::ProxyingURLLoaderFactoryQt(ProfileAdapter *adapter, int process_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver,
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_info)
- : m_processId(process_id), m_profileRequestInterceptor(profile), m_pageRequestInterceptor(page), m_weakFactory(this)
+ : m_profileAdapter(adapter), m_processId(process_id), m_weakFactory(this)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (target_factory_info) {
@@ -491,8 +517,8 @@ void ProxyingURLLoaderFactoryQt::CreateLoaderAndStart(mojo::PendingReceiver<netw
m_targetFactory->Clone(target_factory_clone.InitWithNewPipeAndPassReceiver());
// Will manage its own lifetime
- InterceptedRequest *req = new InterceptedRequest(m_processId, request_id, routing_id, options, request, traffic_annotation,
- m_profileRequestInterceptor, m_pageRequestInterceptor, std::move(loader),
+ InterceptedRequest *req = new InterceptedRequest(m_profileAdapter, m_processId, request_id, routing_id, options,
+ request, traffic_annotation, std::move(loader),
std::move(url_loader_client), std::move(target_factory_clone));
req->Restart();
}
diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h
index e1bcc276c..5345e3220 100644
--- a/src/core/net/proxying_url_loader_factory_qt.h
+++ b/src/core/net/proxying_url_loader_factory_qt.h
@@ -42,16 +42,12 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/ref_counted_delete_on_sequence.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
-#include "url/gurl.h"
#include <QPointer>
// based on aw_proxying_url_loader_factory.h:
@@ -59,19 +55,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-QT_FORWARD_DECLARE_CLASS(QWebEngineUrlRequestInterceptor)
-
-namespace content {
-class ResourceContext;
-}
-
namespace QtWebEngineCore {
+class ProfileAdapter;
+
class ProxyingURLLoaderFactoryQt : public network::mojom::URLLoaderFactory
{
public:
- ProxyingURLLoaderFactoryQt(int processId, QWebEngineUrlRequestInterceptor *profile,
- QWebEngineUrlRequestInterceptor *page,
+ ProxyingURLLoaderFactoryQt(ProfileAdapter *adapter, int processId,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver,
mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_target_factory_remote);
@@ -89,11 +80,10 @@ private:
void OnTargetFactoryError();
void OnProxyBindingError();
+ QPointer<ProfileAdapter> m_profileAdapter;
int m_processId;
mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_proxyReceivers;
mojo::Remote<network::mojom::URLLoaderFactory> m_targetFactory;
- QPointer<QWebEngineUrlRequestInterceptor> m_profileRequestInterceptor;
- QPointer<QWebEngineUrlRequestInterceptor> m_pageRequestInterceptor;
base::WeakPtrFactory<ProxyingURLLoaderFactoryQt> m_weakFactory;
DISALLOW_COPY_AND_ASSIGN(ProxyingURLLoaderFactoryQt);
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index 99a207c0e..1fba115c6 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -44,35 +44,16 @@
#include "net/system_network_context_manager.h"
-#include <set>
-#include <unordered_map>
-#include <utility>
-
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/feature_list.h"
-#include "base/logging.h"
-#include "base/sequence_checker.h"
-#include "base/strings/string_split.h"
-#include "base/task/post_task.h"
-#include "base/values.h"
-#include "build/build_config.h"
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
#include "chrome/common/chrome_switches.h"
#include "components/certificate_transparency/ct_known_logs.h"
-#include "components/network_session_configurator/common/network_features.h"
#include "components/network_session_configurator/common/network_switches.h"
-#include "content/public/browser/browser_task_traits.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
-#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h"
-#include "content/public/common/user_agent.h"
-#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
-#include "net/dns/public/util.h"
#include "net/net_buildflags.h"
-#include "net/third_party/uri_template/uri_template.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
#include "services/network/public/cpp/features.h"
@@ -80,7 +61,6 @@
#include "services/network/public/mojom/host_resolver.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
-#include "url/gurl.h"
namespace {
diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h
index bd12fe217..48cd99173 100644
--- a/src/core/net/system_network_context_manager.h
+++ b/src/core/net/system_network_context_manager.h
@@ -46,16 +46,10 @@
#define SYSTEM_NETWORK_CONTEXT_MANAGER_H_
#include <memory>
-#include <string>
-#include <vector>
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/optional.h"
-#include "services/network/public/mojom/host_resolver.mojom-forward.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom-forward.h"
-#include "services/network/public/mojom/ssl_config.mojom-forward.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "net/proxy_config_monitor.h"
@@ -67,10 +61,6 @@ class URLLoaderFactory;
class SharedURLLoaderFactory;
} // namespace network
-namespace net_log {
-class NetExportFileWriter;
-}
-
// Responsible for creating and managing access to the system NetworkContext.
// Lives on the UI thread. The NetworkContext this owns is intended for requests
// not associated with a profile. It stores no data on disk, and has no HTTP
diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp
index 27e58d75f..59c5ca205 100644
--- a/src/core/net/webui_controller_factory_qt.cpp
+++ b/src/core/net/webui_controller_factory_qt.cpp
@@ -44,39 +44,36 @@
#include "webui_controller_factory_qt.h"
+#include "build_config_qt.h"
+
#include "base/bind.h"
-#include "base/location.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/devtools_ui.h"
#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
+#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
-#include "content/public/common/content_client.h"
#include "content/public/common/url_utils.h"
#include "extensions/buildflags/buildflags.h"
#include "media/media_buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
-#include "ui/web_dialogs/web_dialog_ui.h"
#include "url/gurl.h"
#if defined(OS_LINUX) || defined(OS_ANDROID)
#include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+#include "chrome/browser/ui/webui/media/webrtc_logs_ui.h"
+#endif
+
// The Following WebUIs are disabled because they currently doesn't build
// or doesn't work, but would be interesting for us if they did:
// #include "chrome/browser/ui/webui/inspect_ui.h"
-// #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
-
-// #if BUILDFLAG(ENABLE_WEBRTC)
-// #include "chrome/browser/ui/webui/media/webrtc_logs_ui.h"
-// #endif
// #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
@@ -137,8 +134,9 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co
if (url.host() == chrome::kChromeUIAccessibilityHost)
return &NewWebUI<AccessibilityUI>;
-// if (url.host_piece() == chrome::kChromeUIUserActionsHost)
-// return &NewWebUI<UserActionsUI>;
+ if (url.host_piece() == chrome::kChromeUIUserActionsHost)
+ return &NewWebUI<UserActionsUI>;
+
// if (url.host_piece() == chrome::kChromeUIInspectHost)
// return &NewWebUI<InspectUI>;
//
@@ -150,20 +148,16 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co
// if (url.host_piece() == chrome::kChromeUIExtensionsFrameHost)
// return &NewWebUI<extensions::ExtensionsUI>;
//#endif
-//#if BUILDFLAG(ENABLE_PLUGINS)
-// if (url.host_piece() == chrome::kChromeUIFlashHost)
-// return &NewWebUI<FlashUI>;
-//#endif
//#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// if (url.host_piece() == chrome::kChromeUIPrintHost &&
// !profile->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) {
// return &NewWebUI<PrintPreviewUI>;
// }
//#endif
-//#if BUILDFLAG(ENABLE_WEBRTC)
-// if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost)
-// return &NewWebUI<WebRtcLogsUI>;
-//#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost)
+ return &NewWebUI<WebRtcLogsUI>;
+#endif
#if defined(OS_LINUX) || defined(OS_ANDROID)
if (url.host_piece() == chrome::kChromeUISandboxHost)
return &NewWebUI<SandboxInternalsUI>;
diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h
index 1cc76349b..6dfc612e1 100644
--- a/src/core/net/webui_controller_factory_qt.h
+++ b/src/core/net/webui_controller_factory_qt.h
@@ -42,16 +42,8 @@
#include "base/macros.h"
#include "base/memory/singleton.h"
-#include "components/favicon_base/favicon_callback.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller_factory.h"
-#include "ui/base/layout.h"
-
-class Profile;
-
-namespace base {
-class RefCountedMemory;
-}
namespace QtWebEngineCore {
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index 3f8205159..e44d838dd 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -53,7 +53,6 @@
namespace net {
class ClientCertStore;
-class URLRequestContext;
}
namespace extensions {
diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni
index 38e824f5e..73ec8bda9 100644
--- a/src/core/qtwebengine_resources.gni
+++ b/src/core/qtwebengine_resources.gni
@@ -26,6 +26,7 @@ repack("qtwebengine_repack_resources") {
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/components/dev_ui_components_resources.pak",
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
+ "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/content/dev_ui_content_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
@@ -41,6 +42,7 @@ repack("qtwebengine_repack_resources") {
"//components/resources:components_resources_grit",
"//components/resources:dev_ui_components_resources_grit",
"//content/browser/resources/media:media_internals_resources",
+ "//content/browser/tracing:resources",
"//content:content_resources_grit",
"//content:dev_ui_content_resources_grit",
"//mojo/public/js:resources",
@@ -70,6 +72,15 @@ repack("qtwebengine_repack_resources") {
"//content/browser/webrtc/resources",
]
}
+
+ if (enable_webrtc && enable_extensions) {
+ sources += [
+ "$root_gen_dir/chrome/webrtc_logs_resources.pak",
+ ]
+ deps += [
+ "//chrome/browser/resources/media:webrtc_logs_resources",
+ ]
+ }
}
repack("qtwebengine_repack_resources_100") {
diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni
index 56bf51d8d..0f3e8b946 100644
--- a/src/core/qtwebengine_sources.gni
+++ b/src/core/qtwebengine_sources.gni
@@ -96,6 +96,12 @@ source_set("qtwebengine_sources") {
"//chrome/browser/ui/webui/quota_internals/quota_internals_types.h",
"//chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc",
"//chrome/browser/ui/webui/quota_internals/quota_internals_ui.h",
+ "//chrome/browser/ui/webui/user_actions/user_actions_ui.cc",
+ "//chrome/browser/ui/webui/user_actions/user_actions_ui.h",
+ "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc",
+ "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h",
+ "//chrome/browser/ui/webui/webui_util.cc",
+ "//chrome/browser/ui/webui/webui_util.h",
"//chrome/common/custom_handlers/protocol_handler.cc",
"//chrome/common/custom_handlers/protocol_handler.h",
"//chrome/common/chrome_switches.cc",
@@ -205,6 +211,50 @@ source_set("qtwebengine_sources") {
"//components/printing/renderer",
]
}
+
+ if (enable_webrtc && enable_extensions) {
+ deps += [
+ "//chrome/browser/resources/media:webrtc_logs_resources",
+ "//components/upload_list",
+ "//components/webrtc_logging/browser",
+ "//components/webrtc_logging/common",
+ ]
+
+ sources += [
+ "//chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc",
+ "//chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h",
+ "//chrome/browser/media/webrtc/audio_debug_recordings_handler.cc",
+ "//chrome/browser/media/webrtc/audio_debug_recordings_handler.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_history.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_history.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_common.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_local.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_local.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_manager_remote.h",
+ "//chrome/browser/media/webrtc/webrtc_event_log_uploader.cc",
+ "//chrome/browser/media/webrtc/webrtc_event_log_uploader.h",
+ "//chrome/browser/media/webrtc/webrtc_log_buffer.cc",
+ "//chrome/browser/media/webrtc/webrtc_log_buffer.h",
+ "//chrome/browser/media/webrtc/webrtc_log_uploader.cc",
+ "//chrome/browser/media/webrtc/webrtc_log_uploader.h",
+ "//chrome/browser/media/webrtc/webrtc_logging_controller.cc",
+ "//chrome/browser/media/webrtc/webrtc_logging_controller.h",
+ "//chrome/browser/media/webrtc/webrtc_rtp_dump_handler.cc",
+ "//chrome/browser/media/webrtc/webrtc_rtp_dump_handler.h",
+ "//chrome/browser/media/webrtc/webrtc_rtp_dump_writer.cc",
+ "//chrome/browser/media/webrtc/webrtc_rtp_dump_writer.h",
+ "//chrome/browser/media/webrtc/webrtc_text_log_handler.cc",
+ "//chrome/browser/media/webrtc/webrtc_text_log_handler.h",
+ "//chrome/browser/ui/webui/media/webrtc_logs_ui.cc",
+ "//chrome/browser/ui/webui/media/webrtc_logs_ui.h",
+ "//chrome/renderer/media/webrtc_logging_agent_impl.cc",
+ "//chrome/renderer/media/webrtc_logging_agent_impl.h",
+ ]
+ }
}
if (is_win) {
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 2846e71ef..43ee36ed2 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -205,6 +205,8 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
m_touchSelectionController.reset();
m_touchSelectionControllerClient.reset();
+
+ host()->render_frame_metadata_provider()->RemoveObserver(this);
}
void RenderWidgetHostViewQt::setDelegate(RenderWidgetHostViewQtDelegate* delegate)
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 0cff31ff5..86cc5d52a 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -112,6 +112,10 @@
#include "third_party/widevine/cdm/widevine_cdm_common.h"
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+#include "chrome/renderer/media/webrtc_logging_agent_impl.h"
+#endif
+
namespace QtWebEngineCore {
static const char kHttpErrorDomain[] = "http";
@@ -182,6 +186,15 @@ void ContentRendererClientQt::ExposeInterfacesToBrowser(mojo::BinderMap* binders
}, this),
base::SequencedTaskRunnerHandle::Get());
#endif
+
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ binders->Add(base::BindRepeating(
+ [](ContentRendererClientQt *client,
+ mojo::PendingReceiver<chrome::mojom::WebRtcLoggingAgent> receiver) {
+ client->GetWebRtcLoggingAgent()->AddReceiver(std::move(receiver));
+ }, this),
+ base::SequencedTaskRunnerHandle::Get());
+#endif
}
void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame *render_frame)
@@ -366,6 +379,17 @@ blink::WebPlugin* ContentRendererClientQt::CreatePlugin(content::RenderFrame* re
}
#endif //BUILDFLAG(ENABLE_PLUGINS)
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+chrome::WebRtcLoggingAgentImpl *ContentRendererClientQt::GetWebRtcLoggingAgent()
+{
+ if (!m_webrtcLoggingAgentImpl) {
+ m_webrtcLoggingAgentImpl = std::make_unique<chrome::WebRtcLoggingAgentImpl>();
+ }
+
+ return m_webrtcLoggingAgentImpl.get();
+}
+#endif // QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+
void ContentRendererClientQt::GetInterface(const std::string &interface_name, mojo::ScopedMessagePipeHandle interface_pipe)
{
content::RenderThread::Get()->BindHostReceiver(mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe)));
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 82d8af514..0b0a7b68c 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -53,6 +53,10 @@
#include <QScopedPointer>
+namespace chrome {
+class WebRtcLoggingAgentImpl;
+}
+
namespace error_page {
class Error;
}
@@ -130,6 +134,11 @@ public:
const chrome::mojom::PluginInfo& plugin_info);
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ chrome::WebRtcLoggingAgentImpl *GetWebRtcLoggingAgent();
+#endif
+
+
private:
#if BUILDFLAG(ENABLE_SPELLCHECK)
void InitSpellCheck();
@@ -147,6 +156,9 @@ private:
#if QT_CONFIG(webengine_spellchecker)
QScopedPointer<SpellCheck> m_spellCheck;
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ std::unique_ptr<chrome::WebRtcLoggingAgentImpl> m_webrtcLoggingAgentImpl;
+#endif
DISALLOW_COPY_AND_ASSIGN(ContentRendererClientQt);
};
diff --git a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
index af547fcf2..8fa277e78 100644
--- a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
+++ b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
@@ -45,19 +45,14 @@
#include "pepper_flash_browser_host_qt.h"
#include "base/time/time.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_ppapi_host.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_process_host.h"
#include "ipc/ipc_message_macros.h"
#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/host/dispatch_host_message.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "qtwebenginecoreglobal_p.h"
-#include "url/gurl.h"
#if defined(OS_WIN)
#include <windows.h>
@@ -66,8 +61,6 @@
#endif
using content::BrowserPpapiHost;
-using content::BrowserThread;
-using content::RenderProcessHost;
namespace QtWebEngineCore {
@@ -75,11 +68,8 @@ PepperFlashBrowserHostQt::PepperFlashBrowserHostQt(BrowserPpapiHost* host,
PP_Instance instance,
PP_Resource resource)
: ResourceHost(host->GetPpapiHost(), instance, resource),
- host_(host),
weak_factory_(this)
{
- int unused;
- host->GetRenderFrameIDsForInstance(instance, &render_process_id_, &unused);
}
PepperFlashBrowserHostQt::~PepperFlashBrowserHostQt() {}
diff --git a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h
index 5d1107dfb..d6d2c8656 100644
--- a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h
+++ b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h
@@ -40,7 +40,6 @@
#ifndef PEPPER_FLASH_BROWSER_HOST_QT_H
#define PEPPER_FLASH_BROWSER_HOST_QT_H
-#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
@@ -51,7 +50,6 @@ class Time;
namespace content {
class BrowserPpapiHost;
-class ResourceContext;
}
class GURL;
@@ -77,12 +75,6 @@ private:
const base::Time& t);
int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context);
- void GetLocalDataRestrictions(ppapi::host::ReplyMessageContext reply_context,
- const GURL& document_url,
- const GURL& plugin_url);
-
- content::BrowserPpapiHost* host_;
- int render_process_id_;
base::WeakPtrFactory<PepperFlashBrowserHostQt> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHostQt);
diff --git a/src/core/resource_context_qt.h b/src/core/resource_context_qt.h
index 4107e7c24..efd3d2e7e 100644
--- a/src/core/resource_context_qt.h
+++ b/src/core/resource_context_qt.h
@@ -42,21 +42,6 @@
#include "content/public/browser/resource_context.h"
-#include "extensions/buildflags/buildflags.h"
-
-namespace net {
-class URLRequestContext;
-class URLRequestContextGetter;
-}
-
-#if BUILDFLAG(ENABLE_EXTENSIONS)
-namespace extensions {
-class ExtensionSystemQt;
-}
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
-
-class GURL;
-
namespace QtWebEngineCore {
class ProfileIODataQt;
diff --git a/src/core/user_notification_controller.h b/src/core/user_notification_controller.h
index bab85c7ec..f0d7e348f 100644
--- a/src/core/user_notification_controller.h
+++ b/src/core/user_notification_controller.h
@@ -44,7 +44,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QUrl>
-#include <QtGui/QIcon>
+#include <QtGui/QImage>
class GURL;
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 61c6368f6..014fb6482 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -61,6 +61,7 @@
#include "web_engine_settings.h"
#include "base/command_line.h"
+#include "base/metrics/user_metrics.h"
#include "base/run_loop.h"
#include "base/task/current_thread.h"
#include "base/task/post_task.h"
@@ -604,8 +605,9 @@ bool WebContentsAdapter::canGoToOffset(int offset) const
void WebContentsAdapter::stop()
{
CHECK_INITIALIZED();
- content::NavigationController& controller = m_webContents->GetController();
+ base::RecordAction(base::UserMetricsAction("Stop"));
+ content::NavigationController& controller = m_webContents->GetController();
int index = controller.GetPendingEntryIndex();
if (index != -1)
controller.RemoveEntryAtIndex(index);
@@ -617,6 +619,8 @@ void WebContentsAdapter::stop()
void WebContentsAdapter::reload()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Reload"));
+
bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded);
setLifecycleState(LifecycleState::Active);
CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
@@ -630,6 +634,8 @@ void WebContentsAdapter::reload()
void WebContentsAdapter::reloadAndBypassCache()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("ReloadBypassingCache"));
+
bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded);
setLifecycleState(LifecycleState::Active);
CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
@@ -654,6 +660,7 @@ void WebContentsAdapter::load(const QUrl &url)
void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
{
+ base::RecordAction(base::UserMetricsAction("LoadURL"));
GURL gurl = toGurl(request.url());
if (!isInitialized()) {
scoped_refptr<content::SiteInstance> site =
@@ -707,9 +714,10 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
// chromium accepts LOAD_TYPE_HTTP_POST only for the HTTP and HTTPS protocols
if (!params.url.SchemeIsHTTPOrHTTPS()) {
m_adapterClient->loadFinished(false, request.url(), false,
- net::ERR_DISALLOWED_URL_SCHEME,
- QCoreApplication::translate("WebContentsAdapter",
- "HTTP-POST data can only be sent over HTTP(S) protocol"));
+ net::ERR_DISALLOWED_URL_SCHEME,
+ QCoreApplication::translate("WebContentsAdapter",
+ "HTTP-POST data can only be sent over HTTP(S) protocol"),
+ false);
return;
}
params.post_data = network::ResourceRequestBody::CreateFromBytes(
@@ -764,7 +772,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
GURL dataUrlToLoad(urlString);
if (dataUrlToLoad.spec().size() > url::kMaxURLChars) {
- m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED);
+ m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED, QString(), false);
return;
}
content::NavigationController::LoadURLParams params((dataUrlToLoad));
@@ -780,6 +788,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
void WebContentsAdapter::save(const QString &filePath, int savePageFormat)
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("SavePage"));
m_webContentsDelegate->setSavePageInfo(SavePageInfo(filePath, savePageFormat));
m_webContents->OnSavePage();
}
@@ -834,42 +843,49 @@ QString WebContentsAdapter::selectedText() const
void WebContentsAdapter::undo()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Undo"));
m_webContents->Undo();
}
void WebContentsAdapter::redo()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Redo"));
m_webContents->Redo();
}
void WebContentsAdapter::cut()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Cut"));
m_webContents->Cut();
}
void WebContentsAdapter::copy()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Copy"));
m_webContents->Copy();
}
void WebContentsAdapter::paste()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Paste"));
m_webContents->Paste();
}
void WebContentsAdapter::pasteAndMatchStyle()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("PasteAndMatchStyle"));
m_webContents->PasteAndMatchStyle();
}
void WebContentsAdapter::selectAll()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("SelectAll"));
m_webContents->SelectAll();
}
@@ -888,6 +904,7 @@ void WebContentsAdapter::unselect()
void WebContentsAdapter::navigateBack()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Back"));
CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
if (!m_webContents->GetController().CanGoBack())
return;
@@ -898,6 +915,7 @@ void WebContentsAdapter::navigateBack()
void WebContentsAdapter::navigateForward()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("Forward"));
CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
if (!m_webContents->GetController().CanGoForward())
return;
@@ -1283,12 +1301,14 @@ void WebContentsAdapter::devToolsFrontendDestroyed(DevToolsFrontendQt *frontend)
void WebContentsAdapter::exitFullScreen()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));
m_webContents->ExitFullscreen(false);
}
void WebContentsAdapter::changedFullScreen()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));
m_webContents->NotifyFullscreenChanged(false);
}
@@ -1792,6 +1812,7 @@ FindTextHelper *WebContentsAdapter::findTextHelper()
void WebContentsAdapter::viewSource()
{
CHECK_INITIALIZED();
+ base::RecordAction(base::UserMetricsAction("ViewSource"));
m_webContents->GetMainFrame()->ViewSource();
}
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 208d8577d..497b94720 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -195,7 +195,8 @@ public:
virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) = 0;
virtual void loadCommitted() = 0;
virtual void didFirstVisuallyNonEmptyPaint() = 0;
- virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) = 0;
+ virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
+ const QString &errorDescription, bool triggersErrorPage) = 0;
virtual void focusContainer() = 0;
virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
virtual QSharedPointer<WebContentsAdapter>
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index a749e532d..773bef8da 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -347,6 +347,7 @@ void WebContentsDelegateQt::EmitLoadStarted(const QUrl &url, bool isErrorPage)
controller->deactivate();
m_certificateErrorControllers.clear();
+ m_isDocumentEmpty = true;
m_viewClient->loadStarted(url, isErrorPage);
m_viewClient->updateNavigationActions();
@@ -389,9 +390,10 @@ void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *naviga
EmitLoadStarted(toQt(navigation_handle->GetURL()));
}
-void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription)
+void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription, bool triggersErrorPage)
{
Q_ASSERT(!isErrorPage || webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled));
+ Q_ASSERT((triggersErrorPage && webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled)) || !triggersErrorPage);
// When error page enabled we don't need to send the error page load finished signal
if (m_loadProgressMap[url] == 100)
@@ -402,7 +404,7 @@ void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool
m_isNavigationCommitted = false;
m_viewClient->loadProgressChanged(100);
- m_viewClient->loadFinished(success, url, isErrorPage, errorCode, errorDescription);
+ m_viewClient->loadFinished(success, url, isErrorPage, errorCode, errorDescription, triggersErrorPage);
m_viewClient->updateNavigationActions();
}
@@ -495,7 +497,11 @@ void WebContentsDelegateQt::DidStopLoading()
void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription)
{
m_viewClient->iconChanged(QUrl());
- EmitLoadFinished(false /* success */ , url, false /* isErrorPage */, errorCode, errorDescription);
+ bool errorPageEnabled = webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled);
+ // Delay notifying failure until the error-page is done loading.
+ // Error-pages are not loaded on failures due to abort.
+ bool aborted = (errorCode == -3 /* ERR_ABORTED*/ );
+ EmitLoadFinished(false /* success */ , url, false /* isErrorPage */, errorCode, errorDescription, errorPageEnabled && !aborted);
}
void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code)
@@ -548,7 +554,9 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame
content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
int http_statuscode = entry ? entry->GetHttpStatusCode() : 0;
- EmitLoadFinished(http_statuscode < 400, toQt(validated_url), false /* isErrorPage */, http_statuscode);
+ bool errorPageEnabled = webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled);
+ bool triggersErrorPage = errorPageEnabled && (http_statuscode >= 400) && m_isDocumentEmpty;
+ EmitLoadFinished(http_statuscode < 400, toQt(validated_url), false /* isErrorPage */, http_statuscode, QString(), triggersErrorPage);
}
void WebContentsDelegateQt::DidUpdateFaviconURL(content::RenderFrameHost *render_frame_host, const std::vector<blink::mojom::FaviconURLPtr> &candidates)
@@ -868,6 +876,18 @@ bool WebContentsDelegateQt::ShouldNavigateOnBackForwardMouseButtons()
#endif
}
+void WebContentsDelegateQt::ResourceLoadComplete(content::RenderFrameHost* render_frame_host,
+ const content::GlobalRequestID& request_id,
+ const blink::mojom::ResourceLoadInfo& resource_load_info)
+{
+ Q_UNUSED(render_frame_host);
+ Q_UNUSED(request_id);
+
+ if (resource_load_info.request_destination == network::mojom::RequestDestination::kDocument) {
+ m_isDocumentEmpty = (resource_load_info.raw_body_bytes == 0);
+ }
+}
+
FaviconManager *WebContentsDelegateQt::faviconManager()
{
return m_faviconManager.data();
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 800319d93..ff4352131 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -172,6 +172,9 @@ public:
void DidFirstVisuallyNonEmptyPaint() override;
void ActivateContents(content::WebContents* contents) override;
bool ShouldNavigateOnBackForwardMouseButtons() override;
+ void ResourceLoadComplete(content::RenderFrameHost* render_frame_host,
+ const content::GlobalRequestID& request_id,
+ const blink::mojom::ResourceLoadInfo& resource_load_info) override;
void didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription);
void overrideWebPreferences(content::WebContents *, blink::web_pref::WebPreferences*);
@@ -211,7 +214,7 @@ private:
const QUrl &url,
bool user_gesture);
void EmitLoadStarted(const QUrl &url, bool isErrorPage = false);
- void EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString());
+ void EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString(), bool triggersErrorPage = false);
void EmitLoadCommitted();
LoadingState determineLoadingState(content::WebContents *contents);
@@ -239,6 +242,7 @@ private:
QMap<QUrl, int> m_loadProgressMap;
QUrl m_lastLoadedUrl;
bool m_isNavigationCommitted = false;
+ bool m_isDocumentEmpty = true;
base::WeakPtrFactory<WebContentsDelegateQt> m_weakPtrFactory { this };
QList<QWeakPointer<CertificateErrorController>> m_certificateErrorControllers;
};
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index e0070a375..93c48f268 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -51,8 +51,6 @@
#include "web_engine_context.h"
#include "web_contents_delegate_qt.h"
-#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
-#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -74,9 +72,6 @@ WebContentsViewQt::WebContentsViewQt(content::WebContents *webContents)
, m_contextMenuRequest(
new QWebEngineContextMenuRequest(new QWebEngineContextMenuRequestPrivate()))
{
- FormInteractionTabHelper::CreateForWebContents(webContents);
- if (auto *performance_manager_registry = performance_manager::PerformanceManagerRegistry::GetInstance())
- performance_manager_registry->CreatePageNodeForWebContents(webContents);
}
void WebContentsViewQt::setFactoryClient(WebContentsAdapterClient* client)
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 5abc305d6..7f338efe8 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -52,6 +52,9 @@
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread_restrictions.h"
#include "cc/base/switches.h"
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+#include "chrome/browser/media/webrtc/webrtc_log_uploader.h"
+#endif
#include "chrome/common/chrome_switches.h"
#include "content/gpu/gpu_child_thread.h"
#include "content/browser/compositor/surface_utils.h"
@@ -433,6 +436,10 @@ void WebEngineContext::destroy()
if (m_devtoolsServer)
m_devtoolsServer->stop();
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ if (m_webrtcLogUploader)
+ m_webrtcLogUploader->Shutdown();
+#endif
base::MessagePump::Delegate *delegate =
static_cast<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>(
@@ -490,6 +497,10 @@ void WebEngineContext::destroy()
// Drop the false reference.
m_handle->Release();
+
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ m_webrtcLogUploader.reset();
+#endif
}
WebEngineContext::~WebEngineContext()
@@ -854,6 +865,16 @@ printing::PrintJobManager* WebEngineContext::getPrintJobManager()
}
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+WebRtcLogUploader *WebEngineContext::webRtcLogUploader()
+{
+ if (!m_webrtcLogUploader)
+ m_webrtcLogUploader = std::make_unique<WebRtcLogUploader>();
+ return m_webrtcLogUploader.get();
+}
+#endif
+
+
static QMutex s_spmMutex;
QAtomicPointer<gpu::SyncPointManager> WebEngineContext::s_syncPointManager;
diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h
index fcc569969..63872bdfe 100644
--- a/src/core/web_engine_context.h
+++ b/src/core/web_engine_context.h
@@ -86,6 +86,7 @@ struct SandboxInterfaceInfo;
#endif
QT_FORWARD_DECLARE_CLASS(QObject)
+class WebRtcLogUploader;
namespace QtWebEngineCore {
@@ -115,6 +116,9 @@ public:
#if QT_CONFIG(webengine_printing_and_pdf)
printing::PrintJobManager* getPrintJobManager();
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ WebRtcLogUploader *webRtcLogUploader();
+#endif
void destroyProfileAdapter();
void addProfileAdapter(ProfileAdapter *profileAdapter);
void removeProfileAdapter(ProfileAdapter *profileAdapter);
@@ -152,6 +156,9 @@ private:
#if QT_CONFIG(webengine_printing_and_pdf)
std::unique_ptr<printing::PrintJobManager> m_printJobManager;
#endif
+#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
+ std::unique_ptr<WebRtcLogUploader> m_webrtcLogUploader;
+#endif
static scoped_refptr<QtWebEngineCore::WebEngineContext> m_handle;
static bool m_destroyed;
static QAtomicPointer<gpu::SyncPointManager> s_syncPointManager;
diff --git a/src/webengine/api/qquickwebengineloadrequest.cpp b/src/webengine/api/qquickwebengineloadrequest.cpp
index 5ad99ea2e..db7399dc0 100644
--- a/src/webengine/api/qquickwebengineloadrequest.cpp
+++ b/src/webengine/api/qquickwebengineloadrequest.cpp
@@ -97,10 +97,13 @@ QUrl QQuickWebEngineLoadRequest::url() const
This enumeration represents the load status of a web page load request:
- \value WebEngineLoadRequest.LoadStartedStatus Page is currently loading.
- \value WebEngineLoadRequest.LoadSucceededStatus
+ \value WebEngineView.LoadStartedStatus Page is currently loading.
+ \value WebEngineView.LoadStoppedStatus
+ Loading the page was stopped by the stop() method or by the loader
+ code or network stack in Chromium.
+ \value WebEngineView.LoadSucceededStatus
Page has been loaded with success.
- \value WebEngineLoadRequest.LoadFailedStatus Page could not be loaded.
+ \value WebEngineView.LoadFailedStatus Page could not be loaded.
\sa WebEngineView::loadingChanged
*/
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index abc2cfc1a..347e4ff2d 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -508,9 +508,11 @@ Q_STATIC_ASSERT(static_cast<int>(WebEngineError::NoErrorDomain) == static_cast<i
Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == static_cast<int>(QQuickWebEngineView::CertificateErrorDomain));
Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(QQuickWebEngineView::DnsErrorDomain));
-void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription)
+void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
+ const QString &errorDescription, bool triggersErrorPage)
{
Q_Q(QQuickWebEngineView);
+ Q_UNUSED(triggersErrorPage);
if (isErrorPage) {
#if QT_CONFIG(webengine_testsupport)
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 277ec3617..d93ec3de6 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -117,7 +117,8 @@ public:
void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
void loadCommitted() override;
void didFirstVisuallyNonEmptyPaint() override;
- void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
+ void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode,
+ const QString &errorDescription, bool triggersErrorPage) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
QSharedPointer<QtWebEngineCore::WebContentsAdapter>
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 6eb5adec2..1c42c206d 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -43,15 +43,17 @@
#include "qquickwebengineview_p.h"
#include "qquickwebengineview_p_p.h"
+
#include <QGuiApplication>
-#include <QOpenGLContext>
-#include <QQuickPaintedItem>
#include <QQuickWindow>
-#include <QSurfaceFormat>
+#include <QSGImageNode>
#include <QVariant>
#include <QWindow>
-#include <QtQuick/qsgimagenode.h>
-#include <QtQuick/private/qquickwindow_p.h>
+
+#if defined(Q_OS_MACOS) && QT_CONFIG(opengl)
+#include <QOpenGLContext>
+#include <QSurfaceFormat>
+#endif
namespace QtWebEngineCore {
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index a2e5a5e0e..5d8932fb7 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -44,15 +44,14 @@
#include "qwebenginepage_p.h"
#include "qwebengineview.h"
#include "qwebengineview_p.h"
+
#include <QGuiApplication>
#include <QLayout>
#include <QMouseEvent>
#include <QOpenGLContext>
#include <QResizeEvent>
-#include <QSGNode>
+#include <QSGImageNode>
#include <QWindow>
-#include <QtQuick/qsgimagenode.h>
-#include <QtQuick/private/qquickwindow_p.h>
namespace QtWebEngineCore {
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 54546569f..090da3d6a 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -67,6 +67,9 @@ private Q_SLOTS:
void customHeaders();
void initiator();
void jsServiceWorker();
+ void replaceInterceptor_data();
+ void replaceInterceptor();
+ void replaceOnIntercept();
};
tst_QWebEngineUrlRequestInterceptor::tst_QWebEngineUrlRequestInterceptor()
@@ -119,6 +122,7 @@ public:
QUrl redirectUrl;
QMap<QUrl, QSet<QUrl>> requestInitiatorUrls;
QMap<QByteArray, QByteArray> headers;
+ std::function<bool (QWebEngineUrlRequestInfo &)> onIntercept;
void interceptRequest(QWebEngineUrlRequestInfo &info) override
{
@@ -130,6 +134,9 @@ public:
if (info.requestUrl().scheme() == QLatin1String("blob"))
return;
+ if (onIntercept && !onIntercept(info))
+ return;
+
bool block = info.requestMethod() != QByteArrayLiteral("GET");
bool redirect = shouldRedirect && info.requestUrl() != redirectUrl;
@@ -730,5 +737,125 @@ void tst_QWebEngineUrlRequestInterceptor::jsServiceWorker()
QVERIFY(server.stop());
}
+void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor_data()
+{
+ QTest::addColumn<bool>("firstInterceptIsInPage");
+ QTest::addColumn<bool>("keepInterceptionPoint");
+ QTest::newRow("page") << true << true;
+ QTest::newRow("page-profile") << true << false;
+ QTest::newRow("profile") << false << true;
+ QTest::newRow("profile-page") << false << false;
+}
+
+void tst_QWebEngineUrlRequestInterceptor::replaceInterceptor()
+{
+ QFETCH(bool, firstInterceptIsInPage);
+ QFETCH(bool, keepInterceptionPoint);
+
+ HttpServer server;
+ server.setResourceDirs({ ":/resources" });
+ QVERIFY(server.start());
+
+ QWebEngineProfile profile;
+ profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ QWebEnginePage page(&profile);
+ QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
+ bool fetchFinished = false;
+
+ auto setInterceptor = [&] (QWebEngineUrlRequestInterceptor *interceptor, bool interceptInPage) {
+ interceptInPage ? page.setUrlRequestInterceptor(interceptor) : profile.setUrlRequestInterceptor(interceptor);
+ };
+
+ std::vector<TestRequestInterceptor> interceptors(3);
+ std::vector<int> requestsOnReplace;
+ setInterceptor(&interceptors.front(), firstInterceptIsInPage);
+
+ auto sc = connect(&page, &QWebEnginePage::loadFinished, [&] () {
+ auto currentInterceptorIndex = requestsOnReplace.size();
+ requestsOnReplace.push_back(interceptors[currentInterceptorIndex].requestInfos.size());
+
+ bool isFirstReinstall = currentInterceptorIndex == 0;
+ bool interceptInPage = keepInterceptionPoint ? firstInterceptIsInPage : (isFirstReinstall ^ firstInterceptIsInPage);
+ setInterceptor(&interceptors[++currentInterceptorIndex], interceptInPage);
+ if (!keepInterceptionPoint)
+ setInterceptor(nullptr, !interceptInPage);
+
+ if (isFirstReinstall) {
+ page.triggerAction(QWebEnginePage::Reload);
+ } else {
+ page.runJavaScript("fetch('http://nonexistent.invalid').catch(() => {})", [&, interceptInPage] (const QVariant &) {
+ requestsOnReplace.push_back(interceptors.back().requestInfos.size());
+ setInterceptor(nullptr, interceptInPage);
+ fetchFinished = true;
+ });
+ }
+ });
+
+ page.setUrl(server.url("/favicon.html"));
+ QTRY_COMPARE(spy.count(), 2);
+ QTRY_VERIFY(fetchFinished);
+
+ QString s; QDebug d(&s);
+ for (auto i = 0u; i < interceptors.size(); ++i) {
+ auto &&interceptor = interceptors[i];
+ auto &&requests = interceptor.requestInfos;
+ d << "\nInterceptor [" << i << "] with" << requestsOnReplace[i] << "requests on replace and" << requests.size() << "in the end:";
+ for (int j = 0; j < requests.size(); ++j) {
+ auto &&r = requests[j];
+ d << "\n\t" << j << "| url:" << r.requestUrl << "firstPartyUrl:" << r.firstPartyUrl;
+ }
+ QVERIFY2(!requests.isEmpty(), qPrintable(s));
+ QVERIFY2(requests.size() == requestsOnReplace[i], qPrintable(s));
+ }
+}
+
+void tst_QWebEngineUrlRequestInterceptor::replaceOnIntercept()
+{
+ HttpServer server;
+ server.setResourceDirs({ ":/resources" });
+ QVERIFY(server.start());
+
+ QWebEngineProfile profile;
+ profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ QWebEnginePage page(&profile);
+ QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
+
+ struct Interceptor : QWebEngineUrlRequestInterceptor {
+ Interceptor(const std::function<void ()> &a) : action(a) { }
+ void interceptRequest(QWebEngineUrlRequestInfo &) override { action(); }
+ std::function<void ()> action;
+ int interceptRequestReceived = 0;
+ };
+
+ TestRequestInterceptor profileInterceptor, pageInterceptor1, pageInterceptor2;
+ page.setUrlRequestInterceptor(&pageInterceptor1);
+ profile.setUrlRequestInterceptor(&profileInterceptor);
+ profileInterceptor.onIntercept = [&] (QWebEngineUrlRequestInfo &) {
+ page.setUrlRequestInterceptor(&pageInterceptor2);
+ return true;
+ };
+
+ page.setUrl(server.url("/favicon.html"));
+ QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE(profileInterceptor.requestInfos.size(), 2);
+
+ // if interceptor for page was replaced on intercept call in profile then, since request first
+ // comes to profile, forward to page's interceptor should land to second one
+ QCOMPARE(pageInterceptor1.requestInfos.size(), 0);
+ QCOMPARE(profileInterceptor.requestInfos.size(), pageInterceptor2.requestInfos.size());
+
+ page.setUrlRequestInterceptor(&pageInterceptor1);
+ bool fetchFinished = false;
+ page.runJavaScript("fetch('http://nonexistent.invalid').catch(() => {})", [&] (const QVariant &) {
+ page.setUrlRequestInterceptor(&pageInterceptor2);
+ fetchFinished = true;
+ });
+
+ QTRY_VERIFY(fetchFinished);
+ QCOMPARE(profileInterceptor.requestInfos.size(), 3);
+ QCOMPARE(pageInterceptor1.requestInfos.size(), 0);
+ QCOMPARE(profileInterceptor.requestInfos.size(), pageInterceptor2.requestInfos.size());
+}
+
QTEST_MAIN(tst_QWebEngineUrlRequestInterceptor)
#include "tst_qwebengineurlrequestinterceptor.moc"
diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
index c1e9013df..b5140ec89 100644
--- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
+++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
@@ -53,6 +53,10 @@ private Q_SLOTS:
void loadAfterInPageNavigation_qtbug66869();
void fileDownloadDoesNotTriggerLoadSignals_qtbug66661();
void numberOfStartedAndFinishedSignalsIsSame();
+ void loadFinishedAfterNotFoundError_data();
+ void loadFinishedAfterNotFoundError();
+ void errorPageTriggered_data();
+ void errorPageTriggered();
private:
QWebEngineProfile profile;
@@ -72,6 +76,11 @@ void tst_LoadSignals::initTestCase()
void tst_LoadSignals::init()
{
+ // Reset content
+ loadFinishedSpy.clear();
+ view.load(QUrl("about:blank"));
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
loadStartedSpy.clear();
loadProgressSpy.clear();
loadFinishedSpy.clear();
@@ -283,5 +292,102 @@ void tst_LoadSignals::numberOfStartedAndFinishedSignalsIsSame() {
QVERIFY(loadFinishedSpy[3][0].toBool());
}
+void tst_LoadSignals::loadFinishedAfterNotFoundError_data()
+{
+ QTest::addColumn<bool>("rfcInvalid");
+ QTest::addColumn<bool>("withServer");
+ QTest::addRow("rfc_invalid") << true << false;
+ QTest::addRow("non_existent") << false << false;
+ QTest::addRow("server_404") << false << true;
+}
+
+void tst_LoadSignals::loadFinishedAfterNotFoundError()
+{
+ QFETCH(bool, withServer);
+ QFETCH(bool, rfcInvalid);
+
+ QScopedPointer<HttpServer> server;
+ if (withServer) {
+ server.reset(new HttpServer);
+ QVERIFY(server->start());
+ }
+
+ view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ auto url = server
+ ? server->url("/not-found-page.html")
+ : QUrl(rfcInvalid ? "http://some.invalid" : "http://non.existent/url");
+ view.load(url);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000);
+ QVERIFY(!loadFinishedSpy.at(0).at(0).toBool());
+ QCOMPARE(toPlainTextSync(view.page()), QString());
+ QCOMPARE(loadFinishedSpy.count(), 1);
+
+ view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, true);
+ url = server
+ ? server->url("/another-missing-one.html")
+ : QUrl(rfcInvalid ? "http://some.other.invalid" : "http://another.non.existent/url");
+ view.load(url);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 2, 20000);
+ QVERIFY(!loadFinishedSpy.at(1).at(0).toBool());
+
+ QEXPECT_FAIL("", "No more loads (like separate load for error pages) are expected", Continue);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 3, 1000);
+}
+
+void tst_LoadSignals::errorPageTriggered_data()
+{
+ QTest::addColumn<QString>("urlPath");
+ QTest::addColumn<bool>("loadSucceed");
+ QTest::addColumn<bool>("triggersErrorPage");
+ QTest::newRow("/content/200") << QStringLiteral("/content/200") << true << false;
+ QTest::newRow("/empty/200") << QStringLiteral("/content/200") << true << false;
+ QTest::newRow("/content/404") << QStringLiteral("/content/404") << false << false;
+ QTest::newRow("/empty/404") << QStringLiteral("/empty/404") << false << true;
+}
+
+void tst_LoadSignals::errorPageTriggered()
+{
+ HttpServer server;
+ connect(&server, &HttpServer::newRequest, [] (HttpReqRep *rr) {
+ QList<QByteArray> parts = rr->requestPath().split('/');
+ if (parts.length() != 3) {
+ // For example, /favicon.ico
+ rr->sendResponse(404);
+ return;
+ }
+ bool isDocumentEmpty = (parts[1] == "empty");
+ int httpStatusCode = parts[2].toInt();
+
+ rr->setResponseHeader(QByteArrayLiteral("content-type"), QByteArrayLiteral("text/html"));
+ if (!isDocumentEmpty) {
+ rr->setResponseBody(QByteArrayLiteral("<html></html>"));
+ }
+ rr->sendResponse(httpStatusCode);
+ });
+ QVERIFY(server.start());
+
+ QFETCH(QString, urlPath);
+ QFETCH(bool, loadSucceed);
+ QFETCH(bool, triggersErrorPage);
+
+ view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, true);
+ view.load(server.url(urlPath));
+ QTRY_COMPARE(loadFinishedSpy.size(), 1);
+ QCOMPARE(loadFinishedSpy[0][0].toBool(), loadSucceed);
+ if (triggersErrorPage)
+ QVERIFY(toPlainTextSync(view.page()).contains("HTTP ERROR 404"));
+ else
+ QVERIFY(toPlainTextSync(view.page()).isEmpty());
+ loadFinishedSpy.clear();
+
+ view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ view.load(server.url(urlPath));
+ QTRY_COMPARE(loadFinishedSpy.size(), 1);
+ QCOMPARE(loadFinishedSpy[0][0].toBool(), loadSucceed);
+ QVERIFY(toPlainTextSync(view.page()).isEmpty());
+ loadFinishedSpy.clear();
+}
+
+
QTEST_MAIN(tst_LoadSignals)
#include "tst_loadsignals.moc"
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 6a4a5a965..644d0f319 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -177,8 +177,6 @@ private Q_SLOTS:
void setUrlUsingStateObject();
void setUrlThenLoads_data();
void setUrlThenLoads();
- void loadFinishedAfterNotFoundError_data();
- void loadFinishedAfterNotFoundError();
void loadInSignalHandlers_data();
void loadInSignalHandlers();
void loadFromQrc();
@@ -2834,51 +2832,6 @@ void tst_QWebEnginePage::setUrlThenLoads()
QCOMPARE(baseUrlSync(m_page), extractBaseUrl(urlToLoad2));
}
-void tst_QWebEnginePage::loadFinishedAfterNotFoundError_data()
-{
- QTest::addColumn<bool>("rfcInvalid");
- QTest::addColumn<bool>("withServer");
- QTest::addRow("rfc_invalid") << true << false;
- QTest::addRow("non_existent") << false << false;
- QTest::addRow("server_404") << false << true;
-}
-
-void tst_QWebEnginePage::loadFinishedAfterNotFoundError()
-{
- QFETCH(bool, withServer);
- QFETCH(bool, rfcInvalid);
-
- QScopedPointer<HttpServer> server;
- if (withServer) {
- server.reset(new HttpServer);
- QVERIFY(server->start());
- }
-
- QWebEnginePage page;
- QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
-
- page.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
- auto url = server
- ? server->url("/not-found-page.html")
- : QUrl(rfcInvalid ? "http://some.invalid" : "http://non.existent/url");
- page.setUrl(url);
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000);
- QVERIFY(!spy.at(0).at(0).toBool());
- QCOMPARE(toPlainTextSync(&page), QString());
- QCOMPARE(spy.count(), 1);
-
- page.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, true);
- url = server
- ? server->url("/another-missing-one.html")
- : QUrl(rfcInvalid ? "http://some.other.invalid" : "http://another.non.existent/url");
- page.setUrl(url);
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 20000);
- QVERIFY(!spy.at(1).at(0).toBool());
-
- QEXPECT_FAIL("", "No more loads (like separate load for error pages) are expected", Continue);
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 1000);
-}
-
class URLSetter : public QObject {
Q_OBJECT
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 93a7c6acd..eb692f351 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -514,7 +514,7 @@ void tst_QWebEngineProfile::urlSchemeHandlerStreaming()
view.setPage(new QWebEnginePage(&profile, &view));
view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
view.load(QUrl(QStringLiteral("stream://whatever")));
- QVERIFY(loadFinishedSpy.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
QByteArray result;
result.append(1000, 'c');
QCOMPARE(toPlainTextSync(view.page()), QString::fromLatin1(result));
@@ -575,7 +575,7 @@ void tst_QWebEngineProfile::urlSchemeHandlerRequestHeaders()
QWebEnginePage page(&profile);
QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
page.load(QUrl(QStringLiteral("myscheme://whatever")));
- QVERIFY(loadFinishedSpy.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
}
void tst_QWebEngineProfile::urlSchemeHandlerInstallation()
@@ -707,7 +707,7 @@ void tst_QWebEngineProfile::urlSchemeHandlerXhrStatus()
profile.installUrlSchemeHandler("aviancarrier", &handler);
page.setWebChannel(&channel);
page.load(QUrl("aviancarrier:/"));
- QTRY_VERIFY(host.isReady());
+ QTRY_VERIFY_WITH_TIMEOUT(host.isReady(), 30000);
host.load(QUrl("aviancarrier:/ok"));
host.load(QUrl("aviancarrier:/redirect"));
host.load(QUrl("aviancarrier:/fail"));
diff --git a/tests/auto/widgets/qwebengineview/resources/dummy.html b/tests/auto/widgets/qwebengineview/resources/dummy.html
new file mode 100644
index 000000000..9075f27c3
--- /dev/null
+++ b/tests/auto/widgets/qwebengineview/resources/dummy.html
@@ -0,0 +1,6 @@
+<html><head>
+<title>Dummy simple page without real content</title>
+<link rel='icon' href='resources/image2.png'/>
+</head><body>
+<a>This is test content</a>
+</body></html>
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 234049a38..39665c0f1 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -168,6 +168,7 @@ private Q_SLOTS:
void setPagePreservesExplicitPage();
void setViewPreservesExplicitPage();
void closeDiscardsPage();
+ void loadAfterRendererCrashed();
};
// This will be called before the first test function is executed.
@@ -3079,46 +3080,50 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::newRow("accessibility") << QUrl("chrome://accessibility") << true;
QTest::newRow("appcache-internals") << QUrl("chrome://appcache-internals") << true;
QTest::newRow("apps") << QUrl("chrome://apps") << false;
+ QTest::newRow("autofill-internals") << QUrl("chrome://autofill-internals") << false;
QTest::newRow("blob-internals") << QUrl("chrome://blob-internals") << true;
QTest::newRow("bluetooth-internals") << QUrl("chrome://bluetooth-internals") << false;
QTest::newRow("bookmarks") << QUrl("chrome://bookmarks") << false;
- QTest::newRow("cache") << QUrl("chrome://cache") << false;
- QTest::newRow("chrome") << QUrl("chrome://chrome") << false;
QTest::newRow("chrome-urls") << QUrl("chrome://chrome-urls") << false;
QTest::newRow("components") << QUrl("chrome://components") << false;
+ QTest::newRow("conversion-internals") << QUrl("chrome://conversion-internals") << true;
QTest::newRow("crashes") << QUrl("chrome://crashes") << false;
QTest::newRow("credits") << QUrl("chrome://credits") << false;
QTest::newRow("device-log") << QUrl("chrome://device-log") << false;
QTest::newRow("devices") << QUrl("chrome://devices") << false;
QTest::newRow("dino") << QUrl("chrome://dino") << false; // It works but this is an error page
- QTest::newRow("dns") << QUrl("chrome://dns") << false;
+ QTest::newRow("discards") << QUrl("chrome://discards") << false;
+ QTest::newRow("download-internals") << QUrl("chrome://download-internals") << false;
QTest::newRow("downloads") << QUrl("chrome://downloads") << false;
QTest::newRow("extensions") << QUrl("chrome://extensions") << false;
QTest::newRow("flags") << QUrl("chrome://flags") << false;
- QTest::newRow("flash") << QUrl("chrome://flash") << false;
QTest::newRow("gcm-internals") << QUrl("chrome://gcm-internals") << false;
QTest::newRow("gpu") << QUrl("chrome://gpu") << true;
QTest::newRow("help") << QUrl("chrome://help") << false;
QTest::newRow("histograms") << QUrl("chrome://histograms") << true;
+ QTest::newRow("history") << QUrl("chrome://history") << false;
QTest::newRow("indexeddb-internals") << QUrl("chrome://indexeddb-internals") << true;
QTest::newRow("inspect") << QUrl("chrome://inspect") << false;
+ QTest::newRow("interstitials") << QUrl("chrome://interstitials") << false;
+ QTest::newRow("interventions-internals") << QUrl("chrome://interventions-internals") << false;
QTest::newRow("invalidations") << QUrl("chrome://invalidations") << false;
QTest::newRow("linux-proxy-config") << QUrl("chrome://linux-proxy-config") << false;
QTest::newRow("local-state") << QUrl("chrome://local-state") << false;
+ QTest::newRow("management") << QUrl("chrome://management") << false;
+ QTest::newRow("media-engagement") << QUrl("chrome://media-engagement") << false;
QTest::newRow("media-internals") << QUrl("chrome://media-internals") << true;
QTest::newRow("net-export") << QUrl("chrome://net-export") << false;
QTest::newRow("net-internals") << QUrl("chrome://net-internals") << false;
QTest::newRow("network-error") << QUrl("chrome://network-error") << false;
QTest::newRow("network-errors") << QUrl("chrome://network-errors") << true;
- QTest::newRow("newtab") << QUrl("chrome://newtab") << false;
QTest::newRow("ntp-tiles-internals") << QUrl("chrome://ntp-tiles-internals") << false;
QTest::newRow("omnibox") << QUrl("chrome://omnibox") << false;
QTest::newRow("password-manager-internals") << QUrl("chrome://password-manager-internals") << false;
QTest::newRow("policy") << QUrl("chrome://policy") << false;
QTest::newRow("predictors") << QUrl("chrome://predictors") << false;
+ QTest::newRow("prefs-internals") << QUrl("chrome://prefs-internals") << false;
QTest::newRow("print") << QUrl("chrome://print") << false;
QTest::newRow("process-internals") << QUrl("chrome://process-internals") << true;
- QTest::newRow("profiler") << QUrl("chrome://profiler") << false;
QTest::newRow("quota-internals") << QUrl("chrome://quota-internals") << true;
QTest::newRow("safe-browsing") << QUrl("chrome://safe-browsing") << false;
#ifdef Q_OS_LINUX
@@ -3135,14 +3140,14 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::newRow("sync-internals") << QUrl("chrome://sync-internals") << false;
QTest::newRow("system") << QUrl("chrome://system") << false;
QTest::newRow("terms") << QUrl("chrome://terms") << false;
- QTest::newRow("thumbnails") << QUrl("chrome://thumbnails") << false;
- QTest::newRow("tracing") << QUrl("chrome://tracing") << false;
+ QTest::newRow("tracing") << QUrl("chrome://tracing") << true;
QTest::newRow("translate-internals") << QUrl("chrome://translate-internals") << false;
+ QTest::newRow("ukm") << QUrl("chrome://ukm") << true;
QTest::newRow("usb-internals") << QUrl("chrome://usb-internals") << false;
- QTest::newRow("user-actions") << QUrl("chrome://user-actions") << false;
+ QTest::newRow("user-actions") << QUrl("chrome://user-actions") << true;
QTest::newRow("version") << QUrl("chrome://version") << false;
QTest::newRow("webrtc-internals") << QUrl("chrome://webrtc-internals") << true;
- QTest::newRow("webrtc-logs") << QUrl("chrome://webrtc-logs") << false;
+ QTest::newRow("webrtc-logs") << QUrl("chrome://webrtc-logs") << true;
}
void tst_QWebEngineView::webUIURLs()
@@ -3394,5 +3399,24 @@ void tst_QWebEngineView::closeDiscardsPage()
QCOMPARE(page.lifecycleState(), QWebEnginePage::LifecycleState::Discarded);
}
+
+void tst_QWebEngineView::loadAfterRendererCrashed()
+{
+ QWebEngineView view;
+ view.resize(640, 480);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ bool terminated = false;
+ connect(view.page(), &QWebEnginePage::renderProcessTerminated, [&] () { terminated = true; });
+ view.load(QUrl("chrome://crash"));
+ QTRY_VERIFY_WITH_TIMEOUT(terminated, 30000);
+
+ QSignalSpy loadSpy(&view, &QWebEngineView::loadFinished);
+ view.load(QUrl("qrc:///resources/dummy.html"));
+ QTRY_COMPARE(loadSpy.count(), 1);
+ QVERIFY(loadSpy.first().first().toBool());
+}
+
QTEST_MAIN(tst_QWebEngineView)
#include "tst_qwebengineview.moc"
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc b/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
index a09be0399..a0e81e242 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.qrc
@@ -6,5 +6,6 @@
<file>resources/scrolltest_page.html</file>
<file>resources/keyboardEvents.html</file>
<file>resources/image2.png</file>
+ <file>resources/dummy.html</file>
</qresource>
</RCC>
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index c8cad2ef3..b2c1276af 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -156,7 +156,10 @@ def isInChromiumBlacklist(file_path):
or (file_path.startswith('third_party/catapult/')
and not file_path.startswith('third_party/catapult/catapult_build')
and not file_path.startswith('third_party/catapult/common')
- and not file_path.startswith('third_party/catapult/third_party/polymer/components/polymer')
+ and not file_path.startswith('third_party/catapult/third_party/beautifulsoup4')
+ and not file_path.startswith('third_party/catapult/third_party/html5lib-python')
+ and not file_path.startswith('third_party/catapult/third_party/polymer')
+ and not file_path.startswith('third_party/catapult/third_party/six')
and not file_path.startswith('third_party/catapult/tracing'))
or file_path.startswith('third_party/catapult/tracing/test_data/')
or file_path.startswith('third_party/chromevox')