Bug 963925 - Do not store searchString upon Highlight. r=Unfocused, a=sledru
authorMike de Boer <mdeboer@mozilla.com>
Mon, 17 Feb 2014 15:43:01 +0100
changeset 182926 694327d3251ed4cd58d7a2da274c6b4b6523359a
parent 182925 05c3913ec2d07879158f4dd2206115bbace0862b
child 182927 90e4b605fdb7e5c253035916265df863a3b58e6d
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused, sledru
bugs963925
milestone29.0a2
Bug 963925 - Do not store searchString upon Highlight. r=Unfocused, a=sledru
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();
   },