search: don't forget to notify caller when failing to ensure actors

The updateSearch() function is called in SearchResults every time new
search hits are available from a search provider; SearchResults will
wait for updateSearch() to complete in a callaback, to update the
overall progress of the search operation.

updateSearch() will call _ensureResultActors(), which will in turn call
getResultMetas() on the search provider, which is an operation that can
fail arbitrarily or return inconsistent data, as it's entirely in the
hands of the search provider.

In case _ensureResultActors() returns a failure, updateSearch() is
currently failing to notify the passed-in callback, which might leave
SearchResults in an inconsistent state: make sure the asynchronous flow
always ends up with a notification to the updateSearch() callback.
This commit is contained in:
Cosimo Cecchi 2015-01-07 17:53:30 +08:00 committed by Jasper St. Pierre
parent 966ae2c370
commit cea946e745

View File

@ -236,6 +236,7 @@ const SearchResultsBase = new Lang.Class({
this._ensureResultActors(results, Lang.bind(this, function(successful) { this._ensureResultActors(results, Lang.bind(this, function(successful) {
if (!successful) { if (!successful) {
this._clearResultDisplay(); this._clearResultDisplay();
callback();
return; return;
} }