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 = ["ControllersChild"];
9 const { ActorChild } = ChromeUtils.import(
10 "resource://gre/modules/ActorChild.jsm"
13 class ControllersChild extends ActorChild {
14 receiveMessage(message) {
15 switch (message.name) {
16 case "ControllerCommands:Do":
17 if (this.docShell.isCommandEnabled(message.data)) {
18 this.docShell.doCommand(message.data);
22 case "ControllerCommands:DoWithParams":
23 var data = message.data;
24 if (this.docShell.isCommandEnabled(data.cmd)) {
25 var params = Cu.createCommandParams();
26 for (var name in data.params) {
27 var value = data.params[name];
28 if (value.type == "long") {
29 params.setLongValue(name, parseInt(value.value));
31 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
34 this.docShell.doCommandWithParams(data.cmd, params);