aboutsummaryrefslogtreecommitdiffstats
path: root/data/mozlib/mozpage.js
blob: 7acf801fbef9ff536684b31080d742b0ae0d56c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";

var mozFlags = new FlagList();

// Currently empty message handler
function MozOnMessageHandler(msg, nextHandlerList) {
  switch (msg.cmd) {
  default:
    if (nextHandlerList) {
      var nextHandler = nextHandlerList.splice(0, 1);
      if (nextHandler[0]) {
        nextHandler[0](msg, nextHandlerList);
      }
    }
    else {
      console.error("Error: unknown RPC call " + msg.toSource());
    }
  break;
  }
}

/**
 * Additional commands specific for this subclass, overriding superclass one.
 */
function MozCentralCommandDispatch(cmdLabel, cmdParams) {
  switch (cmdLabel) {
  // Set up our own commands
  case "setFlag":
    mozFlags.set(cmdParams);
    break;
  case "unsetFlag":
    mozFlags.reject(cmdParams);
    break;
  case "askFlag":
    mozFlags.ask(cmdParams);
    break;
  case "clearFlag":
    mozFlags.unset(cmdParams);
    break;
  default:
    console.error("Unknown command:\n" + cmdLabel + "\nparameters:\n" + cmdParams);
  break;
  }
}

//vim: set ts=2 et sw=2 textwidth=80: