Chromium Code Reviews| Index: chrome/browser/resources/settings/pref_tracker/pref_tracker.js |
| diff --git a/chrome/browser/resources/settings/pref_tracker/pref_tracker.js b/chrome/browser/resources/settings/pref_tracker/pref_tracker.js |
| index 1d692abdadef906c608475d0f2446b1e3829fceb..b7124759a8c0d7310ffe9ccc7f3cf46cb18128a1 100644 |
| --- a/chrome/browser/resources/settings/pref_tracker/pref_tracker.js |
| +++ b/chrome/browser/resources/settings/pref_tracker/pref_tracker.js |
| @@ -17,24 +17,6 @@ |
| */ |
| (function() { |
| - /** |
| - * An array of all the tracker instances. |
| - * @type {!Array<!CrSettingsPrefTrackerElement>} |
| - */ |
| - var instances = []; |
| - |
| - /** |
| - * Validates all tracker instances. |
| - * @private |
| - */ |
| - var validateAll_ = function() { |
| - instances.forEach(function(tracker) { |
| - tracker.validate_(); |
| - }); |
| - }; |
| - |
| - document.addEventListener(CrSettingsPrefs.INITIALIZED, validateAll_); |
| - |
| Polymer({ |
| is: 'cr-settings-pref-tracker', |
| @@ -52,29 +34,26 @@ |
| /** @override */ |
| ready: function() { |
| this.validate_(); |
| - |
| - instances.push(this); |
| }, |
| /** |
| - * Throws an error if prefs are initialized and the tracked pref is not |
| - * found. |
| + * Logs an error once prefs are initialized if the tracked pref is |
| + * not found. |
| * @private |
| */ |
| validate_: function() { |
| - this.async(function() { |
| + CrSettingsPrefs.initialized.then(function() { |
| // Note that null == undefined. |
| - if (CrSettingsPrefs.isInitialized && this.pref == null) { |
| + if (this.pref == null) { |
| // HACK ALERT: This is the best clue we have as to the pref key for |
| // this tracker. This value should not be relied upon anywhere or |
| // actually used besides for this error message. |
| - var parentControlHTML = this.parentNode && this.parentNode.host && |
| - this.parentNode.host.outerHTML; |
| + var parentControlHTML = this.domHost && this.domHost.outerHTML; |
| - throw new Error('Pref not found. Parent control:' + |
| + console.error('Pref not found. Parent control:' + |
|
Dan Beam
2015/09/21 22:25:20
is this console.error() instead of throw now becau
michaelpg
2015/09/22 00:34:06
Yeah, it just said "Uncaught (in promise): blah",
|
| (parentControlHTML || 'Unknown')); |
| } |
| - }); |
| + }.bind(this)); |
| }, |
| }); |
| })(); |