Bug 1523562 [wpt PR 14799] - [Animation Worklet] Upstream animation worklet inside...
[gecko.git] / toolkit / actors / ExtFindChild.jsm
blobb725d9508adf002c56cfe66651bdabcadcc1cda5
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/. */
5 "use strict";
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);
18     }
20     let data;
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);
26         break;
27       case "ext-Finder:HighlightResults":
28         data = this._findContent.highlightResults(message.data);
29         this.mm.sendAsyncMessage("ext-Finder:HighlightResultsFinished", data);
30         break;
31       case "ext-Finder:clearHighlighting":
32         this._findContent.highlighter.highlight(false);
33         break;
34     }
35   }