epiphany r8142 - in branches/gnome-2-22: . doc/reference embed embed/mozilla m4 plugins/desktop-file src



Author: chpe
Date: Fri Mar 28 15:06:31 2008
New Revision: 8142
URL: http://svn.gnome.org/viewvc/epiphany?rev=8142&view=rev

Log:
Allow building with xulrunner 1.9. Patch by Alexander Sack; part of bug #503657



Modified:
   branches/gnome-2-22/configure.ac
   branches/gnome-2-22/doc/reference/Makefile.am
   branches/gnome-2-22/embed/Makefile.am
   branches/gnome-2-22/embed/ephy-password-manager.c
   branches/gnome-2-22/embed/ephy-password-manager.h
   branches/gnome-2-22/embed/mozilla/AutoModalDialog.cpp
   branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp
   branches/gnome-2-22/embed/mozilla/GtkNSSDialogs.cpp
   branches/gnome-2-22/embed/mozilla/Makefile.am
   branches/gnome-2-22/embed/mozilla/mozilla-embed-single.cpp
   branches/gnome-2-22/m4/gecko.m4
   branches/gnome-2-22/plugins/desktop-file/Makefile.am
   branches/gnome-2-22/src/Makefile.am

Modified: branches/gnome-2-22/configure.ac
==============================================================================
--- branches/gnome-2-22/configure.ac	(original)
+++ branches/gnome-2-22/configure.ac	Fri Mar 28 15:06:31 2008
@@ -238,12 +238,44 @@
 
 case "$gecko_cv_gecko" in
 xulrunner) min_version=1.8 ;;
+libxul*) min_version=1.9 ;;
 *firefox) min_version=1.5 ;;
 *) AC_MSG_ERROR([Unsupported gecko "$gecko_cv_gecko"]) ;;
 esac
 
 # Added $gecko_cv_gecko-js for debian xulrunner brokenness
-PKG_CHECK_MODULES([GECKO],[${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_gecko}-js $gecko_cv_extra_pkg_dependencies])
+if test $gecko_cv_gecko != "libxul-embedding" -a $gecko_cv_gecko != "libxul"; then
+	PKG_CHECK_MODULES([GECKO],[ ${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_gecko}-js $gecko_cv_extra_pkg_dependencies])
+else
+	GECKO_CFLAGS="$GECKO_CFLAGS -UDEBUG"
+	GECKO_LIBS="$GECKO_LIBS `pkg-config --libs ${gecko_cv_gecko}`"
+fi
+
+AC_MSG_CHECKING(nspr in gecko)
+if test "$GECKO_NSPR" != yes; then
+	AC_MSG_RESULT(no)
+	AC_MSG_CHECKING(nspr in system)
+	gecko_nspr=
+	if $PKG_CONFIG --exists mozilla-nspr; then
+		gecko_nspr=mozilla-nspr
+	elif $PKG_CONFIG --exists ${gecko_cv_gecko}-nspr; then
+		gecko_nspr=${gecko_cv_gecko}-nspr
+	fi
+	if $PKG_CONFIG --exists nspr; then
+		gecko_nspr=nspr
+	fi
+	if test -z "$gecko_nspr"; then
+		AC_MSG_ERROR([no nspr available])
+	fi
+
+	GECKO_CFLAGS="$GECKO_CFLAGS `$PKG_CONFIG --cflags ${gecko_nspr}`"
+	GECKO_LIBS="$GECKO_LIBS `$PKG_CONFIG --libs ${gecko_nspr}`"
+	_GECKO_CFLAGS="$GECKO_CFLAGS"
+	AC_MSG_RESULT(yes)
+else
+	AC_MSG_RESULT(yes)
+fi
+
 AC_SUBST([GECKO_CFLAGS])
 AC_SUBST([GECKO_LIBS])
 
@@ -533,7 +565,11 @@
 AC_MSG_RESULT([$enable_desktop_file_plugin])
 
 if test "$enable_desktop_file_plugin" = "yes"; then
-	PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0])
+	if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then
+		PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko} mozilla-plugin gtk+-2.0 >= 2.6.0])
+	else
+		PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0])
+	fi
 	AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_CFLAGS])
 	AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_LIBS])
 fi

Modified: branches/gnome-2-22/doc/reference/Makefile.am
==============================================================================
--- branches/gnome-2-22/doc/reference/Makefile.am	(original)
+++ branches/gnome-2-22/doc/reference/Makefile.am	Fri Mar 28 15:06:31 2008
@@ -207,10 +207,10 @@
 
 if GTK_DOC_USE_LIBTOOL
 GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
+GTKDOC_LD = $(LIBTOOL) --mode=link $(CXX) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
 else
 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
+GTKDOC_LD = $(CXX) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
 endif
 
 # We set GPATH here; this gives us semantics for GNU make

Modified: branches/gnome-2-22/embed/Makefile.am
==============================================================================
--- branches/gnome-2-22/embed/Makefile.am	(original)
+++ branches/gnome-2-22/embed/Makefile.am	Fri Mar 28 15:06:31 2008
@@ -107,6 +107,7 @@
 endif
 
 libephyembedfactory_la_CFLAGS = \
+	$(GECKO_CFLAGS) \
 	$(DEPENDENCIES_CFLAGS) 	\
 	$(AM_CFLAGS)
 

Modified: branches/gnome-2-22/embed/ephy-password-manager.c
==============================================================================
--- branches/gnome-2-22/embed/ephy-password-manager.c	(original)
+++ branches/gnome-2-22/embed/ephy-password-manager.c	Fri Mar 28 15:06:31 2008
@@ -80,6 +80,10 @@
 	copy->host = g_strdup (info->host);
 	copy->username = g_strdup (info->username);
 	copy->password = g_strdup (info->password);
+	copy->httpRealm = g_strdup (info->httpRealm);
+	copy->passwordField = g_strdup (info->passwordField);
+	copy->usernameField = g_strdup (info->usernameField);
+	copy->formSubmitURL = g_strdup (info->formSubmitURL);
 
 	return copy;
 }

Modified: branches/gnome-2-22/embed/ephy-password-manager.h
==============================================================================
--- branches/gnome-2-22/embed/ephy-password-manager.h	(original)
+++ branches/gnome-2-22/embed/ephy-password-manager.h	Fri Mar 28 15:06:31 2008
@@ -44,6 +44,11 @@
 	char *host;
 	char *username;
 	char *password;
+
+	char *httpRealm;
+	char *formSubmitURL;
+	char *usernameField;
+	char *passwordField;
 } EphyPasswordInfo;
 
 struct _EphyPasswordManagerIface

Modified: branches/gnome-2-22/embed/mozilla/AutoModalDialog.cpp
==============================================================================
--- branches/gnome-2-22/embed/mozilla/AutoModalDialog.cpp	(original)
+++ branches/gnome-2-22/embed/mozilla/AutoModalDialog.cpp	Fri Mar 28 15:06:31 2008
@@ -35,7 +35,6 @@
 #include <nsIDOMDocument.h>
 #include <nsIDOMEvent.h>
 #include <nsIDOMEventTarget.h>
-#include <nsIJSContextStack.h>
 #include <nsIPrivateDOMEvent.h>
 #include <nsPIDOMWindow.h>
 #include <nsServiceManagerUtils.h>

Modified: branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp
==============================================================================
--- branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp	(original)
+++ branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp	Fri Mar 28 15:06:31 2008
@@ -1567,6 +1567,7 @@
 
   // get the private DOM window
   nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(mDOMWindow);
+  NS_ENSURE_TRUE (domWindowPrivate, NS_ERROR_UNEXPECTED);
 
   // and the root window for that DOM window
   *aPIWin = domWindowPrivate->GetPrivateRoot();

Modified: branches/gnome-2-22/embed/mozilla/GtkNSSDialogs.cpp
==============================================================================
--- branches/gnome-2-22/embed/mozilla/GtkNSSDialogs.cpp	(original)
+++ branches/gnome-2-22/embed/mozilla/GtkNSSDialogs.cpp	Fri Mar 28 15:06:31 2008
@@ -217,7 +217,7 @@
 	}
 }
 
-
+#ifndef HAVE_GECKO_1_9
 /**
  *  Display a dialog box, showing 'View Certificate', 'Cancel',
  *  and 'Accept' buttons. Optionally a checkbox can be shown,
@@ -321,7 +321,7 @@
 	gtk_widget_destroy (dialog);
         return res;
 }
-
+#endif /* HAVE_GECKO_1_9 */
 
 /* Helper functions */
 

Modified: branches/gnome-2-22/embed/mozilla/Makefile.am
==============================================================================
--- branches/gnome-2-22/embed/mozilla/Makefile.am	(original)
+++ branches/gnome-2-22/embed/mozilla/Makefile.am	Fri Mar 28 15:06:31 2008
@@ -91,6 +91,7 @@
 	GtkNSSSecurityWarningDialogs.h
 endif
 
+
 if ENABLE_SPELLCHECKER
 libephymozillaembed_la_SOURCES += \
 	GeckoSpellCheckEngine.cpp	\
@@ -153,6 +154,13 @@
 	-DALLOW_PRIVATE_API			\
 	$(AM_CPPFLAGS)
 
+if HAVE_GECKO_1_9
+if HAVE_GECKO_XPCOM_GLUE
+libephymozillaembed_la_CPPFLAGS += \
+ 	-DXPCOM_GLUE_USE_NSPR
+endif
+endif
+
 libephymozillaembed_la_CXXFLAGS = \
 	$(GECKO_CFLAGS)		\
 	$(DEPENDENCIES_CFLAGS) 	\

Modified: branches/gnome-2-22/embed/mozilla/mozilla-embed-single.cpp
==============================================================================
--- branches/gnome-2-22/embed/mozilla/mozilla-embed-single.cpp	(original)
+++ branches/gnome-2-22/embed/mozilla/mozilla-embed-single.cpp	Fri Mar 28 15:06:31 2008
@@ -33,6 +33,11 @@
 
 #include <nsStringAPI.h>
 
+#ifdef XPCOM_GLUE
+#include <nsXPCOMGlue.h>
+#include <gtkmozembed_glue.cpp>
+#endif
+
 #include <gtkmozembed.h>
 #include <gtkmozembed_internal.h>
 #include <nsComponentManagerUtils.h>
@@ -62,8 +67,11 @@
 #include <nsNetCID.h>
 #endif /* ALLOW_PRIVATE_API */
 
-#ifndef HAVE_GECKO_1_9
-#include <nsIPassword.h>
+#ifdef HAVE_GECKO_1_9
+#include <nsILoginInfo.h>
+#include <nsILoginManager.h>
+#else
+init#include <nsIPassword.h>
 #include <nsIPasswordManager.h>
 #endif /* !HAVE_GECKO_1_9 */
 
@@ -324,6 +332,7 @@
 	profile_path = g_build_filename (ephy_dot_dir (), 
 					 MOZILLA_PROFILE_DIR,
 					 (char *) NULL);
+        gtk_moz_embed_set_comp_path (profile_path);
         gtk_moz_embed_set_profile_path (profile_path, MOZILLA_PROFILE_NAME);
         g_free (profile_path);
 }
@@ -371,6 +380,19 @@
 }
 
 static void
+mozilla_init_login_manager (MozillaEmbedSingle *single)
+{
+#ifdef HAVE_GECKO_1_9
+        nsCOMPtr<nsILoginManager> loginManager =
+                        do_GetService (NS_LOGINMANAGER_CONTRACTID);
+	if (!loginManager)
+		g_warning ("Failed to instantiate LoginManager");
+	else
+		g_debug ("LoginManager tapped");
+#endif /* HAVE_GECKO_1_9 */
+}
+
+static void
 user_css_register (MozillaEmbedSingle *single)
 {
 	MozillaEmbedSinglePrivate *priv = single->priv;
@@ -565,6 +587,57 @@
 	NS_LogInit ();
 #endif
 
+	nsresult rv;
+#ifdef XPCOM_GLUE
+	static const GREVersionRange greVersion = {
+	  "1.9a", PR_TRUE,
+	  "2", PR_TRUE
+	};
+	char xpcomLocation[4096];
+	rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
+	if (NS_FAILED (rv))
+	{
+	  g_warning ("Could not find a suitable GRE!\n");
+	  return FALSE;
+	}
+
+	// Startup the XPCOM Glue that links us up with XPCOM.
+	rv = XPCOMGlueStartup(xpcomLocation);
+	if (NS_FAILED (rv))
+	{
+	  g_warning ("Could not startup XPCOM glue!\n");
+	  return FALSE;
+	}
+
+	rv = GTKEmbedGlueStartup();
+	if (NS_FAILED (rv))
+	{
+	  g_warning ("Could not startup embed glue!\n");
+	  return FALSE;
+	}
+
+	rv = GTKEmbedGlueStartupInternal();
+	if (NS_FAILED (rv))
+	{
+	  g_warning ("Could not startup internal glue!\n");
+	  return FALSE;
+	}
+
+	char *lastSlash = strrchr(xpcomLocation, '/');
+	if (lastSlash)
+	  *lastSlash = '\0';
+
+	gtk_moz_embed_set_path(xpcomLocation);
+#else
+#ifdef HAVE_GECKO_1_9
+        gtk_moz_embed_set_path (MOZILLA_HOME);
+#else
+        gtk_moz_embed_set_comp_path (MOZILLA_HOME);
+#endif
+#endif // XPCOM_GLUE
+	/* Fire up the beast */
+	gtk_moz_embed_push_startup ();
+
 	/* Pre initialization */
 	mozilla_init_plugin_path ();
 
@@ -581,8 +654,6 @@
 
 	gtk_moz_embed_set_directory_service_provider (dp);
 
-	/* Fire up the beast */
-	gtk_moz_embed_push_startup ();
 	/* FIXME check that it succeeded! */
 
 	mozilla_register_components ();
@@ -600,7 +671,9 @@
 
 	mozilla_init_observer (single);
 
-        mozilla_stylesheet_init (single);
+	mozilla_stylesheet_init (single);
+
+	mozilla_init_login_manager (single);
 
 	return TRUE;
 }
@@ -848,16 +921,95 @@
 {
 	GList *passwords = NULL;
 
-#ifndef HAVE_GECKO_1_9
+	nsCOMPtr<nsIIDNService> idnService
+		(do_GetService ("@mozilla.org/network/idn-service;1"));
+	NS_ENSURE_TRUE (idnService, NULL);
+
+#ifdef HAVE_GECKO_1_9
+	nsILoginInfo **logins = nsnull;
+	PRUint32 count,i;
+	nsresult rv;
+
+	nsCOMPtr<nsILoginManager> loginManager =
+			do_GetService (NS_LOGINMANAGER_CONTRACTID);
+	NS_ENSURE_TRUE (loginManager, NULL);
+
+	loginManager -> GetAllLogins(&count, &logins);
+
+	for (i=0; i < count; i++) {
+		nsString transfer;
+		nsString unicodeName;
+		rv = logins[i]->GetHostname (transfer);
+		if (NS_FAILED (rv)) continue;
+
+		nsCString host;
+		idnService->ConvertACEtoUTF8 (NS_ConvertUTF16toUTF8(transfer), host);
+		if(transfer.IsVoid()) host.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetHttpRealm (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString httpRealm;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, httpRealm);
+		if(unicodeName.IsVoid()) httpRealm.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetUsername (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString userName;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, userName);
+		if(unicodeName.IsVoid()) userName.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetUsernameField (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString usernameField;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, usernameField);
+		if(unicodeName.IsVoid()) usernameField.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetPassword (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString userPassword;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, userPassword);
+		if(unicodeName.IsVoid()) userPassword.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetPasswordField (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString passwordField;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, passwordField);
+		if(unicodeName.IsVoid()) passwordField.SetIsVoid(PR_TRUE);
+
+		rv = logins[i]->GetFormSubmitURL (unicodeName);
+		if (NS_FAILED (rv)) continue;
+		nsCString formSubmitURL;
+		NS_UTF16ToCString (unicodeName,
+				   NS_CSTRING_ENCODING_UTF8, formSubmitURL);
+		if(unicodeName.IsVoid()) formSubmitURL.SetIsVoid(PR_TRUE);
+
+
+		EphyPasswordInfo *p = g_new0 (EphyPasswordInfo, 1);
+		p->host = !userName.IsVoid() ? g_strdup (host.get()) : nsnull;
+		p->username = !userName.IsVoid() ? g_strdup (userName.get()) : nsnull;
+		p->password = !userPassword.IsVoid() ? g_strdup (userPassword.get()) : nsnull;
+		p->httpRealm = !httpRealm.IsVoid() ? g_strdup(httpRealm.get()) : nsnull;
+		p->usernameField = !usernameField.IsVoid() ? g_strdup(usernameField.get()) : nsnull;
+		p->passwordField = !passwordField.IsVoid() ? g_strdup(passwordField.get()) : nsnull;
+		p->formSubmitURL = !formSubmitURL.IsVoid() ? g_strdup(formSubmitURL.get()) : nsnull;
+
+		passwords = g_list_prepend (passwords, p);
+	}
+
+	NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY (count, logins);
+
+#else // HAVE_GECKO_1_9
+
 	nsresult rv;
 	nsCOMPtr<nsIPasswordManager> passwordManager =
 			do_GetService (NS_PASSWORDMANAGER_CONTRACTID);
 	if (!passwordManager) return NULL;
 
-	nsCOMPtr<nsIIDNService> idnService
-		(do_GetService ("@mozilla.org/network/idn-service;1"));
-	NS_ENSURE_TRUE (idnService, NULL);
-
 	nsCOMPtr<nsISimpleEnumerator> passwordEnumerator;
 	passwordManager->GetEnumerator (getter_AddRefs(passwordEnumerator));
 	NS_ENSURE_TRUE (passwordEnumerator, NULL);
@@ -910,31 +1062,85 @@
 impl_remove_password (EphyPasswordManager *manager,
 		      EphyPasswordInfo *info)
 {
-#ifndef HAVE_GECKO_1_9
-        nsCOMPtr<nsIPasswordManager> pm =
-                        do_GetService (NS_PASSWORDMANAGER_CONTRACTID);
-	if (!pm) return;
+	nsresult rv;
+	nsString host;
+	nsString userName;
+	nsString userNameField;
+	nsString password;
+	nsString passwordField;
+	nsString httpRealm;
+	nsString formSubmitURL;
 
 	nsCOMPtr<nsIIDNService> idnService
 		(do_GetService ("@mozilla.org/network/idn-service;1"));
 	NS_ENSURE_TRUE (idnService, );
 
-	nsresult rv;
-	nsCString host;
-	rv = idnService->ConvertUTF8toACE (nsCString(info->host), host);
-	NS_ENSURE_SUCCESS (rv, );
+        if(info->formSubmitURL != nsnull)
+	        g_debug("form submit url: %s", info->formSubmitURL);
+	else
+       	 g_debug("form submit url is NULL");
 
-	nsString userName;
 	NS_CStringToUTF16 (nsCString(info->username),
 			   NS_CSTRING_ENCODING_UTF8, userName);
-	pm->RemoveUser (host, userName);
-#endif /* !HAVE_GECKO_1_9 */
+	NS_CStringToUTF16 (nsCString(info->usernameField),
+			   NS_CSTRING_ENCODING_UTF8, userNameField);
+	NS_CStringToUTF16 (nsCString(info->host),
+			   NS_CSTRING_ENCODING_UTF8, host);
+	NS_CStringToUTF16 (nsCString(info->httpRealm),
+			   NS_CSTRING_ENCODING_UTF8, httpRealm);
+	NS_CStringToUTF16 (nsCString(info->password),
+			   NS_CSTRING_ENCODING_UTF8, password);
+	NS_CStringToUTF16 (nsCString(info->passwordField),
+			   NS_CSTRING_ENCODING_UTF8, passwordField);
+	NS_CStringToUTF16 (nsCString(info->formSubmitURL),
+			   NS_CSTRING_ENCODING_UTF8, formSubmitURL);
+
+#ifdef HAVE_GECKO_1_9
+	if(!info->username) userName.SetIsVoid(PR_TRUE);
+	if(!info->usernameField) userNameField.SetIsVoid(PR_TRUE);
+	if(!info->host) host.SetIsVoid(PR_TRUE);
+	if(!info->httpRealm) httpRealm.SetIsVoid(PR_TRUE);
+	if(!info->password) password.SetIsVoid(PR_TRUE);
+	if(!info->passwordField) passwordField.SetIsVoid(PR_TRUE);
+	if(!info->formSubmitURL) formSubmitURL.SetIsVoid(PR_TRUE);
+
+	nsCOMPtr<nsILoginManager> loginManager =
+			do_GetService (NS_LOGINMANAGER_CONTRACTID);
+	NS_ENSURE_TRUE (loginManager, );
+
+	nsCOMPtr<nsILoginInfo> login
+		(do_CreateInstance(NS_LOGININFO_CONTRACTID));
+
+	login->SetUsername(userName);
+	login->SetUsernameField(userNameField);
+	login->SetHostname(host);
+	login->SetHttpRealm(httpRealm);
+	login->SetFormSubmitURL(formSubmitURL);
+	login->SetPassword(password);
+	login->SetPasswordField(passwordField);
+
+	rv = loginManager->RemoveLogin(login);
+
+#else /* !HAVE_GECKO_1_9 */
+        nsCOMPtr<nsIPasswordManager> pm =
+                        do_GetService (NS_PASSWORDMANAGER_CONTRACTID);
+	if (!pm) return;
+
+	pm->RemoveUser (nsCString(info->host), userName);
+#endif /* HAVE_GECKO_1_9 */
 }
 
 static void
 impl_remove_all_passwords (EphyPasswordManager *manager)
 {
-#ifndef HAVE_GECKO_1_9
+#ifdef HAVE_GECKO_1_9
+	nsCOMPtr<nsILoginManager> loginManager =
+			do_GetService (NS_LOGINMANAGER_CONTRACTID);
+	NS_ENSURE_TRUE (loginManager, );
+
+	loginManager->RemoveAllLogins();
+
+#else /* HAVE_GECKO_1_9 */
 	nsresult rv;
 	nsCOMPtr<nsIPasswordManager> passwordManager =
 			do_GetService (NS_PASSWORDMANAGER_CONTRACTID);

Modified: branches/gnome-2-22/m4/gecko.m4
==============================================================================
--- branches/gnome-2-22/m4/gecko.m4	(original)
+++ branches/gnome-2-22/m4/gecko.m4	Fri Mar 28 15:06:31 2008
@@ -32,6 +32,7 @@
 # VARIABLE: Which gecko was found (e.g. "xulrunnner", "seamonkey", ...)
 # VARIABLE_FLAVOUR: The flavour of the gecko that was found
 # VARIABLE_HOME:
+# VARIABLE_NSPR: set if nspr is provided by gecko flags
 # VARIABLE_PREFIX:
 # VARIABLE_INCLUDE_ROOT:
 # VARIABLE_VERSION: The version of the gecko that was found
@@ -51,7 +52,7 @@
 AC_MSG_CHECKING([which gecko to use])
 
 AC_ARG_WITH([gecko],
-	AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner@:>@],
+	AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner|libxul-embedding|libxul@:>@],
 		       [Which gecko engine to use (autodetected by default)]))
 
 # Backward compat
@@ -60,12 +61,15 @@
 gecko_cv_gecko=$with_gecko
 
 # Autodetect gecko
-_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla"
+_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla libxul-embedding libxul"
 if test -z "$gecko_cv_gecko"; then
 	for lizard in $_geckos; do
 		if $PKG_CONFIG --exists $lizard-xpcom; then
 			gecko_cv_gecko=$lizard
 			break;
+		elif $PKG_CONFIG --exists $lizard-unstable; then
+			gecko_cv_gecko=$lizard
+			break;
 		fi
 	done
 fi
@@ -82,6 +86,14 @@
 	gecko_cv_have_gecko=yes
 fi
 
+AC_MSG_CHECKING([manual gecko home set])
+
+AC_ARG_WITH([gecko-home],
+	AS_HELP_STRING([--with-gecko-home@<:@=[path]@:>@],
+		       [Manually set MOZILLA_FIVE_HOME]))
+
+gecko_cv_gecko_home=$with_gecko_home
+
 # ****************
 # Define variables
 # ****************
@@ -93,13 +105,24 @@
 seamonkey) gecko_cv_gecko_flavour=mozilla ;;
 *firefox) gecko_cv_gecko_flavour=toolkit ;;
 xulrunner) gecko_cv_gecko_flavour=toolkit ;;
+libxul*) gecko_cv_gecko_flavour=toolkit ;;
 esac
 
-_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`"
-_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
-_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
-_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`"
-
+if $PKG_CONFIG --exists  ${gecko_cv_gecko}-xpcom; then
+	_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`"
+	_GECKO_CFLAGS="-I$_GECKO_INCLUDE_ROOT"
+	_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+	_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+	_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`"
+	_GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test
+else
+	_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}`/unstable"
+	_GECKO_CFLAGS="`$PKG_CONFIG --cflags ${gecko_cv_gecko}` `$PKG_CONFIG --cflags ${gecko_cv_gecko}-unstable`"
+	_GECKO_LIBDIR="`$PKG_CONFIG --variable=sdkdir ${gecko_cv_gecko}`/bin"
+	_GECKO_HOME=$with_gecko_home
+	_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}`"
+	_GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test
+fi
 fi # if gecko_cv_have_gecko
 
 if test "$gecko_cv_gecko_flavour" = "toolkit"; then
@@ -109,9 +132,11 @@
 $1[]=$gecko_cv_gecko
 $1[]_FLAVOUR=$gecko_cv_gecko_flavour
 $1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT
+$1[]_CFLAGS=$_GECKO_CFLAGS
 $1[]_LIBDIR=$_GECKO_LIBDIR
 $1[]_HOME=$_GECKO_HOME
 $1[]_PREFIX=$_GECKO_PREFIX
+$1[]_NSPR=$_GECKO_NSPR
 
 # **************************************************************
 # This is really gcc-only
@@ -182,7 +207,7 @@
 AC_LANG_PUSH([C++])
 
 _SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT"
+CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS"
 
 AC_MSG_CHECKING([[whether we have a gtk 2 gecko build]])
 AC_RUN_IFELSE(
@@ -215,6 +240,18 @@
 	[gecko_cv_have_debug=no])
 AC_MSG_RESULT([$gecko_cv_have_debug])
 
+AC_MSG_CHECKING([[whether we have a xpcom glue]])
+AC_COMPILE_IFELSE(
+	[AC_LANG_SOURCE(
+		[[
+		  #ifndef XPCOM_GLUE
+		  #error "no xpcom glue found"
+		  #endif]]
+	)],
+	[gecko_cv_have_xpcom_glue=yes],
+	[gecko_cv_have_xpcom_glue=no])
+AC_MSG_RESULT([$gecko_cv_have_xpcom_glue])
+
 CPPFLAGS="$_SAVE_CPPFLAGS"
 
 AC_LANG_POP([C++])
@@ -226,8 +263,14 @@
 	AC_DEFINE([HAVE_GECKO_DEBUG],[1],[Define if gecko is a debug build])
 fi
 
+if test "$gecko_cv_have_xpcom_glue" = "yes"; then
+	AC_DEFINE([HAVE_GECKO_XPCOM_GLUE],[1],[Define if xpcom glue is used])
+fi
+
 fi # if gecko_cv_have_gecko
 
+AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"])
+AM_CONDITIONAL([HAVE_GECKO_XPCOM_GLUE],[test "$gecko_cv_have_xpcom_glue" = "yes"])
 
 # ***********************
 # Check for gecko version
@@ -238,7 +281,7 @@
 AC_LANG_PUSH([C++])
 
 _SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT"
+CPPFLAGS="$CPPFLAGS $_GECKO_CFLAGS"
 
 AC_CACHE_CHECK([for gecko version],
 	[gecko_cv_gecko_version],
@@ -320,8 +363,11 @@
 gecko_cv_extra_pkg_dependencies=
 
 if test "$gecko_cv_gecko_version_int" -ge "1009000"; then
-	gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul"
-	gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue_s"
+	if ! test "$gecko_cv_have_xpcom_glue" = "yes"; then
+		gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul"
+	else
+		gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue"
+	fi
 else
 	gecko_cv_extra_pkg_dependencies="${gecko_cv_gecko}-gtkmozembed"
 fi
@@ -350,6 +396,7 @@
 AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008000"])
 AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008001"])
 AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1009000"])
+AM_CONDITIONAL([HAVE_GECKO_HOME],[test "x$_GECKO_HOME" != "x"])
 ])
 
 # ***************************************************************************
@@ -371,10 +418,20 @@
 _SAVE_CXXFLAGS="$CXXFLAGS"
 _SAVE_LDFLAGS="$LDFLAGS"
 _SAVE_LIBS="$LIBS"
-CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)"
-CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
-LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME"
-LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)"
+if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then
+	CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-unstable)"
+	CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-unstable)"
+	LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}) -ldl"
+else
+	CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)"
+	CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
+	LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)"
+fi
+if test -n "$_GECKO_HOME"; then
+	LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME"
+else
+	LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS"
+fi
 
 _GECKO_DISPATCH_INCLUDEDIRS="$2"
 
@@ -383,9 +440,11 @@
 # Mind you, it's useful to be able to test against uninstalled mozilla builds...
 _GECKO_DISPATCH_INCLUDEDIRS="$_GECKO_DISPATCH_INCLUDEDIRS dom necko pref"
 
-# Now add them to CPPFLAGS
+# Now add them to CPPFLAGS - asac: well ... not anymore since 1.9 -> test whether they exist before adding.
 for i in $_GECKO_DISPATCH_INCLUDEDIRS; do
-	CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
+	if test -d "$_GECKO_INCLUDE_ROOT/$i"; then
+		CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
+	fi
 done
 
 m4_indir([$1],m4_shiftn(2,$@))
@@ -438,11 +497,17 @@
 #include <mozilla-config.h>
 #include <stdlib.h>
 #include <stdio.h>
+
+#ifdef XPCOM_GLUE
+#include <nsXPCOMGlue.h>
+#else
 #include <nsXPCOM.h>
+#endif // XPCOM_GLUE
+
 #include <nsCOMPtr.h>
 #include <nsILocalFile.h>
 #include <nsIServiceManager.h>
-#ifdef HAVE_GECKO_1_8
+#if defined(HAVE_GECKO_1_8) || defined(HAVE_GECKO_1_9)
 #include <nsStringAPI.h>
 #else
 #include <nsString.h>
@@ -450,16 +515,37 @@
 ]]
 [$1],
 [[
+
+nsresult rv;
+#ifdef XPCOM_GLUE
+    static const GREVersionRange greVersion = {
+    "1.8", PR_TRUE,
+    "1.9.*", PR_TRUE
+    };
+    char xpcomLocation[4096];
+    rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
+    if (NS_FAILED(rv)) {
+        exit(123);
+    }
+
+    // Startup the XPCOM Glue that links us up with XPCOM.
+    XPCOMGlueStartup(xpcomLocation);
+    if (NS_FAILED(rv)) {
+        exit(124);
+    }
+#endif // XPCOM_GLUE
+
 // redirect unwanted mozilla debug output to the bit bucket
 freopen ("/dev/null", "w", stdout);
 
-nsresult rv;
-nsCOMPtr<nsILocalFile> directory;
+nsCOMPtr<nsILocalFile> directory = nsnull;
+#ifndef XPCOM_GLUE
 rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_GECKO_HOME"), PR_FALSE,
 			    getter_AddRefs (directory));
 if (NS_FAILED (rv) || !directory) {
 	exit (126);
 }
+#endif
 
 rv = NS_InitXPCOM2 (nsnull, directory, nsnull);
 if (NS_FAILED (rv)) {
@@ -607,21 +693,22 @@
 AC_DEFUN([GECKO_XPIDL],
 [AC_REQUIRE([GECKO_INIT])dnl
 
-_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then
+	_GECKO_LIBDIR="`$PKG_CONFIG pkg-config --variable=sdkdir ${gecko_cv_gecko}`/bin"
+else
+	_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+fi
 
 AC_PATH_PROG([XPIDL],[xpidl],[no],[$_GECKO_LIBDIR:$PATH])
 
+if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then
+XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}`"
+else
 XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}-xpcom`"
-
-# Older geckos don't have this variable, see
-# https://bugzilla.mozilla.org/show_bug.cgi?id=240473
-
 if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
 	XPIDL_IDLDIR="`echo $_GECKO_LIBDIR | sed -e s!lib!share/idl!`"
 fi
-
 # Some distributions (Gentoo) have it in unusual places
-
 if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
 	XPIDL_IDLDIR="$_GECKO_INCLUDE_ROOT/idl"
 fi

Modified: branches/gnome-2-22/plugins/desktop-file/Makefile.am
==============================================================================
--- branches/gnome-2-22/plugins/desktop-file/Makefile.am	(original)
+++ branches/gnome-2-22/plugins/desktop-file/Makefile.am	Fri Mar 28 15:06:31 2008
@@ -25,8 +25,13 @@
 libdesktopfileplugin_la_LDFLAGS = \
 	-module -avoid-version \
 	-export-symbols $(srcdir)/plugin.symbols \
-	-R$(GECKO_HOME) \
 	$(AM_LDFLAGS)
 
+if !HAVE_GECKO_XPCOM_GLUE
+	libdesktopfileplugin_la_LDFLAGS += \
+		-R$(GECKO_HOME) \
+		$(NULL)
+endif
+
 EXTRA_DIST = \
 	plugin.symbols

Modified: branches/gnome-2-22/src/Makefile.am
==============================================================================
--- branches/gnome-2-22/src/Makefile.am	(original)
+++ branches/gnome-2-22/src/Makefile.am	Fri Mar 28 15:06:31 2008
@@ -180,6 +180,16 @@
 	$(PYGTK_LIBS)
 endif
 
+
+# we do this to force c++ linkage if we are using the glue and 
+# are running gecko 1.9 because standalone glue embedders that use
+# gtk_moz_embed_* need to #include <gtkmozembed_glue.cpp>
+if HAVE_GECKO_1_9
+if HAVE_GECKO_XPCOM_GLUE
+nodist_EXTRA_epiphany_SOURCES = dummy.cpp
+endif
+endif
+
 epiphany_SOURCES = ephy-main.c
 
 epiphany_CPPFLAGS = \
@@ -194,6 +204,7 @@
 
 epiphany_CFLAGS = \
 	$(DEPENDENCIES_CFLAGS) 	\
+	$(GECKO_CFLAGS) \
 	$(DBUS_CFLAGS)		\
 	$(AM_CFLAGS)
 
@@ -214,6 +225,7 @@
 
 if WITH_GECKO_ENGINE
 epiphany_LDADD += \
+	$(GECKO_LIBS) \
 	$(top_builddir)/embed/mozilla/libephymozillaembed.la
 endif
 
@@ -234,7 +246,9 @@
 endif
 
 if WITH_GECKO_ENGINE
+if !HAVE_GECKO_XPCOM_GLUE
 epiphany_LDFLAGS += -R$(GECKO_HOME)
+endif
 
 epiphany_LDADD += \
 	$(GECKO_LIBS) \
@@ -248,6 +262,7 @@
 endif
 
 epiphany_LDADD += \
+	$(GECKO_LIBS) \
 	$(DEPENDENCIES_LIBS) \
 	$(DBUS_LIBS) \
 	$(LIBINTL)



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