gcli.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. "use strict";
  5. const { Arg, RetVal, generateActorSpec } = require("devtools/shared/protocol");
  6. const gcliSpec = generateActorSpec({
  7. typeName: "gcli",
  8. events: {
  9. "commands-changed": {
  10. type: "commandsChanged"
  11. }
  12. },
  13. methods: {
  14. _testOnlyAddItemsByModule: {
  15. request: {
  16. customProps: Arg(0, "array:string")
  17. }
  18. },
  19. _testOnlyRemoveItemsByModule: {
  20. request: {
  21. customProps: Arg(0, "array:string")
  22. }
  23. },
  24. specs: {
  25. request: {
  26. customProps: Arg(0, "nullable:array:string")
  27. },
  28. response: {
  29. value: RetVal("array:json")
  30. }
  31. },
  32. execute: {
  33. request: {
  34. // The command string
  35. typed: Arg(0, "string")
  36. },
  37. response: RetVal("json")
  38. },
  39. state: {
  40. request: {
  41. // The command string
  42. typed: Arg(0, "string"),
  43. // Cursor start position
  44. start: Arg(1, "number"),
  45. // The prediction offset (# times UP/DOWN pressed)
  46. rank: Arg(2, "number")
  47. },
  48. response: RetVal("json")
  49. },
  50. parseType: {
  51. request: {
  52. // The command string
  53. typed: Arg(0, "string"),
  54. // The name of the parameter to parse
  55. paramName: Arg(1, "string")
  56. },
  57. response: RetVal("json")
  58. },
  59. nudgeType: {
  60. request: {
  61. // The command string
  62. typed: Arg(0, "string"),
  63. // +1/-1 for increment / decrement
  64. by: Arg(1, "number"),
  65. // The name of the parameter to parse
  66. paramName: Arg(2, "string")
  67. },
  68. response: RetVal("string")
  69. },
  70. getSelectionLookup: {
  71. request: {
  72. // The command containing the parameter in question
  73. commandName: Arg(0, "string"),
  74. // The name of the parameter
  75. paramName: Arg(1, "string"),
  76. },
  77. response: RetVal("json")
  78. }
  79. }
  80. });
  81. exports.gcliSpec = gcliSpec;