Chromium Code Reviews| Index: chrome/browser/resources/settings/controls/settings_checkbox.js |
| diff --git a/chrome/browser/resources/settings/controls/settings_checkbox.js b/chrome/browser/resources/settings/controls/settings_checkbox.js |
| index e892fb96f4558da4cc6a74c347366da705ffc505..842028387aed2a912673ed7102d4bf6e386c8a75 100644 |
| --- a/chrome/browser/resources/settings/controls/settings_checkbox.js |
| +++ b/chrome/browser/resources/settings/controls/settings_checkbox.js |
| @@ -87,7 +87,16 @@ Polymer({ |
| * @private |
| */ |
| checkedChanged_: function() { |
| - this.set('pref.value', this.getNewValue_(this.checked)); |
| + if (!this.pref) |
| + return; |
| + /** @type {boolean} */ var newValue = this.getNewValue_(this.checked); |
| + // Ensure that newValue is the correct type for the pref type, either |
| + // a bolean or a number. |
|
Dan Beam
2015/12/02 05:11:59
boolean
stevenjb
2015/12/02 18:14:51
Done.
|
| + if (this.pref.type == chrome.settingsPrivate.PrefType.NUMBER) { |
| + this.set('pref.value', newValue ? 1 : 0); |
| + return; |
| + } |
| + this.set('pref.value', newValue); |
| }, |
| /** |