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 draft
authorMike de Boer <mdeboer@mozilla.com>
Thu, 15 Sep 2016 17:11:18 +0200
changeset 414106 02e245513b7739f6b65949ca1c177abfb0cd6a3a
parent 414101 1a8d29794e992b36a42eb2871a7f303df51df303
child 531365 0a15a5f427f8cdef96fbba48dddae199c0592d0c
push id29585
push usermdeboer@mozilla.com
push dateThu, 15 Sep 2016 15:11:46 +0000
reviewersjaws
bugs1279707
milestone51.0a1
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
toolkit/modules/Finder.jsm
toolkit/modules/FinderHighlighter.jsm
--- 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 {