Bug 1857998 [wpt PR 42432] - [css-nesting-ident] Enable relaxed syntax, a=testonly
[gecko.git] / browser / actors / ContentSearchChild.sys.mjs
blob79cca36bae3171d9fcadc3adc975a1188fb767a3
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/. */
6 export class ContentSearchChild extends JSWindowActorChild {
7   handleEvent(event) {
8     // The event gets translated into a message that
9     // is then sent to the parent.
10     if (event.type == "ContentSearchClient") {
11       this.sendAsyncMessage(event.detail.type, event.detail.data);
12     }
13   }
15   receiveMessage(msg) {
16     // The message gets translated into an event that
17     // is then sent to the content.
18     this._fireEvent(msg.name, msg.data);
19   }
21   _fireEvent(type, data = null) {
22     let event = Cu.cloneInto(
23       {
24         detail: {
25           type,
26           data,
27         },
28       },
29       this.contentWindow
30     );
31     this.contentWindow.dispatchEvent(
32       new this.contentWindow.CustomEvent("ContentSearchService", event)
33     );
34   }