Commit 89c45b82 authored by Michael Catanzaro's avatar Michael Catanzaro

proxy: Use XDG_CURRENT_DESKTOP to determine which proxy module to load

This will somewhat reduce the odds that that we'll load libproxy in the
gnome-shell greeter process, causing libproxy's old version of mozjs to
be loaded into the same process as gjs's newer version, causing the
login screen to crash in a spectacular loop of sadness, causing
coredumpctl to thrash the system... yeah.

This is already fixed in gnome-session by
https://git.gnome.org/browse/gnome-session/commit/?id=5f920253dfb2c0f2c4b742690f306cfea2ac6613
but I figure I should do my civic duty here to make it easier to remove
these environment variables in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=790387
parent a1733e89
......@@ -315,17 +315,17 @@ update_settings (GProxyResolverGnome *resolver)
static gboolean
g_proxy_resolver_gnome_is_supported (GProxyResolver *object)
{
const char *session;
const char *desktop;
if (g_getenv ("GNOME_DESKTOP_SESSION_ID"))
return TRUE;
session = g_getenv ("DESKTOP_SESSION");
if (session == NULL)
desktop = g_getenv ("XDG_CURRENT_DESKTOP");
if (desktop == NULL)
return FALSE;
return g_str_has_prefix (session, "gnome") ||
strcmp (session, "ubuntu") == 0;
/* Remember that XDG_CURRENT_DESKTOP is a list of strings. Desktops that
* pretend to be GNOME, like Unity, add themselves here. That's fine, but
* if so they'd better really support our proxy settings.
*/
return strstr (desktop, "GNOME") != NULL;
}
static inline gchar **
......
......@@ -163,7 +163,7 @@ main (int argc,
g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/proxy/gnome/.libs", TRUE);
g_setenv ("GIO_USE_PROXY_RESOLVER", "gnome", TRUE);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
g_setenv ("DESKTOP_SESSION", "gnome", TRUE);
g_setenv ("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
g_test_add_vtable ("/proxy/gnome/uri", 0, NULL,
reset_proxy_settings, test_proxy_uri, NULL);
......
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