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