From 2648205d7bc0844cd70200497956fae4661e4b5d Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Mon, 7 Mar 2016 18:52:27 +0100 Subject: Fix CDM plugins not always being loaded This fixes the issue in a similar fashion to what Chromium is doing in chrome/browser/download/download_target_determiner.cc. PluginService::GetPlugins is the only way that the plugin info can be loaded. Since we can't do it on demand from the IO thread in a synchronous handler, do explicitly during the WebEngineContext initialization. Task-number: QTBUG-50132 Change-Id: I8ed796b541c880caf8546230b3a5011047eb0fe3 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_engine_context.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 3f81f7a95..09e131272 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -58,6 +58,7 @@ #include "content/public/app/content_main.h" #include "content/public/app/content_main_runner.h" #include "content/public/browser/browser_main_runner.h" +#include "content/public/browser/plugin_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" @@ -149,6 +150,12 @@ bool usingQtQuick2DRenderer() return device == QLatin1String("softwarecontext"); } +#if defined(ENABLE_PLUGINS) +void dummyGetPluginCallback(const std::vector&) +{ +} +#endif + } // namespace namespace QtWebEngineCore { @@ -290,6 +297,16 @@ WebEngineContext::WebEngineContext() // first gets referenced on the IO thread. MediaCaptureDevicesDispatcher::GetInstance(); +#if defined(ENABLE_PLUGINS) + // Creating pepper plugins from the page (which calls PluginService::GetPluginInfoArray) + // might fail unless the page queried the list of available plugins at least once + // (which ends up calling PluginService::GetPlugins). Since the plugins list can only + // be created from the FILE thread, and that GetPluginInfoArray is synchronous, it + // can't loads plugins synchronously from the IO thread to serve the render process' request + // and we need to make sure that it happened beforehand. + content::PluginService::GetInstance()->GetPlugins(base::Bind(&dummyGetPluginCallback)); +#endif + #if defined(ENABLE_BASIC_PRINTING) m_printJobManager.reset(new printing::PrintJobManager()); #endif // defined(ENABLE_BASIC_PRINTING) -- cgit v1.2.3