thread.js (3984B)
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 6 const { 7 Arg, 8 Option, 9 RetVal, 10 generateActorSpec, 11 types, 12 } = require("resource://devtools/shared/protocol.js"); 13 14 types.addDictType("available-breakpoint-group", { 15 name: "string", 16 events: "array:available-breakpoint-event", 17 }); 18 19 types.addDictType("available-breakpoint-event", { 20 id: "string", 21 name: "string", 22 }); 23 24 types.addDictType("thread.frames", { 25 frames: "array:frame", 26 }); 27 28 types.addDictType("thread.breakpoint-options", { 29 condition: "nullable:string", 30 logValue: "nullable:string", 31 showStacktrace: "nullable:boolean", 32 }); 33 34 types.addDictType("paused-reason", { 35 type: "string", 36 37 // Used for any pause type that wants to describe why the pause happened. 38 message: "nullable:string", 39 40 // Used for the stepping pause types. 41 frameFinished: "nullable:json", 42 43 // Used for the "exception" pause type. 44 exception: "nullable:json", 45 46 // Used for the "interrupted" pause type. 47 onNext: "nullable:boolean", 48 49 // Used for the "eventBreakpoint" pause type. 50 breakpoint: "nullable:json", 51 52 // Used for the "mutationBreakpoint" pause type. 53 mutationType: "nullable:string", 54 }); 55 56 const threadSpec = generateActorSpec({ 57 typeName: "thread", 58 59 events: { 60 paused: { 61 actor: Option(0, "nullable:string"), 62 frame: Option(0, "frame"), 63 why: Option(0, "paused-reason"), 64 }, 65 resumed: {}, 66 newSource: { 67 source: Option(0, "json"), 68 }, 69 }, 70 71 methods: { 72 attach: { 73 request: { 74 options: Arg(0, "json"), 75 }, 76 response: {}, 77 }, 78 reconfigure: { 79 request: { 80 options: Arg(0, "json"), 81 }, 82 response: {}, 83 }, 84 resume: { 85 request: { 86 resumeLimit: Arg(0, "nullable:json"), 87 frameActorID: Arg(1, "nullable:string"), 88 }, 89 response: RetVal("nullable:json"), 90 }, 91 frames: { 92 request: { 93 start: Arg(0, "number"), 94 count: Arg(1, "number"), 95 }, 96 response: RetVal("thread.frames"), 97 }, 98 interrupt: { 99 request: { 100 when: Arg(0, "json"), 101 }, 102 }, 103 sources: { 104 response: { 105 sources: RetVal("array:json"), 106 }, 107 }, 108 skipBreakpoints: { 109 request: { 110 skip: Arg(0, "json"), 111 }, 112 response: { 113 skip: Arg(0, "json"), 114 }, 115 }, 116 dumpThread: { 117 request: {}, 118 response: RetVal("json"), 119 }, 120 dumpPools: { 121 request: {}, 122 response: RetVal("json"), 123 }, 124 setBreakpoint: { 125 request: { 126 location: Arg(0, "json"), 127 options: Arg(1, "thread.breakpoint-options"), 128 }, 129 }, 130 removeBreakpoint: { 131 request: { 132 location: Arg(0, "json"), 133 }, 134 }, 135 setXHRBreakpoint: { 136 request: { 137 path: Arg(0, "string"), 138 method: Arg(1, "string"), 139 }, 140 response: { 141 value: RetVal("boolean"), 142 }, 143 }, 144 removeXHRBreakpoint: { 145 request: { 146 path: Arg(0, "string"), 147 method: Arg(1, "string"), 148 }, 149 response: { 150 value: RetVal("boolean"), 151 }, 152 }, 153 getAvailableEventBreakpoints: { 154 response: { 155 value: RetVal("array:available-breakpoint-group"), 156 }, 157 }, 158 getActiveEventBreakpoints: { 159 response: { 160 ids: RetVal("array:string"), 161 }, 162 }, 163 setActiveEventBreakpoints: { 164 request: { 165 ids: Arg(0, "array:string"), 166 }, 167 }, 168 pauseOnExceptions: { 169 request: { 170 pauseOnExceptions: Arg(0, "string"), 171 ignoreCaughtExceptions: Arg(1, "string"), 172 }, 173 }, 174 175 toggleEventLogging: { 176 request: { 177 logEventBreakpoints: Arg(0, "string"), 178 }, 179 }, 180 181 isAttached: { 182 request: {}, 183 response: { 184 value: RetVal("boolean"), 185 }, 186 }, 187 }, 188 }); 189 190 exports.threadSpec = threadSpec;