зеркало из https://github.com/mozilla/gecko-dev.git
Bug 575591 - Don't bail out of migration on individual migration failures, report to the console instead. r=gavin, a=betaN
This commit is contained in:
Родитель
6bebcd41c3
Коммит
42487f4fb4
|
@ -37,6 +37,8 @@
|
|||
const kIMig = Components.interfaces.nsIBrowserProfileMigrator;
|
||||
const kIPStartup = Components.interfaces.nsIProfileStartup;
|
||||
const kProfileMigratorContractIDPrefix = "@mozilla.org/profile/migrator;1?app=browser&type=";
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var MigrationWizard = {
|
||||
_source: "", // Source Profile Migrator ContractID suffix
|
||||
|
@ -54,6 +56,7 @@ var MigrationWizard = {
|
|||
os.addObserver(this, "Migration:Started", false);
|
||||
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
|
||||
os.addObserver(this, "Migration:ItemAfterMigrate", false);
|
||||
os.addObserver(this, "Migration:ItemError", false);
|
||||
os.addObserver(this, "Migration:Ended", false);
|
||||
|
||||
this._wiz = document.documentElement;
|
||||
|
@ -81,6 +84,7 @@ var MigrationWizard = {
|
|||
os.removeObserver(this, "Migration:Started");
|
||||
os.removeObserver(this, "Migration:ItemBeforeMigrate");
|
||||
os.removeObserver(this, "Migration:ItemAfterMigrate");
|
||||
os.removeObserver(this, "Migration:ItemError");
|
||||
os.removeObserver(this, "Migration:Ended");
|
||||
},
|
||||
|
||||
|
@ -489,6 +493,35 @@ var MigrationWizard = {
|
|||
nextButton.click();
|
||||
}
|
||||
break;
|
||||
case "Migration:ItemError":
|
||||
var type = "undefined";
|
||||
switch (parseInt(aData)) {
|
||||
case Ci.nsIBrowserProfileMigrator.SETTINGS:
|
||||
type = "settings";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.COOKIES:
|
||||
type = "cookies";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.HISTORY:
|
||||
type = "history";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.FORMDATA:
|
||||
type = "form data";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.PASSWORDS:
|
||||
type = "passwords";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.BOOKMARKS:
|
||||
type = "bookmarks";
|
||||
break;
|
||||
case Ci.nsIBrowserProfileMigrator.OTHERDATA:
|
||||
type = "misc. data";
|
||||
break;
|
||||
}
|
||||
Cc["@mozilla.org/consoleservice;1"]
|
||||
.getService(Ci.nsIConsoleService)
|
||||
.logStringMessage("some " + type + " did not successfully migrate.");
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define browserprofilemigratorutils___h___
|
||||
|
||||
#define MIGRATION_ITEMBEFOREMIGRATE "Migration:ItemBeforeMigrate"
|
||||
#define MIGRATION_ITEMMIGRATEERROR "Migration:ItemError"
|
||||
#define MIGRATION_ITEMAFTERMIGRATE "Migration:ItemAfterMigrate"
|
||||
#define MIGRATION_STARTED "Migration:Started"
|
||||
#define MIGRATION_ENDED "Migration:Ended"
|
||||
|
@ -47,11 +48,12 @@
|
|||
mObserverService->NotifyObservers(nsnull, message, item)
|
||||
|
||||
#define COPY_DATA(func, replace, itemIndex) \
|
||||
if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \
|
||||
if ((aItems & itemIndex || !aItems)) { \
|
||||
nsAutoString index; \
|
||||
index.AppendInt(itemIndex); \
|
||||
NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get()); \
|
||||
rv = func(replace); \
|
||||
if (NS_FAILED(func(replace))) \
|
||||
NOTIFY_OBSERVERS(MIGRATION_ITEMMIGRATEERROR, index.get()); \
|
||||
NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get()); \
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче