Index: chrome/browser/resources/options/language_list.js |
diff --git a/chrome/browser/resources/options/language_list.js b/chrome/browser/resources/options/language_list.js |
index 1030a0ac70e449e6cd59f36bf21855a1f61d738e..462429536f24f5159339663d47c6916762efa116 100644 |
--- a/chrome/browser/resources/options/language_list.js |
+++ b/chrome/browser/resources/options/language_list.js |
@@ -388,23 +388,19 @@ cr.define('options', function() { |
* @private |
*/ |
load_: function(languageCodes) { |
+ if (!this.selectionModel) |
Kevin Bailey
2016/01/26 15:00:40
Sorry, it was unclear to me what you preferred. So
Dan Beam
2016/01/26 19:38:53
I would prefer load_ only get called after being d
Kevin Bailey
2016/01/26 22:21:46
Done.
|
+ return; |
// Preserve the original selected index. See comments below. |
- var originalSelectedIndex = (this.selectionModel ? |
- this.selectionModel.selectedIndex : -1); |
+ var originalSelectedIndex = this.selectionModel.selectedIndex; |
this.dataModel = new ArrayDataModel(languageCodes); |
Dan Beam
2016/01/26 19:38:53
doing
this.dataModel = ...;
triggers an ES5 se
|
if (originalSelectedIndex >= 0 && |
originalSelectedIndex < this.dataModel.length) { |
// Restore the original selected index if the selected index is |
- // valid after the data model is loaded. This is neeeded to keep |
+ // valid after the data model is loaded. This is needed to keep |
// the selected language after the languge is added or removed. |
this.selectionModel.selectedIndex = originalSelectedIndex; |
// The lead index should be updated too. |
this.selectionModel.leadIndex = originalSelectedIndex; |
- } else if (this.dataModel.length > 0) { |
- // Otherwise, select the first item if it's not empty. |
- // Note that ListSingleSelectionModel won't select an item |
- // automatically, hence we manually select the first item here. |
- this.selectionModel.selectedIndex = 0; |
Dan Beam
2016/01/26 19:38:53
revert this now
|
} |
}, |