Commit 820aab23 authored by Milan Crha's avatar Milan Crha

Enable sandbox usage for WebKitGTK

parent c9706b64
......@@ -615,6 +615,7 @@ target_compile_definitions(evolution-util PRIVATE
-DEVOLUTION_RULEDIR=\"${privdatadir}\"
-DEVOLUTION_WEB_EXTENSIONS_DIR=\"${webextensionsdir}\"
-DEVOLUTION_WEBKITDATADIR=\"${webkitdatadir}\"
-DEVOLUTION_SOURCE_WEBKITDATADIR=\"${CMAKE_SOURCE_DIR}/data/webkit\"
-DEVOLUTION_TESTGIOMODULESDIR=\"${CMAKE_CURRENT_BINARY_DIR}\"
-DEVOLUTION_TESTTOPSRCDIR=\"${CMAKE_SOURCE_DIR}\"
-DLIBEUTIL_COMPILATION
......
......@@ -906,6 +906,11 @@ web_view_constructor (GType type,
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_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);
#endif
g_object_add_weak_pointer (G_OBJECT (web_context), &web_context);
} else {
......
......@@ -7365,6 +7365,7 @@ main (gint argc,
NULL },
{ NULL }
};
GApplication *application; /* Needed for WebKitGTK sandboxing */
GOptionContext *context;
GError *error = NULL;
GList *modules;
......@@ -7413,6 +7414,8 @@ main (gint argc,
e_util_init_main_thread (NULL);
e_passwords_init ();
application = g_application_new ("org.gnome.Evolution.test-html-editor-units", G_APPLICATION_FLAGS_NONE);
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), EVOLUTION_ICONDIR);
modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
......@@ -7549,6 +7552,7 @@ main (gint argc,
res = g_test_run ();
g_clear_object (&application);
e_misc_util_free_global_memory ();
test_utils_free_global_memory ();
......
......@@ -692,6 +692,7 @@ gint
main (gint argc,
gchar **argv)
{
GApplication *application; /* Needed for WebKitGTK sandboxing */
GList *modules;
bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
......@@ -703,6 +704,8 @@ main (gint argc,
e_util_init_main_thread (NULL);
e_passwords_init ();
application = g_application_new ("org.gnome.Evolution.test-html-editor", G_APPLICATION_FLAGS_NONE);
g_setenv ("E_HTML_EDITOR_TEST_SOURCES", "1", FALSE);
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), EVOLUTION_ICONDIR);
......@@ -717,6 +720,7 @@ main (gint argc,
gtk_main ();
g_clear_object (&application);
e_misc_util_free_global_memory ();
return 0;
......
......@@ -2975,6 +2975,7 @@ gint
main (gint argc,
gchar *argv[])
{
GApplication *application; /* Needed for WebKitGTK sandboxing */
gint res;
setlocale (LC_ALL, "");
......@@ -2989,6 +2990,8 @@ main (gint argc,
e_util_init_main_thread (NULL);
e_passwords_init ();
application = g_application_new ("org.gnome.Evolution.test-web-view-jsc", G_APPLICATION_FLAGS_NONE);
test_utils_add_test ("/EWebView/JSCObjectProperties", test_jsc_object_properties);
test_utils_add_test ("/EWebView/SetElementHidden", test_set_element_hidden);
test_utils_add_test ("/EWebView/SetElementDisabled", test_set_element_disabled);
......@@ -3006,6 +3009,7 @@ main (gint argc,
res = g_test_run ();
g_clear_object (&application);
e_misc_util_free_global_memory ();
return res;
......
......@@ -11,6 +11,8 @@ set(sources
)
set(extra_defines
-DEVOLUTION_WEB_EXTENSIONS_WEBKIT_EDITOR_DIR=\"${webextensionswebkiteditordir}\"
-DEVOLUTION_WEBKITDATADIR=\"${webkitdatadir}\"
-DEVOLUTION_SOURCE_WEBKITDATADIR=\"${CMAKE_SOURCE_DIR}/data/webkit\"
)
set(extra_cflags)
set(extra_incdirs)
......
......@@ -4198,6 +4198,11 @@ webkit_editor_constructor (GType type,
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_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);
#endif
g_object_add_weak_pointer (G_OBJECT (web_context), &web_context);
} else {
......
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