diff -urNad liferea-1.4.9~/src/mozilla/mozembed.c liferea-1.4.9/src/mozilla/mozembed.c
--- liferea-1.4.9~/src/mozilla/mozembed.c 2007-12-12 20:29:38.000000000 +0100
+++ liferea-1.4.9/src/mozilla/mozembed.c 2007-12-12 20:29:41.000000000 +0100
@@ -335,11 +335,17 @@
mozembed_init (void)
{
gchar *profile;
-
+
+ // if we use the glue we need to initialize the GRE
+ // explicitely.
+#ifdef XPCOM_GLUE
+ debug_enter ("mozembed_init (XPCOM_GLUE)");
+ g_assert(mozsupport_xpcom_init());
+#else
debug_enter ("mozembed_init");
-
- /* some GtkMozEmbed initialization taken from embed.c from the Galeon sources */
-
+#endif
+ /* some GtkMozEmbed initialization taken from embed.c from the Galeon sources */
+
/* init mozilla home */
g_assert (g_thread_supported ());
@@ -374,6 +380,7 @@
mozembed_deinit (void)
{
gtk_moz_embed_pop_startup ();
+ g_assert(mozsupport_xpcom_shutdown());
}
/* launches the specified URL */
diff -urNad liferea-1.4.9~/src/mozilla/mozilla.c liferea-1.4.9/src/mozilla/mozilla.c
--- liferea-1.4.9~/src/mozilla/mozilla.c 2007-12-12 20:29:38.000000000 +0100
+++ liferea-1.4.9/src/mozilla/mozilla.c 2007-12-12 20:29:41.000000000 +0100
@@ -35,9 +35,10 @@
static void mozilla_init(void) {
/* Avoid influencing the component loading by $MOZILLA_FIVE_HOME */
+#ifndef XPCOM_GLUE
g_unsetenv("MOZILLA_FIVE_HOME");
-
gtk_moz_embed_set_comp_path(MOZILLA_LIB_ROOT);
+#endif
mozembed_init();
}
diff -urNad liferea-1.4.9~/src/mozilla/mozsupport.cpp liferea-1.4.9/src/mozilla/mozsupport.cpp
--- liferea-1.4.9~/src/mozilla/mozsupport.cpp 2007-12-12 20:29:38.000000000 +0100
+++ liferea-1.4.9/src/mozilla/mozsupport.cpp 2007-12-12 20:29:53.000000000 +0100
@@ -29,21 +29,33 @@
# include <config.h>
#endif
-#define MOZILLA_INTERNAL_API
+// for GLUE we _must_ not use MOZILLA_INTERNAL_API
+#ifndef XPCOM_GLUE
+# define MOZILLA_INTERNAL_API
+#endif
#include "mozsupport.h"
#include <gtk/gtk.h>
+
#include <gtkmozembed.h>
#include <gtkmozembed_internal.h>
-#include "nsIWebBrowser.h"
-#include "nsIDOMMouseEvent.h"
-#include "dom/nsIDOMKeyEvent.h"
-#include "nsIDOMWindow.h"
-#include "nsIPrefService.h"
-#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "necko/nsNetCID.h"
+// if we use the glue (since 1.9), we must explicitly get the gtkmozembed symbols
+#ifdef XPCOM_GLUE
+# include <gtkmozembed_glue.cpp>
+#endif
+
+#include <nsIWebBrowser.h>
+#include <nsIDOMMouseEvent.h>
+#include <nsIDOMKeyEvent.h>
+#include <nsIDOMWindow.h>
+#include <nsIPrefService.h>
+#include <nsIServiceManager.h>
+#include <nsIIOService.h>
+#include <nsCOMPtr.h>
+#include <nsNetCID.h>
+
+#include <nsServiceManagerUtils.h>
extern "C" {
#include "conf.h"
@@ -277,3 +289,48 @@
//return FALSE;
}
+
+/* helpers for binaries linked against XPCOM_GLUE */
+#ifdef XPCOM_GLUE
+
+/**
+ * load xpcom through glue.
+ * When using the glue you have to call this method before doing
+ * anything else. It finds the GRE, loads the xpcom libs,
+ * maps the gtkmozbemd symbols and intializes xpcom by setting
+ * the path and component path.
+ *
+ * the caller still has to call gtk_moz_embed_push_startup()
+ */
+extern "C" gboolean
+mozsupport_xpcom_init ()
+{
+ static const GREVersionRange greVersion = {
+ "1.9a", PR_TRUE,
+ "1.9.*", PR_TRUE
+ };
+ char xpcomLocation[4096];
+ nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
+ NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED(rv));
+ // Startup the XPCOM Glue that links us up with XPCOM.
+ rv = XPCOMGlueStartup(xpcomLocation);
+ NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED(rv));
+ rv = GTKEmbedGlueStartup();
+ NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED(rv));
+ rv = GTKEmbedGlueStartupInternal();
+ NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED(rv));
+ char *lastSlash = strrchr(xpcomLocation, '/');
+ if (lastSlash)
+ *lastSlash = '\0';
+ gtk_moz_embed_set_path(xpcomLocation);
+
+ return TRUE;
+}
+
+extern "C" gboolean
+mozsupport_xpcom_shutdown ()
+{
+ return NS_SUCCEEDED(XPCOMGlueShutdown());
+}
+#endif
+
diff -urNad liferea-1.4.9~/src/mozilla/mozsupport.h liferea-1.4.9/src/mozilla/mozsupport.h
--- liferea-1.4.9~/src/mozilla/mozsupport.h 2007-12-12 20:29:38.000000000 +0100
+++ liferea-1.4.9/src/mozilla/mozsupport.h 2007-12-12 20:29:41.000000000 +0100
@@ -46,8 +46,15 @@
gboolean mozsupport_preference_set_boolean (const char *preference_name,
gboolean new_boolean_value);
gboolean mozsupport_preference_set_int (const char *preference_name,
- int new_int_value);
+ int new_int_value);
void mozsupport_set_offline_mode (gboolean offline);
+
+/* helpers for binaries linked against XPCOM_GLUE */
+#ifdef XPCOM_GLUE
+gboolean mozsupport_xpcom_init ();
+gboolean mozsupport_xpcom_shutdown ();
+#endif
+
#ifdef __cplusplus
}
#endif