зеркало из https://github.com/mozilla/pjs.git
Bug 350949. Feed preview leaks memory. Check for multiple list members after frantic reloading. r=mano
This commit is contained in:
Родитель
d8deddcd2e
Коммит
384c577da3
|
@ -425,16 +425,20 @@ var FeedResultService = {
|
|||
removeFeedResult: function FRS_removeFeedResult(uri) {
|
||||
NS_ASSERT(uri != null, "null URI!");
|
||||
var resultList = this._results[uri.spec];
|
||||
if (!resultList)
|
||||
return;
|
||||
var deletions = 0;
|
||||
for (var i = 0; i < resultList.length; ++i) {
|
||||
if (resultList[i].uri == uri) {
|
||||
delete resultList[i];
|
||||
// send the null value to the end of our little list and pop
|
||||
// it off
|
||||
resultList.sort();
|
||||
resultList.pop();
|
||||
break;
|
||||
++deletions;
|
||||
}
|
||||
}
|
||||
|
||||
// send the holes to the end
|
||||
resultList.sort();
|
||||
// and trim the list
|
||||
resultList.splice(resultList.length - deletions, deletions);
|
||||
if (resultList.length == 0)
|
||||
delete this._results[uri.spec];
|
||||
},
|
||||
|
|
|
@ -695,13 +695,14 @@ FeedWriter.prototype = {
|
|||
|
||||
_window: null,
|
||||
_document: null,
|
||||
|
||||
_feedURI: null,
|
||||
|
||||
/**
|
||||
* See nsIFeedWriter
|
||||
*/
|
||||
write: function FW_write(window) {
|
||||
var originalURI = this._getOriginalURI(window);
|
||||
if (!originalURI)
|
||||
this._feedURI = this._getOriginalURI(window);
|
||||
if (!this._feedURI)
|
||||
return;
|
||||
try {
|
||||
this._window = window;
|
||||
|
@ -731,10 +732,7 @@ FeedWriter.prototype = {
|
|||
this._writeFeedContent(container);
|
||||
}
|
||||
finally {
|
||||
var feedService =
|
||||
Cc["@mozilla.org/browser/feeds/result-service;1"].
|
||||
getService(Ci.nsIFeedResultService);
|
||||
feedService.removeFeedResult(originalURI);
|
||||
this._removeFeedFromCache();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -751,6 +749,17 @@ FeedWriter.prototype = {
|
|||
prefs.removeObserver(PREF_SELECTED_READER, this);
|
||||
prefs.removeObserver(PREF_SELECTED_WEB, this);
|
||||
prefs.removeObserver(PREF_SELECTED_APP, this);
|
||||
this._removeFeedFromCache();
|
||||
},
|
||||
|
||||
_removeFeedFromCache: function FW__removeFeedFromCache() {
|
||||
if (this._feedURI) {
|
||||
var feedService =
|
||||
Cc["@mozilla.org/browser/feeds/result-service;1"].
|
||||
getService(Ci.nsIFeedResultService);
|
||||
feedService.removeFeedResult(this._feedURI);
|
||||
this._feedURI = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче