mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 06:38:36 +00:00
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:
parent
6bebcd41c3
commit
42487f4fb4
@ -37,6 +37,8 @@
|
|||||||
const kIMig = Components.interfaces.nsIBrowserProfileMigrator;
|
const kIMig = Components.interfaces.nsIBrowserProfileMigrator;
|
||||||
const kIPStartup = Components.interfaces.nsIProfileStartup;
|
const kIPStartup = Components.interfaces.nsIProfileStartup;
|
||||||
const kProfileMigratorContractIDPrefix = "@mozilla.org/profile/migrator;1?app=browser&type=";
|
const kProfileMigratorContractIDPrefix = "@mozilla.org/profile/migrator;1?app=browser&type=";
|
||||||
|
const Cc = Components.classes;
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
|
||||||
var MigrationWizard = {
|
var MigrationWizard = {
|
||||||
_source: "", // Source Profile Migrator ContractID suffix
|
_source: "", // Source Profile Migrator ContractID suffix
|
||||||
@ -54,6 +56,7 @@ var MigrationWizard = {
|
|||||||
os.addObserver(this, "Migration:Started", false);
|
os.addObserver(this, "Migration:Started", false);
|
||||||
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
|
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
|
||||||
os.addObserver(this, "Migration:ItemAfterMigrate", false);
|
os.addObserver(this, "Migration:ItemAfterMigrate", false);
|
||||||
|
os.addObserver(this, "Migration:ItemError", false);
|
||||||
os.addObserver(this, "Migration:Ended", false);
|
os.addObserver(this, "Migration:Ended", false);
|
||||||
|
|
||||||
this._wiz = document.documentElement;
|
this._wiz = document.documentElement;
|
||||||
@ -81,6 +84,7 @@ var MigrationWizard = {
|
|||||||
os.removeObserver(this, "Migration:Started");
|
os.removeObserver(this, "Migration:Started");
|
||||||
os.removeObserver(this, "Migration:ItemBeforeMigrate");
|
os.removeObserver(this, "Migration:ItemBeforeMigrate");
|
||||||
os.removeObserver(this, "Migration:ItemAfterMigrate");
|
os.removeObserver(this, "Migration:ItemAfterMigrate");
|
||||||
|
os.removeObserver(this, "Migration:ItemError");
|
||||||
os.removeObserver(this, "Migration:Ended");
|
os.removeObserver(this, "Migration:Ended");
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -489,6 +493,35 @@ var MigrationWizard = {
|
|||||||
nextButton.click();
|
nextButton.click();
|
||||||
}
|
}
|
||||||
break;
|
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 browserprofilemigratorutils___h___
|
||||||
|
|
||||||
#define MIGRATION_ITEMBEFOREMIGRATE "Migration:ItemBeforeMigrate"
|
#define MIGRATION_ITEMBEFOREMIGRATE "Migration:ItemBeforeMigrate"
|
||||||
|
#define MIGRATION_ITEMMIGRATEERROR "Migration:ItemError"
|
||||||
#define MIGRATION_ITEMAFTERMIGRATE "Migration:ItemAfterMigrate"
|
#define MIGRATION_ITEMAFTERMIGRATE "Migration:ItemAfterMigrate"
|
||||||
#define MIGRATION_STARTED "Migration:Started"
|
#define MIGRATION_STARTED "Migration:Started"
|
||||||
#define MIGRATION_ENDED "Migration:Ended"
|
#define MIGRATION_ENDED "Migration:Ended"
|
||||||
@ -47,11 +48,12 @@
|
|||||||
mObserverService->NotifyObservers(nsnull, message, item)
|
mObserverService->NotifyObservers(nsnull, message, item)
|
||||||
|
|
||||||
#define COPY_DATA(func, replace, itemIndex) \
|
#define COPY_DATA(func, replace, itemIndex) \
|
||||||
if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \
|
if ((aItems & itemIndex || !aItems)) { \
|
||||||
nsAutoString index; \
|
nsAutoString index; \
|
||||||
index.AppendInt(itemIndex); \
|
index.AppendInt(itemIndex); \
|
||||||
NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get()); \
|
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()); \
|
NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user