Bug 383271: break the cycle between the search suggest component and its timer (fixes leak when using search suggestions), r=mconnor

This commit is contained in:
gavin@gavinsharp.com 2007-07-08 16:44:03 -07:00
Родитель 8c1b7b23d4
Коммит 4149ec6c2e
1 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -332,17 +332,21 @@ SuggestAutoComplete.prototype = {
_sentSuggestRequest: false,
/**
* This is the callback for the suggest timeout timer. If this gets
* called, it means that we've given up on receiving a reply from the
* search engine's suggestion server in a timely manner.
* This is the callback for the suggest timeout timer.
*/
notify: function SAC_notify(timer) {
// make sure we're still waiting for this response before sending
if ((timer != this._formHistoryTimer) || !this._listener)
// FIXME: bug 387341
// Need to break the cycle between us and the timer.
this._formHistoryTimer = null;
// If this._listener is null, we've already sent out suggest results, so
// nothing left to do here.
if (!this._listener)
return;
// Otherwise, the XMLHTTPRequest for suggest results is taking too long,
// so send out the form history results and cancel the request.
this._listener.onSearchResult(this, this._formHistoryResult);
this._formHistoryTimer = null;
this._reset();
},