Bug 963925: do not store searchString upon Highlight. r=Unfocused
authorMike de Boer <mdeboer@mozilla.com>
Mon, 17 Feb 2014 15:43:01 +0100
changeset 169686 2261025fb968651bbeab11b6e7f0f2f12b72c8a5
parent 169685 de286a964490a0599f1ad083abcb86481e4c4074
child 169687 947db48790fafb352ca158f2c7bae6ec79398c83
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersUnfocused
bugs963925
milestone30.0a1
Bug 963925: do not store searchString upon Highlight. r=Unfocused
toolkit/modules/Finder.jsm
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -31,18 +31,19 @@ Finder.prototype = {
     if (this._listeners.indexOf(aListener) === -1)
       this._listeners.push(aListener);
   },
 
   removeResultListener: function (aListener) {
     this._listeners = this._listeners.filter(l => l != aListener);
   },
 
-  _notify: function (aSearchString, aResult, aFindBackwards, aDrawOutline) {
-    this._searchString = aSearchString;
+  _notify: function (aSearchString, aResult, aFindBackwards, aDrawOutline, aStoreResult = true) {
+    if (aStoreResult)
+      this._searchString = aSearchString;
     this._outlineLink(aDrawOutline);
 
     let foundLink = this._fastFind.foundLink;
     let linkURL = null;
     if (foundLink) {
       let docCharset = null;
       let ownerDoc = foundLink.ownerDocument;
       if (ownerDoc)
@@ -57,16 +58,17 @@ Finder.prototype = {
     }
 
     let data = {
       result: aResult,
       findBackwards: aFindBackwards,
       linkURL: linkURL,
       rect: this._getResultRect(),
       searchString: this._searchString,
+      storeResult: aStoreResult
     };
 
     for (let l of this._listeners) {
       l.onFindResult(data);
     }
   },
 
   get searchString() {
@@ -105,17 +107,17 @@ Finder.prototype = {
     this._notify(searchString, result, aFindBackwards, aDrawOutline);
   },
 
   highlight: function (aHighlight, aWord) {
     let found = this._highlight(aHighlight, aWord, null);
     if (aHighlight) {
       let result = found ? Ci.nsITypeAheadFind.FIND_FOUND
                          : Ci.nsITypeAheadFind.FIND_NOTFOUND;
-      this._notify(aWord, result, false, false);
+      this._notify(aWord, result, false, false, false);
     }
   },
 
   enableSelection: function() {
     this._fastFind.setSelectionModeAndRepaint(Ci.nsISelectionController.SELECTION_ON);
     this._restoreOriginalOutline();
   },