Bug 758894 - 'Highlight all' feature causes zombie compartments, r=mano

This commit is contained in:
Olli Pettay 2012-06-03 16:06:35 +03:00
parent 27c5dbc4df
commit 7debbaba5e

View File

@ -942,14 +942,14 @@
return textFound;
if (aHighlight) {
this._searchRange = doc.createRange();
this._searchRange.selectNodeContents(doc.body);
var searchRange = doc.createRange();
searchRange.selectNodeContents(doc.body);
this._startPt = this._searchRange.cloneRange();
this._startPt.collapse(true);
var startPt = searchRange.cloneRange();
startPt.collapse(true);
this._endPt = this._searchRange.cloneRange();
this._endPt.collapse(false);
var endPt = searchRange.cloneRange();
endPt.collapse(false);
var retRange = null;
var finder = Components.classes["@mozilla.org/embedcomp/rangefind;1"]
@ -958,11 +958,11 @@
finder.caseSensitive = this._shouldBeCaseSensitive(aWord);
while ((retRange = finder.Find(aWord, this._searchRange,
this._startPt, this._endPt))) {
while ((retRange = finder.Find(aWord, searchRange,
startPt, endPt))) {
this._highlight(retRange, controller);
this._startPt = retRange.cloneRange();
this._startPt.collapse(false);
startPt = retRange.cloneRange();
startPt.collapse(false);
textFound = true;
}