Bug 1603673 - Signal that we support web manifest processing in Fenix r=snorp,agi...
[gecko.git] / toolkit / actors / ControllersChild.jsm
blob8f252894cc419f2ce82645325ef6795f753a5a8d
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";
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);
19         }
20         break;
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));
30             } else {
31               throw Cr.NS_ERROR_NOT_IMPLEMENTED;
32             }
33           }
34           this.docShell.doCommandWithParams(data.cmd, params);
35         }
36         break;
37     }
38   }