Bug 738263 - Part 1: actually break default bookmarks import by will, to avoid worse handling.
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 04 Apr 2012 15:35:27 +0200
changeset 94315 346f2964dc92a9110e8b1dd7d3a3c4157e11b7df
parent 94314 da10fe58893ddfb30c69a62668eff2c80b84dfb8
child 94316 13b84bf759ebfbaea5428dd4eb1ee82ab98f41b4
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs738263
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 738263 - Part 1: actually break default bookmarks import by will, to avoid worse handling. r=Mano
browser/components/migration/src/MigrationUtils.jsm
--- a/browser/components/migration/src/MigrationUtils.jsm
+++ b/browser/components/migration/src/MigrationUtils.jsm
@@ -134,19 +134,25 @@ let MigratorPrototype = {
   /**
    * DO NOT OVERRIDE - After deCOMing migration, the UI will just call
    * migrate for each resource.
    *
    * @see nsIBrowserProfileMigrator
    */
   migrate: function MP_migrate(aItems, aStartup, aProfile) {
     // Not using aStartup because it's going away soon.
-    if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator)
+    if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator) {
       MigrationUtils.profileStartup.doStartup();
 
+      // Notify glue we are about to do initial migration, otherwise it may try
+      // to restore default bookmarks overwriting the imported ones.
+      Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver)
+        .observe(null, "initial-migration", null);
+    }
+
     let resources = this._getMaybeCachedResources(aProfile);
     if (resources.length == 0)
       throw new Error("migrate called for a non-existent source");
 
     if (aItems != Ci.nsIBrowserProfileMigrator.ALL)
       resources = [r for each (r in resources) if (aItems & r.type)];
 
     // TODO: use Map (for the items) and Set (for the resources)