[epiphany] web-extension: Use a different service name for every web process extension



commit 8ec71c6a3b9f2ab3f10b1eef201f758bdb44e21f
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Feb 19 17:13:51 2013 +0100

    web-extension: Use a different service name for every web process extension

 embed/ephy-embed-shell.c                 |    6 +++++-
 embed/web-extension/ephy-web-extension.c |    6 +++++-
 src/ephy-main.c                          |    5 +++++
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 7f48f7c..e5aa18e 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -697,14 +697,18 @@ ephy_embed_shell_get_web_extension_proxy (EphyEmbedShell *shell)
 
   priv = shell->priv;
   if (!priv->web_extension) {
+    char *service_name;
+
+    service_name = g_strdup_printf ("%s-%u", EPHY_WEB_EXTENSION_SERVICE_NAME, getpid ());
     priv->web_extension = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                                          G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
                                                          NULL,
-                                                         EPHY_WEB_EXTENSION_SERVICE_NAME,
+                                                         service_name,
                                                          EPHY_WEB_EXTENSION_OBJECT_PATH,
                                                          EPHY_WEB_EXTENSION_INTERFACE,
                                                          NULL,
                                                          NULL);
+    g_free (service_name);
   }
 
   return priv->web_extension;
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 1650026..8eb93e8 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -159,11 +159,15 @@ bus_acquired_cb (GDBusConnection *connection,
 G_MODULE_EXPORT void
 webkit_web_extension_initialize (WebKitWebExtension *extension)
 {
+  char *service_name;
+
+  service_name = g_strdup_printf ("%s-%s", EPHY_WEB_EXTENSION_SERVICE_NAME, g_getenv 
("EPHY_WEB_EXTENSION_ID"));
   g_bus_own_name (G_BUS_TYPE_SESSION,
-                  EPHY_WEB_EXTENSION_SERVICE_NAME,
+                  service_name,
                   G_BUS_NAME_OWNER_FLAGS_NONE,
                   bus_acquired_cb,
                   NULL, NULL,
                   g_object_ref (extension),
                   (GDestroyNotify)g_object_unref);
+  g_free (service_name);
 }
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 7c38fd9..1ec4b4b 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -229,6 +229,7 @@ main (int argc,
   EphyShell *ephy_shell;
   int status;
   EphyFileHelpersFlags flags;
+  char *pid_str;
 
 #ifdef ENABLE_NLS
   /* Initialize the i18n stuff */
@@ -459,6 +460,10 @@ main (int argc,
   }
 
 #ifdef HAVE_WEBKIT2
+  pid_str = g_strdup_printf ("%u", getpid ());
+  g_setenv ("EPHY_WEB_EXTENSION_ID", pid_str, TRUE);
+  g_free (pid_str);
+
   /* Set the web extensions dir ASAP before the process is launched */
   webkit_web_context_set_web_extensions_directory (webkit_web_context_get_default (),
                                                    EPHY_WEB_EXTENSIONS_DIR);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]