summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2017-06-20 13:31:47 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2017-06-28 04:31:48 +0000
commitddc40f835d054e43d83554d804f57fcdfdb17e50 (patch)
treec857c4457e6144bf382b55a6269838a3426a7c1a /src/core
parent5bc8671260bc716be9dffe61e84c214ca37ca5f6 (diff)
Fix crash with --no-zygote on Linux
Zygote process is responsible for initializing ResourceBundle on Linux. Thus it is expected to be initialized in Renderer process. When zygote is disabled the Renderer process can't reload locale resources since the ResourceBundle hasn't been initialized yet. However, there is no need for reload because without zygote, Renderer Process initializes ResourceBundle for itself. Pulls in Chromium changes: 5352138 [Backport] Initialize RenderSandboxHostLinux in --no-zygote mode to not crash. Change-Id: Iace3585e23b4f18850783a813b1466a3ff5fe12f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/content_main_delegate_qt.cpp13
-rw-r--r--src/core/resource_bundle_qt.cpp3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 38f66d641..8284029a0 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -139,10 +139,15 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie
{
#if defined(OS_LINUX)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
-
- if (parsedCommandLine->HasSwitch(switches::kLang)) {
- const std::string &locale = parsedCommandLine->GetSwitchValueASCII(switches::kLang);
- ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale);
+ std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType);
+ bool no_sandbox = parsedCommandLine->HasSwitch(switches::kNoSandbox);
+
+ // Reload locale if the renderer process is sandboxed
+ if (process_type == switches::kRendererProcess && !no_sandbox) {
+ if (parsedCommandLine->HasSwitch(switches::kLang)) {
+ const std::string &locale = parsedCommandLine->GetSwitchValueASCII(switches::kLang);
+ ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale);
+ }
}
#endif
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index 5f5cead96..cc3c1de06 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -75,7 +75,8 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale)
#if defined(OS_LINUX)
base::CommandLine *parsed_command_line = base::CommandLine::ForCurrentProcess();
std::string process_type = parsed_command_line->GetSwitchValueASCII(switches::kProcessType);
- if (process_type == switches::kRendererProcess) {
+ bool no_sandbox = parsed_command_line->HasSwitch(switches::kNoSandbox);
+ if (process_type == switches::kRendererProcess && !no_sandbox) {
// The Renderer Process is sandboxed thus only one locale is available in it.
// The particular one is passed by the --lang command line option.
if (!parsed_command_line->HasSwitch(switches::kLang) || parsed_command_line->GetSwitchValueASCII(switches::kLang) != locale)