Bug 721265 - Firefox migrator: form history support r=mak

--HG--
extra : rebase_source : 3f7ae6f3934b4edc9aabd6228c23acf487e8b293
This commit is contained in:
Matthew Noorenberghe 2012-01-28 13:16:18 -08:00
Родитель 3d8da72979
Коммит fc81bea402
2 изменённых файлов: 40 добавлений и 3 удалений

Просмотреть файл

@ -32,11 +32,12 @@ function FirefoxProfileMigrator()
FirefoxProfileMigrator.prototype = {
_paths: {
bookmarks : null,
cookies : null,
bookmarks: null,
cookies: null,
currentProfile: null, // The currently running (destination) profile.
encryptionKey: null,
history : null,
formData: null,
history: null,
passwords: null,
},
@ -185,6 +186,26 @@ FirefoxProfileMigrator.prototype = {
}
},
/**
* Migrating form history (satchel)
*/
_migrateFormData : function Firefox_migrateFormData()
{
this._notifyStart(MIGRATOR.FORMDATA);
try {
// Access sqlite3 database of form history.
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(this._paths.formData);
file.copyTo(this._paths.currentProfile, null);
} catch (e) {
Cu.reportError(e);
this._notifyError(MIGRATOR.FORMDATA);
} finally {
this._notifyCompleted(MIGRATOR.FORMDATA);
}
},
/**
* nsIBrowserProfileMigrator interface implementation
@ -225,6 +246,9 @@ FirefoxProfileMigrator.prototype = {
if (aItems & MIGRATOR.PASSWORDS)
this._migratePasswords();
if (aItems & MIGRATOR.FORMDATA)
this._migrateFormData();
if (--this._pendingCount == 0) {
// When async imports are immediately completed unfortunately,
// this will be called.
@ -310,6 +334,18 @@ FirefoxProfileMigrator.prototype = {
Cu.reportError(e);
}
// Form data
try {
let file = this._sourceProfile.clone();
file.append("formhistory.sqlite");
if (file.exists()) {
this._paths.formData = file.path;
result += MIGRATOR.FORMDATA;
}
} catch (e) {
Cu.reportError(e);
}
return result;
},

Просмотреть файл

@ -31,6 +31,7 @@ importedSafariBookmarks=From Safari
8_ie=Saved Form History
8_safari=Saved Form History
8_chrome=Saved Form History
8_firefox=Saved Form History
16_ie=Saved Passwords
16_safari=Saved Passwords