Source code

Revision control

Other Tools

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";
6
7
var EXPORTED_SYMBOLS = ["ContentSearchChild"];
8
9
const { ActorChild } = ChromeUtils.import(
11
);
12
13
class ContentSearchChild extends ActorChild {
14
handleEvent(event) {
15
this._sendMsg(event.detail.type, event.detail.data);
16
}
17
18
receiveMessage(msg) {
19
this._fireEvent(msg.data.type, msg.data.data);
20
}
21
22
_sendMsg(type, data = null) {
23
this.mm.sendAsyncMessage("ContentSearch", {
24
type,
25
data,
26
});
27
}
28
29
_fireEvent(type, data = null) {
30
let event = Cu.cloneInto(
31
{
32
detail: {
33
type,
34
data,
35
},
36
},
37
this.content
38
);
39
this.content.dispatchEvent(
40
new this.content.CustomEvent("ContentSearchService", event)
41
);
42
}
43
}