OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 finder: | 137 finder: |
138 { | 138 { |
139 _resultListeners: [], | 139 _resultListeners: [], |
140 searchString: null, | 140 searchString: null, |
141 caseSensitive: false, | 141 caseSensitive: false, |
142 lastResult: null, | 142 lastResult: null, |
143 | 143 |
144 _notifyResultListeners: function(result, findBackwards) | 144 _notifyResultListeners: function(result, findBackwards) |
145 { | 145 { |
146 this.lastResult = result; | 146 this.lastResult = result; |
147 for each (let listener in this._resultListeners) | 147 for (let listener of this._resultListeners) |
148 listener.onFindResult(result, findBackwards); | 148 { |
| 149 // See https://bugzilla.mozilla.org/show_bug.cgi?id=958101, starting |
| 150 // with Gecko 29 only one parameter is expected. |
| 151 try |
| 152 { |
| 153 if (listener.onFindResult.length == 1) |
| 154 { |
| 155 listener.onFindResult({searchString: this.searchString, |
| 156 result: result, findBackwards: findBackwards}); |
| 157 } |
| 158 else |
| 159 listener.onFindResult(result, findBackwards); |
| 160 } |
| 161 catch (e) |
| 162 { |
| 163 Cu.reportError(e); |
| 164 } |
| 165 } |
149 }, | 166 }, |
150 | 167 |
151 fastFind: function(searchString, linksOnly, drawOutline) | 168 fastFind: function(searchString, linksOnly, drawOutline) |
152 { | 169 { |
153 this.searchString = searchString; | 170 this.searchString = searchString; |
154 let result = FilterSearch.search(this.searchString, 0, | 171 let result = FilterSearch.search(this.searchString, 0, |
155 this.caseSensitive); | 172 this.caseSensitive); |
156 this._notifyResultListeners(result, false); | 173 this._notifyResultListeners(result, false); |
157 }, | 174 }, |
158 | 175 |
(...skipping 12 matching lines...) Expand all Loading... |
171 }, | 188 }, |
172 | 189 |
173 removeResultListener: function(listener) | 190 removeResultListener: function(listener) |
174 { | 191 { |
175 let index = this._resultListeners.indexOf(listener); | 192 let index = this._resultListeners.indexOf(listener); |
176 if (index !== -1) | 193 if (index !== -1) |
177 this._resultListeners.splice(index, 1); | 194 this._resultListeners.splice(index, 1); |
178 }, | 195 }, |
179 | 196 |
180 // Irrelevant for us | 197 // Irrelevant for us |
| 198 requestMatchesCount: function(searchString, matchLimit, linksOnly) {}, |
181 highlight: function(highlight, word) {}, | 199 highlight: function(highlight, word) {}, |
182 enableSelection: function() {}, | 200 enableSelection: function() {}, |
183 removeSelection: function() {}, | 201 removeSelection: function() {}, |
184 focusContent: function() {}, | 202 focusContent: function() {}, |
185 keyPress: function() {} | 203 keyPress: function() {} |
186 }, | 204 }, |
187 | 205 |
188 get _lastSearchString() | 206 get _lastSearchString() |
189 { | 207 { |
190 return this.finder.searchString; | 208 return this.finder.searchString; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 removeEventListener: function(event, handler, capture) | 278 removeEventListener: function(event, handler, capture) |
261 { | 279 { |
262 E("filtersTree").addEventListener(event, handler, capture); | 280 E("filtersTree").addEventListener(event, handler, capture); |
263 }, | 281 }, |
264 }; | 282 }; |
265 | 283 |
266 window.addEventListener("load", function() | 284 window.addEventListener("load", function() |
267 { | 285 { |
268 FilterSearch.init(); | 286 FilterSearch.init(); |
269 }, false); | 287 }, false); |
OLD | NEW |