Bug 1279707 - when the location changes, we need to be more thorough in clearing the state variables than we are now to make sure we start fresh in new documents. r?jaws
MozReview-Commit-ID: KkeSKt7XVAc
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -587,19 +587,22 @@ Finder.prototype = {
return controller;
},
// Start of nsIWebProgressListener implementation.
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
if (!aWebProgress.isTopLevel)
return;
+ // Ignore events that don't change the document.
+ if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)
+ return;
// Avoid leaking if we change the page.
- this._previousLink = this._currentFoundRange = null;
+ this._lastFindResult = this._previousLink = this._currentFoundRange = null;
this.highlighter.onLocationChange();
this.iterator.reset();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference])
};
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -477,17 +477,17 @@ FinderHighlighter.prototype = {
* We need to clear the references we keep, which'll make sure we redraw
* everything when the user starts to find in page again.
*/
onLocationChange() {
let window = this.finder._getWindow();
this.hide(window);
let dict = this.getForWindow(window);
this.clear(window);
- dict.currentFoundRange = null;
+ dict.currentFoundRange = dict.lastIteratorParams = null;
if (!dict.modalHighlightOutline)
return;
if (kDebug) {
dict.modalHighlightOutline.remove();
} else {
try {