[epiphany] Use an ephemeral WebKitWebContext in incognito mode
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use an ephemeral WebKitWebContext in incognito mode
- Date: Tue, 31 Jan 2017 16:43:27 +0000 (UTC)
commit 1bc3e49fd319cbe21c3635b005d68d0dad659fcf
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Wed Jan 25 13:16:19 2017 +0100
Use an ephemeral WebKitWebContext in incognito mode
That ensures nothing is written to the disk by WebKit.
https://bugzilla.gnome.org/show_bug.cgi?id=777736
configure.ac | 2 +-
embed/ephy-embed-shell.c | 23 +++++++++++++++--------
embed/ephy-embed-shell.h | 3 ---
3 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2768f4a..8babd62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,7 @@ LT_LIB_M
GLIB_REQUIRED=2.46.0
GTK_REQUIRED=3.22.0
-WEBKITGTK_REQUIRED=2.15.3
+WEBKITGTK_REQUIRED=2.15.4
PKG_CHECK_MODULES([CAIRO], [cairo >= 1.2])
PKG_CHECK_MODULES([GCR], [gcr-3 >= 3.5.5])
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 555c2ff..0153958 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -664,7 +664,7 @@ initialize_web_extensions (WebKitWebContext *web_context,
address = priv->dbus_server ? g_dbus_server_get_client_address (priv->dbus_server) : NULL;
- private_profile = EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (priv->mode);
+ private_profile = priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE || priv->mode ==
EPHY_EMBED_SHELL_MODE_INCOGNITO;
user_data = g_variant_new ("(msssb)",
address,
ephy_dot_dir (),
@@ -802,10 +802,15 @@ ephy_embed_shell_create_web_context (EphyEmbedShell *shell)
char *data_dir;
char *cache_dir;
- data_dir = g_build_filename (EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (priv->mode) ?
+ if (priv->mode == EPHY_EMBED_SHELL_MODE_INCOGNITO) {
+ priv->web_context = webkit_web_context_new_ephemeral ();
+ return;
+ }
+
+ data_dir = g_build_filename (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
ephy_dot_dir () : g_get_user_data_dir (),
g_get_prgname (), NULL);
- cache_dir = g_build_filename (EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (priv->mode) ?
+ cache_dir = g_build_filename (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
ephy_dot_dir () : g_get_user_cache_dir (),
g_get_prgname (), NULL);
@@ -926,7 +931,7 @@ ephy_embed_shell_startup (GApplication *application)
shell);
/* Favicon Database */
- favicon_db_path = g_build_filename (EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE (priv->mode) ?
+ favicon_db_path = g_build_filename (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
ephy_dot_dir () : g_get_user_cache_dir (),
"icondatabase", NULL);
webkit_web_context_set_favicon_database_directory (priv->web_context, favicon_db_path);
@@ -965,10 +970,12 @@ ephy_embed_shell_startup (GApplication *application)
/* Store cookies in moz-compatible SQLite format */
cookie_manager = webkit_web_context_get_cookie_manager (priv->web_context);
- filename = g_build_filename (ephy_dot_dir (), "cookies.sqlite", NULL);
- webkit_cookie_manager_set_persistent_storage (cookie_manager, filename,
- WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
- g_free (filename);
+ if (priv->mode != EPHY_EMBED_SHELL_MODE_INCOGNITO) {
+ filename = g_build_filename (ephy_dot_dir (), "cookies.sqlite", NULL);
+ webkit_cookie_manager_set_persistent_storage (cookie_manager, filename,
+ WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
+ g_free (filename);
+ }
cookie_policy = g_settings_get_string (EPHY_SETTINGS_WEB,
EPHY_PREFS_WEB_COOKIES_POLICY);
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index 27f7219..969d666 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -43,9 +43,6 @@ typedef enum
EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER
} EphyEmbedShellMode;
-#define EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE(mode) \
- (mode == EPHY_EMBED_SHELL_MODE_PRIVATE || mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
-
struct _EphyEmbedShellClass
{
GtkApplicationClass parent_class;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]