Bug 1096787 - Copy new logins.json database when using fx reset. r=MattN, a=lsblakk
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 12 Nov 2014 00:35:02 +0000
changeset 226048 b718e8c0d423
parent 226047 aa474c125c53
child 226049 4bb1c6116c39
push id4123
push userryanvm@gmail.com
push date2014-11-13 15:04 +0000
treeherdermozilla-beta@4bb1c6116c39 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, lsblakk
bugs1096787
milestone34.0
Bug 1096787 - Copy new logins.json database when using fx reset. r=MattN, a=lsblakk
browser/components/migration/FirefoxProfileMigrator.js
--- a/browser/components/migration/FirefoxProfileMigrator.js
+++ b/browser/components/migration/FirefoxProfileMigrator.js
@@ -57,36 +57,38 @@ FirefoxProfileMigrator.prototype.getReso
   // Surely data cannot be imported from the current profile.
   if (sourceProfileDir.equals(currentProfileDir))
     return null;
 
   let getFileResource = function(aMigrationType, aFileNames) {
     let files = [];
     for (let fileName of aFileNames) {
       let file = this._getFileObject(sourceProfileDir, fileName);
-      if (!file)
-        return null;
-      files.push(file);
+      if (file)
+        files.push(file);
+    }
+    if (!files.length) {
+      return null;
     }
     return {
       type: aMigrationType,
       migrate: function(aCallback) {
         for (let file of files) {
           file.copyTo(currentProfileDir, "");
         }
         aCallback(true);
       }
     };
   }.bind(this);
 
   let types = MigrationUtils.resourceTypes;
   let places = getFileResource(types.HISTORY, ["places.sqlite"]);
   let cookies = getFileResource(types.COOKIES, ["cookies.sqlite"]);
   let passwords = getFileResource(types.PASSWORDS,
-                                  ["signons.sqlite", "key3.db"]);
+                                  ["signons.sqlite", "logins.json", "key3.db"]);
   let formData = getFileResource(types.FORMDATA, ["formhistory.sqlite"]);
   let bookmarksBackups = getFileResource(types.OTHERDATA,
     [PlacesBackups.profileRelativeFolderPath]);
   let dictionary = getFileResource(types.OTHERDATA, ["persdict.dat"]);
 
   let sessionCheckpoints = this._getFileObject(sourceProfileDir, "sessionCheckpoints.json");
   let sessionFile = this._getFileObject(sourceProfileDir, "sessionstore.js");
   let session;