Skip to content

Commit 7cbeb8f

Browse files
committed
supports Fx25's findbar. Fixes issue 879.
Note: When minVersion > 24, should remove legacy codes.
1 parent 5a6d4b3 commit 7cbeb8f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

common/content/finder.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ const Finder = Module("finder", {
104104
* Searches the current buffer for <b>str</b>.
105105
*
106106
* @param {string} str The string to find.
107+
* @see Bug537013 https://bugzilla.mozilla.org/show_bug.cgi?id=537013
107108
*/
108-
find: function (str) {
109+
find: Services.vc.compare(Services.appinfo.version, "24.0") > 0 ?
110+
function (str) {
111+
let fastFind = config.browser.getFindBar();
112+
this._processUserPattern(str);
113+
fastFind._typeAheadCaseSensitive = this._caseSensitive;
114+
fastFind._typeAheadLinksOnly = this._linksOnly;
115+
let result = fastFind._find(str);
116+
} :
117+
// FIXME: remove when minVersion > 24
118+
function (str) {
109119
let fastFind = config.browser.fastFind;
110120

111121
this._processUserPattern(str);
@@ -120,8 +130,21 @@ const Finder = Module("finder", {
120130
*
121131
* @param {boolean} reverse Whether to search forwards or backwards.
122132
* @default false
133+
* @see Bug537013 https://bugzilla.mozilla.org/show_bug.cgi?id=537013
123134
*/
124-
findAgain: function (reverse) {
135+
findAgain: Services.vc.compare(Services.appinfo.version, "24.0") > 0 ?
136+
function (reverse) {
137+
let fastFind = config.browser.getFindBar();
138+
if (fastFind._findField.value != this._lastSearchString)
139+
this.find(this._lastSearchString);
140+
141+
let backwards = reverse ? !this._lastSearchBackwards : this._lastSearchBackwards;
142+
fastFind._typeAheadLinksOnly = this._linksOnly;
143+
let result = fastFind._findAgain(backwards);
144+
this._displayFindResult(result, backwards);
145+
} :
146+
// FIXME: remove when minVersion > 24
147+
function (reverse) {
125148
// This hack is needed to make n/N work with the correct string, if
126149
// we typed /foo<esc> after the original search. Since searchString is
127150
// readonly we have to call find() again to update it.
@@ -193,7 +216,9 @@ const Finder = Module("finder", {
193216
// focus links after searching, so the user can just hit <Enter> another time to follow the link
194217
// This has to be done async, because the mode reset after onSubmit would
195218
// clear the focus
196-
let elem = config.browser.fastFind.foundLink;
219+
let elem = Services.vc.compare(Services.appinfo.version, "24.0") > 0 ?
220+
config.browser.getFindBar()._foundLinkRef.get() :
221+
config.browser.fastFind.foundLink; // FIXME: remove when minVersion > 24
197222
this.setTimeout(function() {
198223
if (elem)
199224
elem.focus();

0 commit comments

Comments
 (0)