Bug 1248459 - Initialize finder when showing find bar; r=margaret
authorJim Chen <nchen@mozilla.com>
Fri, 26 Feb 2016 14:38:57 -0500
changeset 322194 3271fbe16bbb558e3b6022589a84b96ce1bd0ef5
parent 322193 62d7f81e434a07bcc00157cf827f179c5fbd8aaf
child 322195 e299632214495958b4964759f4920bc2b578ff51
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1248459
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1248459 - Initialize finder when showing find bar; r=margaret The finder component has a quirk that the first time it searches for a string it may find text that's normally not included in the search result (e.g. the placeholder text in an input element). I think rather than fixing the quirk, which seems risky, it's better to work around it by performing a fake dummy search when first showing the find bar. On desktop, we also (I think unintentionally) perform a dummy search when the find bar first appears.
mobile/android/chrome/content/FindHelper.js
--- a/mobile/android/chrome/content/FindHelper.js
+++ b/mobile/android/chrome/content/FindHelper.js
@@ -48,16 +48,20 @@ var FindHelper = {
       this.findAgain(data, false);
       return this._getMatchesCountResult(data);
     }, "FindInPage:Next");
 
     Messaging.addListener((data) => {
       this.findAgain(data, true);
       return this._getMatchesCountResult(data);
     }, "FindInPage:Prev");
+
+    // Initialize the finder component for the current page by performing a fake find.
+    this._init();
+    this._finder.requestMatchesCount("", 1);
   },
 
   _init: function() {
     // If there's no find in progress, start one.
     if (this._finder) {
       return;
     }