| Index: chrome/browser/resources/settings/settings_main/settings_main.js
|
| diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
|
| index 6aa8c1113f14754117d1c1a2bfb7fba3bd9b450b..62a76e1a425eae45f5ceeeba7fde9f381c50c372 100644
|
| --- a/chrome/browser/resources/settings/settings_main/settings_main.js
|
| +++ b/chrome/browser/resources/settings/settings_main/settings_main.js
|
| @@ -176,6 +176,7 @@ Polymer({
|
|
|
| /**
|
| * @param {string} query
|
| + * @return {!Promise} A promise indicating that searching finished.
|
| */
|
| searchContents: function(query) {
|
| this.ensureInDefaultSearchPage_();
|
| @@ -184,26 +185,30 @@ Polymer({
|
| // Trigger rendering of the basic and advanced pages and search once ready.
|
| this.showPages_ = {about: false, basic: true, advanced: true};
|
|
|
| - setTimeout(function() {
|
| - settings.getSearchManager().search(
|
| - query, assert(this.$$('settings-basic-page')));
|
| - }.bind(this), 0);
|
| - setTimeout(function() {
|
| - settings.getSearchManager().search(
|
| - query, assert(this.$$('settings-advanced-page'))).then(
|
| - function(request) {
|
| - if (!request.finished) {
|
| - // Nothing to do here. A previous search request was canceled
|
| - // because a new search request was issued before the first one
|
| - // completed.
|
| - return;
|
| - }
|
| -
|
| - this.toolbarSpinnerActive = false;
|
| - this.showNoResultsFound_ =
|
| - !request.isSame('') && !request.didFindMatches();
|
| - }.bind(this));
|
| - }.bind(this), 0);
|
| + return new Promise(function(resolve, reject) {
|
| + setTimeout(function() {
|
| + var whenSearchDone = settings.getSearchManager().search(
|
| + query, assert(this.$$('settings-basic-page')));
|
| + assert(
|
| + whenSearchDone ===
|
| + settings.getSearchManager().search(
|
| + query, assert(this.$$('settings-advanced-page'))));
|
| +
|
| + whenSearchDone.then(function(request) {
|
| + resolve();
|
| + if (!request.finished) {
|
| + // Nothing to do here. A previous search request was canceled
|
| + // because a new search request was issued before the first one
|
| + // completed.
|
| + return;
|
| + }
|
| +
|
| + this.toolbarSpinnerActive = false;
|
| + this.showNoResultsFound_ =
|
| + !request.isSame('') && !request.didFindMatches();
|
| + }.bind(this));
|
| + }.bind(this), 0);
|
| + }.bind(this));
|
| },
|
|
|
| /**
|
|
|