Commit 6959aeb5 authored by Milan Crha's avatar Milan Crha

Make it possible to disable WebKit sandbox usage with an environment variable

Define DISABLE_WEBKIT_SANDBOX=1 environment variable before running
evolution to disable WebKitGTK sandbox usage. That would be usable
in cases when the sandbox refuses to run, which can happen and which
had been noticed on terminal with this output:

   terminate called after throwing an instance of 'std::system_error'
     what():  Operation not permitted

This showed when opening a message composer.
parent a6c9d7bd
......@@ -902,11 +902,16 @@ web_view_constructor (GType type,
static gpointer web_context = NULL;
if (!web_context) {
static gchar sandbox_option = -1;
if (sandbox_option == -1)
sandbox_option = g_strcmp0 (g_getenv ("DISABLE_WEBKIT_SANDBOX"), "1") == 0 ? 0 : 1;
web_context = webkit_web_context_new ();
webkit_web_context_set_cache_model (web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
webkit_web_context_set_web_extensions_directory (web_context, EVOLUTION_WEB_EXTENSIONS_DIR);
webkit_web_context_set_sandbox_enabled (web_context, TRUE);
webkit_web_context_set_sandbox_enabled (web_context, sandbox_option != 0);
webkit_web_context_add_path_to_sandbox (web_context, EVOLUTION_WEBKITDATADIR, TRUE);
#if ENABLE_MAINTAINER_MODE
webkit_web_context_add_path_to_sandbox (web_context, EVOLUTION_SOURCE_WEBKITDATADIR, TRUE);
......
......@@ -4194,11 +4194,16 @@ webkit_editor_constructor (GType type,
static gpointer web_context = NULL;
if (!web_context) {
static gchar sandbox_option = -1;
if (sandbox_option == -1)
sandbox_option = g_strcmp0 (g_getenv ("DISABLE_WEBKIT_SANDBOX"), "1") == 0 ? 0 : 1;
web_context = webkit_web_context_new ();
webkit_web_context_set_cache_model (web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
webkit_web_context_set_web_extensions_directory (web_context, EVOLUTION_WEB_EXTENSIONS_WEBKIT_EDITOR_DIR);
webkit_web_context_set_sandbox_enabled (web_context, TRUE);
webkit_web_context_set_sandbox_enabled (web_context, sandbox_option != 0);
webkit_web_context_add_path_to_sandbox (web_context, EVOLUTION_WEBKITDATADIR, TRUE);
#if ENABLE_MAINTAINER_MODE
webkit_web_context_add_path_to_sandbox (web_context, EVOLUTION_SOURCE_WEBKITDATADIR, TRUE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment