epiphany-extensions r1725 - in branches/gnome-2-22/extensions/page-info: . mozilla



Author: chpe
Date: Sun May 18 21:51:00 2008
New Revision: 1725
URL: http://svn.gnome.org/viewvc/epiphany-extensions?rev=1725&view=rev

Log:
Fix crash on opening the page info dialogue.
The problem was that we didn't startup the glue, so the string API consisted of NOPs which caused crashes when using those strings from within libxul.


Modified:
   branches/gnome-2-22/extensions/page-info/extension.c
   branches/gnome-2-22/extensions/page-info/mozilla/Makefile.am
   branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.cpp
   branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.h

Modified: branches/gnome-2-22/extensions/page-info/extension.c
==============================================================================
--- branches/gnome-2-22/extensions/page-info/extension.c	(original)
+++ branches/gnome-2-22/extensions/page-info/extension.c	Sun May 18 21:51:00 2008
@@ -22,6 +22,7 @@
 
 #include "ephy-page-info-extension.h"
 #include "page-info-dialog.h"
+#include "mozilla-helpers.h"
 #include "ephy-debug.h"
 
 #include <gmodule.h>
@@ -34,6 +35,9 @@
 {
 	LOG ("Registering EphyPageInfoExtension");
 
+        if (!mozilla_glue_startup ())
+              return 0;
+
 #ifdef ENABLE_NLS
 	/* Initialize the i18n stuff */
 	bindtextdomain (GETTEXT_PACKAGE, EPHY_EXTENSIONS_LOCALEDIR);

Modified: branches/gnome-2-22/extensions/page-info/mozilla/Makefile.am
==============================================================================
--- branches/gnome-2-22/extensions/page-info/mozilla/Makefile.am	(original)
+++ branches/gnome-2-22/extensions/page-info/mozilla/Makefile.am	Sun May 18 21:51:00 2008
@@ -32,3 +32,10 @@
 	$(MOZILLA_COMPONENT_CFLAGS)	\
 	$(EPIPHANY_DEPENDENCY_CFLAGS) 	\
 	$(AM_CXXFLAGS)
+
+if HAVE_GECKO_1_9
+if HAVE_GECKO_XPCOM_GLUE
+libpageinfomozilla_la_CPPFLAGS += \
+ 	-DXPCOM_GLUE_USE_NSPR
+endif
+endif

Modified: branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.cpp
==============================================================================
--- branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.cpp	(original)
+++ branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.cpp	Sun May 18 21:51:00 2008
@@ -1,7 +1,7 @@
 /*
  *  Copyright  2004 Adam Hooper
  *  Copyright  2004, 2005 Jean-FranÃois Rameau
- *  Copyright  2004, 2005 Christian Persch
+ *  Copyright  2004, 2005, 2008 Christian Persch
  *
  *  Ripped from GaleonWrapper.cpp, which has no copyright info besides Marco...
  *
@@ -27,6 +27,11 @@
 
 #include <string.h>
 
+#ifdef XPCOM_GLUE
+#include <nsXPCOMGlue.h>
+#include <gtkmozembed_glue.cpp>
+#endif
+
 #include <nsStringAPI.h>
 
 #include <gtkmozembed.h>
@@ -169,7 +174,7 @@
   NS_ENSURE_ARG (aEmbed);
 
   nsCOMPtr<nsIWebBrowser> browser;
-  gtk_moz_embed_get_nsIWebBrowser (GTK_MOZ_EMBED (aEmbed),
+  gtk_moz_embed_get_nsIWebBrowser (GTK_MOZ_EMBED (gtk_bin_get_child (GTK_BIN (aEmbed))),
                                    getter_AddRefs (browser));
   NS_ENSURE_TRUE (browser, NS_ERROR_FAILURE);
 
@@ -1201,3 +1206,26 @@
 
   return info;
 }
+
+gboolean
+mozilla_glue_startup (void)
+{
+#ifdef XPCOM_GLUE
+	static const GREVersionRange greVersion = {
+	  "1.9a", PR_TRUE,
+	  "2", PR_TRUE
+	};
+	char xpcomLocation[4096];
+
+	if (NS_FAILED (GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, sizeof (xpcomLocation))) ||
+	    NS_FAILED (XPCOMGlueStartup (xpcomLocation)) ||
+	    NS_FAILED (GTKEmbedGlueStartup ()) ||
+	    NS_FAILED (GTKEmbedGlueStartupInternal()))
+                return FALSE;
+
+        return TRUE;
+#else
+#error hi there!
+        return TRUE;
+#endif /* XPCOM_GLUE */
+}

Modified: branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.h
==============================================================================
--- branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.h	(original)
+++ branches/gnome-2-22/extensions/page-info/mozilla/mozilla-helpers.h	Sun May 18 21:51:00 2008
@@ -1,7 +1,7 @@
 /*
  *  Copyright  2004 Adam Hooper
  *  Copyright  2004, 2005 Jean-FranÃois Rameau
- *  Copyright  2004, 2005 Christian Persch
+ *  Copyright  2004, 2005, 2008 Christian Persch
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -127,6 +127,8 @@
 
 void           mozilla_free_embed_page_info (EmbedPageInfo *info);
 
+gboolean       mozilla_glue_startup         (void);
+
 G_END_DECLS
 
 #endif /* PAGE_INFO_MOZILLA_HELPERS_H */



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