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 class ControllersChild extends JSWindowActorChild {
10 receiveMessage(message) {
11 switch (message.name) {
12 case "ControllerCommands:Do":
13 if (this.docShell && this.docShell.isCommandEnabled(message.data)) {
14 this.docShell.doCommand(message.data);
18 case "ControllerCommands:DoWithParams":
19 var data = message.data;
20 if (this.docShell && this.docShell.isCommandEnabled(data.cmd)) {
21 var params = Cu.createCommandParams();
22 for (var name in data.params) {
23 var value = data.params[name];
24 if (value.type == "long") {
25 params.setLongValue(name, parseInt(value.value));
27 throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
30 this.docShell.doCommandWithParams(data.cmd, params);