Bug 1186141 - fix wizard so it can cope with disabled items; r=rkent, a=rkent
authorJorg K <mozilla@jorgk.com>
Tue, 11 Aug 2015 21:41:05 -0700
changeset 22886 4f1d6e940fc4a328db80e28fac4f1e22aa1a563e
parent 22885 9ef3bdaaa318a8db7c2551372b8b1b20a44fdd71
child 22887 9d3eefbed90e77133c834eabf0d578c0f297b6e7
push id1465
push userkent@caspia.com
push dateMon, 14 Sep 2015 21:51:35 +0000
treeherdercomm-beta@48e8ee8813e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, rkent
bugs1186141
Bug 1186141 - fix wizard so it can cope with disabled items; r=rkent, a=rkent
mail/components/migration/content/migration.js
--- a/mail/components/migration/content/migration.js
+++ b/mail/components/migration/content/migration.js
@@ -65,16 +65,17 @@ var MigrationWizard = {
     Services.obs.removeObserver(this, "Migration:Ended");
     Services.obs.removeObserver(this, "Migration:Progress");
   },
 
   // 1 - Import Source
   onImportSourcePageShow: function ()
   {
     this._wiz.canRewind = false;
+    this._wiz.canAdvance = false;
 
     // Figure out what source apps are are available to import from:
     var group = document.getElementById("importSourceGroup");
     for (var i = 0; i < group.childNodes.length; ++i) {
       var suffix = group.childNodes[i].id;
       if (suffix != "nothing") {
         var contractID = kProfileMigratorContractIDPrefix + suffix;
         var migrator = Components.classes[contractID].createInstance(kIMig);
@@ -82,22 +83,26 @@ var MigrationWizard = {
           group.childNodes[i].hidden = true;
           if (this._source == suffix) this._source = null;
         }
       }
     }
 
     var firstNonDisabled = null;
     for (var i = 0; i < group.childNodes.length; ++i) {
-    if (!group.childNodes[i].hidden) {
+    if (!group.childNodes[i].hidden && !group.childNodes[i].disabled) {
         firstNonDisabled = group.childNodes[i];
         break;
       }
     }
     group.selectedItem = this._source == "" ? firstNonDisabled : document.getElementById(this._source);
+
+    if (firstNonDisabled) {
+      this._wiz.canAdvance = true;
+    }
   },
 
   onImportSourcePageAdvanced: function ()
   {
     var newSource = document.getElementById("importSourceGroup").selectedItem.id;
 
     if (newSource == "nothing") {
       document.documentElement.cancel();
@@ -136,16 +141,19 @@ var MigrationWizard = {
     // too and don't want to disable the back button
     // if (this._autoMigrate)
     //   document.documentElement.getButton("back").disabled = true;
 
     var profiles = document.getElementById("profiles");
     while (profiles.hasChildNodes())
       profiles.lastChild.remove();
 
+    if (!this._migrator) {
+      return;
+    }
     var sourceProfiles = this._migrator.sourceProfiles;
     var count = sourceProfiles.length;
     for (var i = 0; i < count; ++i) {
       var item = document.createElement("radio");
       item.id = sourceProfiles.queryElementAt(i, nsISupportsString).data;
       item.setAttribute("label", item.id);
       profiles.appendChild(item);
     }