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/. */
11 } = require("resource://devtools/shared/protocol.js");
13 const longstringType = types.getType("longstring");
14 const arraybufferType = types.getType("arraybuffer");
15 // The sourcedata type needs some custom marshalling, because it is sometimes
16 // returned as an arraybuffer and sometimes as a longstring.
17 types.addType("sourcedata", {
18 write: (value, context, detail) => {
19 if (value.typeName === "arraybuffer") {
20 return arraybufferType.write(value, context, detail);
22 return longstringType.write(value, context, detail);
24 read: (value, context, detail) => {
25 if (value.typeName === "arraybuffer") {
26 return arraybufferType.read(value, context, detail);
28 return longstringType.read(value, context, detail);
32 types.addDictType("sourceposition", {
36 types.addDictType("nullablesourceposition", {
37 line: "nullable:number",
38 column: "nullable:number",
40 types.addDictType("breakpointquery", {
41 start: "nullable:nullablesourceposition",
42 end: "nullable:nullablesourceposition",
45 types.addDictType("source.onsource", {
46 contentType: "nullable:string",
47 source: "nullable:sourcedata",
50 const sourceSpec = generateActorSpec({
54 getBreakpointPositionsCompressed: {
56 query: Arg(0, "nullable:breakpointquery"),
59 positions: RetVal("json"),
65 lines: RetVal("json"),
70 response: RetVal("source.onsource"),
74 pausePoints: Arg(0, "json"),
78 request: { range: Arg(0, "nullable:json") },
79 response: { pausedInSource: RetVal("boolean") },
82 request: { range: Arg(0, "nullable:json") },
87 exports.sourceSpec = sourceSpec;