[epiphany] ephy-profile-migration: separate migration code into another binary



commit 4a8a0f51849d8414cadfdeb5527820c4a689343a
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Mon Dec 6 20:49:27 2010 +0100

    ephy-profile-migration: separate migration code into another binary
    
    The migration code is now in the ephy-profile-migrator binary, this means:
     - epiphany is not linking to NSS anymore
     - lib/ephy-profile-migration.c was split into:
      + lib/ephy-profile-migrator.c: the new ephy-profile-migrator binary
      + lib/ephy-profile-utils.c: convenience _ephy_profile_*_form_auth_data functions.
     - testing for migration is done without running ephy-profile-migrator
    
    Bug #636685

 doc/reference/Makefile.am                          |    5 -
 embed/ephy-embed-single.c                          |    2 +-
 embed/ephy-web-view.c                              |   36 ++--
 lib/Makefile.am                                    |   42 ++++-
 lib/ephy-profile-migration.h                       |   45 -----
 ...profile-migration.c => ephy-profile-migrator.c} |  188 ++++----------------
 lib/ephy-profile-utils.c                           |  186 +++++++++++++++++++
 lib/ephy-profile-utils.h                           |   49 +++++
 src/Makefile.am                                    |    4 -
 src/ephy-main.c                                    |   21 ++-
 tests/Makefile.am                                  |    7 -
 11 files changed, 340 insertions(+), 245 deletions(-)
---
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index 20bcba6..9b5de96 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -132,11 +132,6 @@ GTKDOC_LIBS = \
 	$(DBUS_LIBS) \
 	$(LIBINTL)
 
-if ENABLE_NSS
-GTKDOC_LIBS += \
-	$(NSS_LIBS)
-endif
-
 if ENABLE_SEED
 GTKDOC_LIBS += \
 	$(SEED_LIBS)
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 9e6b4b3..9ca1d32 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -32,7 +32,7 @@
 #include "ephy-marshal.h"
 #include "ephy-signal-accumulator.h"
 #include "ephy-permission-manager.h"
-#include "ephy-profile-migration.h"
+#include "ephy-profile-utils.h"
 #include "ephy-prefs.h"
 #include "ephy-settings.h"
 
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 9b0d2f7..37fc1f9 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -41,7 +41,7 @@
 #include "ephy-prefs.h"
 #include "ephy-marshal.h"
 #include "ephy-permission-manager.h"
-#include "ephy-profile-migration.h"
+#include "ephy-profile-utils.h"
 #include "ephy-favicon-cache.h"
 #include "ephy-history.h"
 #include "ephy-settings.h"
@@ -706,11 +706,11 @@ store_password (GtkInfoBar *info_bar, gint response_id, gpointer data)
   }
 
   LOG ("Response is GTK_RESPONSE_YES - saving!");
-  _ephy_profile_store_form_auth_data (uri,
-                                      name_field_name,
-                                      password_field_name,
-                                      name_field_value,
-                                      password_field_value);
+  _ephy_profile_utils_store_form_auth_data (uri,
+                                            name_field_name,
+                                            password_field_name,
+                                            name_field_value,
+                                            password_field_value);
 
   /* Update internal caching */
   soup_uri = soup_uri_new (uri);
@@ -865,12 +865,12 @@ form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
        store_data->name_value,
        store_data->password_value);
 
-  _ephy_profile_query_form_auth_data (store_data->uri,
-                                      store_data->name_field,
-                                      store_data->password_field,
-                                      should_store_cb,
-                                      store_data,
-                                      NULL);
+  _ephy_profile_utils_query_form_auth_data (store_data->uri,
+                                            store_data->name_field,
+                                            store_data->password_field,
+                                            should_store_cb,
+                                            store_data,
+                                            NULL);
 
   soup_uri_free (uri);
 
@@ -911,12 +911,12 @@ pre_fill_form (WebKitDOMNode *username_node,
       fill_data->username_node = g_object_ref (username_node);
       fill_data->password_node = g_object_ref (password_node);
 
-      _ephy_profile_query_form_auth_data (uri_str,
-                                          data->form_username,
-                                          data->form_password,
-                                          fill_form_cb,
-                                          fill_data,
-                                          fill_data_free);
+      _ephy_profile_utils_query_form_auth_data (uri_str,
+                                                data->form_username,
+                                                data->form_password,
+                                                fill_form_cb,
+                                                fill_data,
+                                                fill_data_free);
       g_free (uri_str);
     }
     g_free (username_field_name);
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b98c1b3..f56e591 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -19,7 +19,7 @@ NOINST_H_FILES = \
 	ephy-node-common.h			\
 	ephy-object-helpers.h			\
 	ephy-prefs.h				\
-	ephy-profile-migration.h	        \
+	ephy-profile-utils.h				\
 	ephy-print-utils.h			\
 	ephy-shlib-loader.h			\
 	ephy-signal-accumulator.h		\
@@ -57,7 +57,8 @@ libephymisc_la_SOURCES = \
 	ephy-node-db.c				\
 	ephy-object-helpers.c			\
 	ephy-prefs.h				\
-	ephy-profile-migration.c	        \
+	ephy-profile-utils.c			\
+	ephy-profile-utils.h			\
 	ephy-print-utils.c			\
 	ephy-settings.c				\
 	ephy-shlib-loader.c			\
@@ -100,18 +101,39 @@ libephymisc_la_LIBADD += \
 	$(SPELLCHECKER_LIBS)
 endif
 
-if ENABLE_NSS
-NOINST_H_FILES += \
-	ephy-nss-glue.h \
-	$(NULL)
 
-libephymisc_la_SOURCES += \
-	ephy-nss-glue.c
-	$(NULL)
+bin_PROGRAMS = ephy-profile-migrator
+ephy_profile_migrator_SOURCES = \
+	ephy-profile-migrator.c \
+	ephy-profile-utils.c \
+	ephy-profile-utils.h \
+	ephy-debug.c \
+	ephy-debug.h \
+	ephy-file-helpers.c \
+	ephy-file-helpers.h \
+	ephy-settings.c	\
+	ephy-string.c
+
+ephy_profile_migrator_CFLAGS = \
+	$(DEPENDENCIES_CFLAGS) \
+	$(NSS_CFLAGS) \
+	$(AM_CFLAGS)
+
+ephy_profile_migrator_LDADD = \
+	$(DEPENDENCIES_LIBS)
 
-libephymisc_la_CFLAGS += $(NSS_CFLAGS)
+if ENABLE_NSS
+ephy_profile_migrator_SOURCES += \
+	ephy-nss-glue.c \
+	ephy-nss-glue.h
+ephy_profile_migrator_LDADD += $(NSS_LIBS)
 endif # ENABLE_NSS
 
+ephy_profile_migrator_CPPFLAGS = \
+	-I$(top_builddir)/lib \
+	-DSHARE_DIR=\"$(pkgdatadir)\" \
+	$(AM_CPPFLAGS)
+
 BUILT_SOURCES = \
 	ephy-lib-type-builtins.c	\
 	ephy-lib-type-builtins.h	\
diff --git a/lib/ephy-profile-migration.c b/lib/ephy-profile-migrator.c
similarity index 70%
rename from lib/ephy-profile-migration.c
rename to lib/ephy-profile-migrator.c
index 73584ef..b64a733 100644
--- a/lib/ephy-profile-migration.c
+++ b/lib/ephy-profile-migrator.c
@@ -32,10 +32,9 @@
 
 #include "config.h"
 
-#include "ephy-profile-migration.h"
-
 #include "ephy-debug.h"
 #include "ephy-file-helpers.h"
+#include "ephy-profile-utils.h"
 #ifdef ENABLE_NSS
 #include "ephy-nss-glue.h"
 #endif
@@ -46,12 +45,10 @@
 
 /*
  * What to do to add new migration steps:
- *  - Bump PROFILE_MIGRATION_VERSION
+ *  - Bump EPHY_PROFILE_MIGRATION_VERSION in lib/ephy-profile-utils.h
  *  - Add your function at the end of the 'migrators' array
  */
 
-#define PROFILE_MIGRATION_VERSION 4
-
 typedef void (*EphyProfileMigrator) (void);
 
 static void
@@ -103,7 +100,7 @@ migrate_cookies ()
     g_object_unref (txt);
     g_object_unref (sqlite);
   }
-  
+
  out:
   g_free (src_sqlite);
   g_free (src_txt);
@@ -198,7 +195,7 @@ parse_and_decrypt_signons (const char *signons,
     /* A block has at least five lines */
     if (end - begin < 5)
       continue;
-    
+
     /* The first line is the site URL.
      * For HTTP authentication logins, the URL may contain http realm,
      * which will be in bracket:
@@ -299,11 +296,11 @@ parse_and_decrypt_signons (const char *signons,
           !g_str_equal (form_password, "*")) {
         char *u = soup_uri_to_string (uri, FALSE);
         /* We skip the '*' at the beginning of form_password. */
-        _ephy_profile_store_form_auth_data (u,
-                                            form_username,
-                                            form_password+1,
-                                            username,
-                                            password);
+        _ephy_profile_utils_store_form_auth_data (u,
+                                                 form_username,
+                                                 form_password+1,
+                                                 username,
+                                                 password);
         g_free (u);
       } else if (!handle_forms && realm &&
                  username && password &&
@@ -316,7 +313,7 @@ parse_and_decrypt_signons (const char *signons,
                                                  NULL,
                                                  uri->scheme,
                                                  NULL,
-                                                 uri->port, 
+                                                 uri->port,
                                                  password,
                                                  &item_id);
       }
@@ -426,146 +423,20 @@ const EphyProfileMigrator migrators[] = {
 };
 
 static void
-store_form_password_cb (GnomeKeyringResult result,
-                        guint32 id,
-                        gpointer data)
-{
-  /* FIXME: should we do anything if the operation failed? */
-}
-
-static void
-normalize_and_prepare_uri (SoupURI *uri,
-                           const char *form_username,
-                           const char *form_password)
+ephy_migrator ()
 {
-  g_return_if_fail (uri != NULL);
-
-  /* We normalize https? schemes here so that we use passwords
-   * we stored in https sites in their http counterparts, and
-   * vice-versa. */
-  if (g_str_equal (uri->scheme, SOUP_URI_SCHEME_HTTPS))
-    soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP);
-
-  soup_uri_set_path (uri, NULL);
-
-  /* Store the form login and password names encoded in the
-   * URL. A bit of an abuse of keyring, but oh well */
-  soup_uri_set_query_from_fields (uri,
-                                  FORM_USERNAME_KEY,
-                                  form_username,
-                                  FORM_PASSWORD_KEY,
-                                  form_password,
-                                  NULL);
-}
-
-void
-_ephy_profile_store_form_auth_data (const char *uri,
-                                    const char *form_username,
-                                    const char *form_password,
-                                    const char *username,
-                                    const char *password)
-{
-  SoupURI *fake_uri;
-  char *fake_uri_str;
-
-  g_return_if_fail (uri);
-  g_return_if_fail (form_username);
-  g_return_if_fail (form_password);
-  g_return_if_fail (username);
-  g_return_if_fail (password);
-
-  fake_uri = soup_uri_new (uri);
-  if (fake_uri == NULL)
-    return;
-
-  normalize_and_prepare_uri (fake_uri, form_username, form_password);
-  fake_uri_str = soup_uri_to_string (fake_uri, FALSE);
-
-  gnome_keyring_set_network_password (NULL,
-                                      username,
-                                      NULL,
-                                      fake_uri_str,
-                                      NULL,
-                                      fake_uri->scheme,
-                                      NULL,
-                                      fake_uri->port,
-                                      password,
-                                      (GnomeKeyringOperationGetIntCallback)store_form_password_cb,
-                                      NULL,
-                                      NULL);
-  soup_uri_free (fake_uri);
-  g_free (fake_uri_str);
-}
+  int latest, i;
 
-void
-_ephy_profile_query_form_auth_data (const char *uri,
-                                    const char *form_username,
-                                    const char *form_password,
-                                    GnomeKeyringOperationGetListCallback callback,
-                                    gpointer data,
-                                    GDestroyNotify destroy_data)
-{
-  SoupURI *key;
-  char *key_str;
-
-  g_return_if_fail (uri);
-  g_return_if_fail (form_username);
-  g_return_if_fail (form_password);
-
-  key = soup_uri_new (uri);
-  g_return_if_fail (key);
-
-  normalize_and_prepare_uri (key, form_username, form_password);
-
-  key_str = soup_uri_to_string (key, FALSE);
-
-  LOG ("Querying Keyring: %s", key_str);
-  gnome_keyring_find_network_password (NULL,
-                                       NULL,
-                                       key_str,
-                                       NULL,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       callback,
-                                       data,
-                                       destroy_data);
-  soup_uri_free (key);
-  g_free (key_str);
-}
+  latest = ephy_profile_utils_get_migration_version ();
 
-#define PROFILE_MIGRATION_FILE ".migrated"
+  LOG ("Running migrators up to version %d, current migration version is %d.",
+       EPHY_PROFILE_MIGRATION_VERSION, latest);
 
-void
-_ephy_profile_migrate ()
-{
-  int latest, i;
-  char *migrated_file, *contents;
-
-  /* Figure out the latest migration that occured */
-  migrated_file = g_build_filename (ephy_dot_dir (),
-                                    PROFILE_MIGRATION_FILE,
-                                    NULL);
-  if (g_file_test (migrated_file, G_FILE_TEST_EXISTS)) {
-    gsize size;
-    int result;
-
-    g_file_get_contents (migrated_file, &contents, &size, NULL);
-    result = sscanf(contents, "%d", &latest);
-    g_free (contents);
-
-    if (result != 1) {
-      g_warning (_("Failed to read latest migration marker, aborting profile migration."));
-      g_free (migrated_file);
-      return;
-    }
-  } else
-    /* Never migrated */
-    latest = 0;
-  
-  for (i = latest; i < PROFILE_MIGRATION_VERSION; i++) {
+  for (i = latest; i < EPHY_PROFILE_MIGRATION_VERSION; i++) {
     EphyProfileMigrator m;
 
+    LOG ("Running migrator: %d of %d", i, EPHY_PROFILE_MIGRATION_VERSION);
+
     /* No need to run the password migration twice in a row. It
        appears twice in the list for the benefit of people that were
        using the development snapshots, since an early version didn't
@@ -577,10 +448,23 @@ _ephy_profile_migrate ()
     m();
   }
 
-  /* Write down the latest migration */
-  contents = g_strdup_printf ("%d", PROFILE_MIGRATION_VERSION);
-  g_file_set_contents (migrated_file, contents, -1, NULL);
-  g_free (contents);
-  g_free (migrated_file);
+  if (ephy_profile_utils_set_migration_version (EPHY_PROFILE_MIGRATION_VERSION) != TRUE)
+    LOG ("Failed to store the current migration version");
 }
 
+int
+main (int argc, char *argv[])
+{
+  g_thread_init (NULL);
+
+  ephy_debug_init ();
+
+  if (!ephy_file_helpers_init (NULL, FALSE, FALSE, NULL)) {
+    LOG ("Something wrong happened with ephy_file_helpers_init()");
+    return -1;
+  }
+
+  ephy_migrator ();
+
+  return 0;
+}
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
new file mode 100644
index 0000000..3f8e092
--- /dev/null
+++ b/lib/ephy-profile-utils.c
@@ -0,0 +1,186 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
+/*
+ *  Copyright © 2009 Xan López
+ *
+ *  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
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "ephy-debug.h"
+#include "ephy-file-helpers.h"
+#include "ephy-profile-utils.h"
+#include <libsoup/soup.h>
+
+#define PROFILE_MIGRATION_FILE ".migrated"
+
+int
+ephy_profile_utils_get_migration_version ()
+{
+  char *migrated_file, *contents;
+  gsize size;
+  int result;
+  int latest = 0;
+
+  migrated_file = g_build_filename (ephy_dot_dir (),
+                                    PROFILE_MIGRATION_FILE,
+                                    NULL);
+
+  if (g_file_test (migrated_file, G_FILE_TEST_EXISTS)) {
+    g_file_get_contents (migrated_file, &contents, &size, NULL);
+    result = sscanf(contents, "%d", &latest);
+
+    g_free (contents);
+    g_free (migrated_file);
+
+    if (result != 1)
+      latest = 0;
+  }
+
+  return latest;
+}
+
+gboolean
+ephy_profile_utils_set_migration_version (int version)
+{
+  char *migrated_file, *contents;
+  gboolean result = FALSE;
+
+  migrated_file = g_build_filename (ephy_dot_dir (),
+                                    PROFILE_MIGRATION_FILE,
+                                    NULL);
+  contents = g_strdup_printf ("%d", version);
+  result = g_file_set_contents (migrated_file, contents, -1, NULL);
+
+  if (result == FALSE)
+    LOG ("Couldn't store migration version %d in %s (%s, %s)",
+         version, migrated_file, ephy_dot_dir (), PROFILE_MIGRATION_FILE);
+
+  g_free (contents);
+  g_free (migrated_file);
+
+  return result;
+}
+
+static void
+store_form_password_cb (GnomeKeyringResult result,
+                        guint32 id,
+                        gpointer data)
+{
+  /* FIXME: should we do anything if the operation failed? */
+}
+
+static void
+normalize_and_prepare_uri (SoupURI *uri,
+                           const char *form_username,
+                           const char *form_password)
+{
+  g_return_if_fail (uri != NULL);
+
+  /* We normalize https? schemes here so that we use passwords
+   * we stored in https sites in their http counterparts, and
+   * vice-versa. */
+  if (g_str_equal (uri->scheme, SOUP_URI_SCHEME_HTTPS))
+    soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP);
+
+  soup_uri_set_path (uri, NULL);
+
+  /* Store the form login and password names encoded in the
+   * URL. A bit of an abuse of keyring, but oh well */
+  soup_uri_set_query_from_fields (uri,
+                                  FORM_USERNAME_KEY,
+                                  form_username,
+                                  FORM_PASSWORD_KEY,
+                                  form_password,
+                                  NULL);
+}
+
+void
+_ephy_profile_utils_store_form_auth_data (const char *uri,
+                                          const char *form_username,
+                                          const char *form_password,
+                                          const char *username,
+                                          const char *password)
+{
+  SoupURI *fake_uri;
+  char *fake_uri_str;
+
+  g_return_if_fail (uri);
+  g_return_if_fail (form_username);
+  g_return_if_fail (form_password);
+  g_return_if_fail (username);
+  g_return_if_fail (password);
+
+  fake_uri = soup_uri_new (uri);
+  if (fake_uri == NULL)
+    return;
+
+  normalize_and_prepare_uri (fake_uri, form_username, form_password);
+  fake_uri_str = soup_uri_to_string (fake_uri, FALSE);
+
+  gnome_keyring_set_network_password (NULL,
+                                      username,
+                                      NULL,
+                                      fake_uri_str,
+                                      NULL,
+                                      fake_uri->scheme,
+                                      NULL,
+                                      fake_uri->port,
+                                      password,
+                                      (GnomeKeyringOperationGetIntCallback)store_form_password_cb,
+                                      NULL,
+                                      NULL);
+  soup_uri_free (fake_uri);
+  g_free (fake_uri_str);
+}
+
+void
+_ephy_profile_utils_query_form_auth_data (const char *uri,
+                                          const char *form_username,
+                                          const char *form_password,
+                                          GnomeKeyringOperationGetListCallback callback,
+                                          gpointer data,
+                                          GDestroyNotify destroy_data)
+{
+  SoupURI *key;
+  char *key_str;
+
+  g_return_if_fail (uri);
+  g_return_if_fail (form_username);
+  g_return_if_fail (form_password);
+
+  key = soup_uri_new (uri);
+  g_return_if_fail (key);
+
+  normalize_and_prepare_uri (key, form_username, form_password);
+
+  key_str = soup_uri_to_string (key, FALSE);
+
+  LOG ("Querying Keyring: %s", key_str);
+  gnome_keyring_find_network_password (NULL,
+                                       NULL,
+                                       key_str,
+                                       NULL,
+                                       NULL,
+                                       NULL,
+                                       0,
+                                       callback,
+                                       data,
+                                       destroy_data);
+  soup_uri_free (key);
+  g_free (key_str);
+}
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
new file mode 100644
index 0000000..7ea6797
--- /dev/null
+++ b/lib/ephy-profile-utils.h
@@ -0,0 +1,49 @@
+/*
+ *  Copyright © 2009 Xan López
+ *
+ *  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
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EPHY_PROFILE_UTILS_H
+#define EPHY_PROFILE_UTILS_H
+
+#include <glib.h>
+#include <gnome-keyring.h>
+
+#define FORM_USERNAME_KEY "form_username"
+#define FORM_PASSWORD_KEY "form_password"
+
+#define EPHY_PROFILE_MIGRATION_VERSION 4
+
+int ephy_profile_utils_get_migration_version (void);
+
+gboolean ephy_profile_utils_set_migration_version (int version);
+
+void _ephy_profile_utils_store_form_auth_data (const char *uri,
+                                               const char *form_username,
+                                               const char *form_password,
+                                               const char *username,
+                                               const char *password);
+
+void
+_ephy_profile_utils_query_form_auth_data (const char *uri,
+                                          const char *form_username,
+                                          const char *form_password,
+                                          GnomeKeyringOperationGetListCallback callback,
+                                          gpointer data,
+                                          GDestroyNotify destroy_data);
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 479f5be..3068cf5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -179,10 +179,6 @@ if ENABLE_SEED
 epiphany_LDADD += $(SEED_LIBS)
 endif # ENABLE_SEED
 
-if ENABLE_NSS
-epiphany_LDADD += $(NSS_LIBS)
-endif # ENABLE_NSS
-
 if ENABLE_NETWORK_MANAGER
 epiphany_LDADD += \
 	$(NETWORK_MANAGER_LIBS)
diff --git a/src/ephy-main.c b/src/ephy-main.c
index e172f9f..f59ab23 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -32,7 +32,7 @@
 #include "ephy-session.h"
 #include "ephy-shell.h"
 #include "ephy-prefs.h"
-#include "ephy-profile-migration.h"
+#include "ephy-profile-utils.h"
 #include "ephy-debug.h"
 #include "eggsmclient.h"
 
@@ -714,8 +714,23 @@ main (int argc,
 	}
 
 	/* Migrate profile if we are not running a private instance */
-        if (ephy_has_private_profile () == FALSE)
-          _ephy_profile_migrate ();
+	if (ephy_has_private_profile () == FALSE &&
+	    ephy_profile_utils_get_migration_version () < EPHY_PROFILE_MIGRATION_VERSION)
+	{
+		GError *error = NULL;
+		char *argv[1] = { "ephy-profile-migrator" };
+		char *envp[1] = { "EPHY_LOG_MODULES=ephy-profile" };
+
+		g_spawn_sync (NULL, argv, envp, G_SPAWN_SEARCH_PATH,
+			      NULL, NULL, NULL, NULL,
+			      NULL, &error);
+
+		if (error)
+		{
+			LOG ("Failed to run migrator: %s", error->message);
+			g_error_free (error);
+		}
+	}
 
 	ephy_stock_icons_init ();
 	load_accels ();
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b973214..c4dd138 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,13 +26,6 @@ LDADD = \
 	$(DBUS_LIBS) \
 	$(DEPENDENCIES_LIBS) 
 
-if ENABLE_NSS
-CFLAGS += \
-	$(NSS_CFLAGS)
-LDADD += \
-	$(NSS_LIBS)
-endif
-
 if ENABLE_SEED
 CFLAGS += \
 	$(SEED_CFLAGS)



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