1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 var EXPORTED_SYMBOLS = ["ExtFindChild"];
9 const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
11 ChromeUtils.defineModuleGetter(this, "FindContent",
12 "resource://gre/modules/FindContent.jsm");
14 class ExtFindChild extends ActorChild {
15 async receiveMessage(message) {
16 if (!this._findContent) {
17 this._findContent = new FindContent(this.mm.docShell);
21 switch (message.name) {
22 case "ext-Finder:CollectResults":
23 this.finderInited = true;
24 data = await this._findContent.findRanges(message.data);
25 this.mm.sendAsyncMessage("ext-Finder:CollectResultsFinished", data);
27 case "ext-Finder:HighlightResults":
28 data = this._findContent.highlightResults(message.data);
29 this.mm.sendAsyncMessage("ext-Finder:HighlightResultsFinished", data);
31 case "ext-Finder:clearHighlighting":
32 this._findContent.highlighter.highlight(false);