Bug 607965 - Find text field state is not reset when the find helper is closed [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 04 Nov 2010 11:46:46 +0100
changeset 66955 7e23ed2f6b1a17078c8ed48794c8daeab4d633d6
parent 66954 433a8d03f32e7d15e04b60d4d919f25517d84d16
child 66956 2b3d860098a9e69e47cfc9422004ce2525587105
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs607965
Bug 607965 - Find text field state is not reset when the find helper is closed [r=mfinkle]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -1701,30 +1701,37 @@ var FindHelperUI = {
     this._textbox.focus();
 
     // Prevent the view to scroll automatically while searching
     Browser.selectedBrowser.scrollSync = false;
   },
 
   hide: function findHelperHide() {
     this._textbox.value = "";
+    this.status = null;
     this._textbox.blur();
     this._container.hide(this);
     Browser.selectedBrowser.scrollSync = true;
   },
 
   goToPrevious: function findHelperGoToPrevious() {
     Browser.selectedBrowser.messageManager.sendAsyncMessage("FindAssist:Previous", { });
   },
 
   goToNext: function findHelperGoToNext() {
     Browser.selectedBrowser.messageManager.sendAsyncMessage("FindAssist:Next", { });
   },
 
   search: function findHelperSearch(aValue) {
+    // Don't bother searching if the value is empty
+    if (aValue == "") {
+      this.status = null;
+      return;
+    }
+
     this.updateCommands(aValue);
     Browser.selectedBrowser.messageManager.sendAsyncMessage("FindAssist:Find", { searchString: aValue });
   },
 
   updateCommands: function findHelperUpdateCommands(aValue) {
     let disabled = (this._status == Ci.nsITypeAheadFind.FIND_NOTFOUND) || (aValue == "");
     this._cmdPrevious.setAttribute("disabled", disabled);
     this._cmdNext.setAttribute("disabled", disabled);