1// Copyright 2016 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5/** @typedef {{ 6 type: string, 7 object: !Object, 8 name: (string|undefined), 9 startLocation: (!RawLocation|undefined), 10 endLocation: (!RawLocation|undefined) 11 }} */ 12var Scope; 13 14/** @typedef {{ 15 scriptId: string, 16 lineNumber: number, 17 columnNumber: number 18 }} */ 19var RawLocation; 20 21/** @typedef {{ 22 id: number, 23 name: string, 24 sourceURL: (string|undefined), 25 sourceMappingURL: (string|undefined), 26 source: string, 27 startLine: number, 28 endLine: number, 29 startColumn: number, 30 endColumn: number, 31 executionContextId: number, 32 executionContextAuxData: string 33 }} */ 34var FormattedScript; 35 36/** @typedef {{ 37 functionName: string, 38 location: !RawLocation, 39 this: !Object, 40 scopeChain: !Array<!Scope>, 41 functionLocation: (RawLocation|undefined), 42 returnValue: (*|undefined) 43 }} */ 44var JavaScriptCallFrameDetails; 45 46/** @typedef {{ 47 sourceID: function():(number), 48 line: function():number, 49 column: function():number, 50 thisObject: !Object, 51 evaluate: function(string):*, 52 restart: function():undefined, 53 setVariableValue: function(number, string, *):undefined, 54 isAtReturn: boolean, 55 details: function():!JavaScriptCallFrameDetails 56 }} */ 57var JavaScriptCallFrame; 58 59/** 60 * @const 61 */ 62var Debug = {}; 63 64Debug.clearAllBreakPoints = function() {} 65 66/** @return {!Array<!Script>} */ 67Debug.scripts = function() {} 68 69/** 70 * @param {number} scriptId 71 * @param {number=} line 72 * @param {number=} column 73 * @param {string=} condition 74 * @param {string=} groupId 75 * @param {Debug.BreakPositionAlignment=} positionAlignment 76 */ 77Debug.setScriptBreakPointById = function(scriptId, line, column, condition, groupId, positionAlignment) {} 78 79/** 80 * @param {number} breakId 81 * @return {!Array<!SourceLocation>} 82 */ 83Debug.findBreakPointActualLocations = function(breakId) {} 84 85/** 86 * @param {number} breakId 87 * @param {boolean} remove 88 * @return {!BreakPoint|undefined} 89 */ 90Debug.findBreakPoint = function(breakId, remove) {} 91 92/** @return {!DebuggerFlags} */ 93Debug.debuggerFlags = function() {} 94 95 96/** @enum */ 97const BreakPositionAlignment = { 98 Statement: 0, 99 BreakPosition: 1 100}; 101Debug.BreakPositionAlignment = BreakPositionAlignment; 102 103/** @enum */ 104Debug.StepAction = { StepOut: 0, 105 StepNext: 1, 106 StepIn: 2, 107 StepFrame: 3 }; 108 109/** @enum */ 110const ScriptCompilationType = { Host: 0, 111 Eval: 1, 112 JSON: 2 }; 113Debug.ScriptCompilationType = ScriptCompilationType; 114 115 116/** @interface */ 117function DebuggerFlag() {} 118 119/** @param {boolean} value */ 120DebuggerFlag.prototype.setValue = function(value) {} 121 122 123/** @typedef {{ 124 * breakPointsActive: !DebuggerFlag 125 * }} 126 */ 127var DebuggerFlags; 128 129/** @const */ 130var LiveEdit = {} 131 132/** 133 * @param {!Script} script 134 * @param {string} newSource 135 * @param {boolean} previewOnly 136 * @return {!{stack_modified: (boolean|undefined)}} 137 */ 138LiveEdit.SetScriptSource = function(script, newSource, previewOnly, change_log) {} 139 140/** @constructor */ 141function Failure() {} 142LiveEdit.Failure = Failure; 143 144Debug.LiveEdit = LiveEdit; 145 146/** @typedef {{ 147 * type: string, 148 * syntaxErrorMessage: string, 149 * position: !{start: !{line: number, column: number}}, 150 * }} 151 */ 152var LiveEditErrorDetails; 153 154/** @typedef {{ 155 * breakpointId: number, 156 * sourceID: number, 157 * lineNumber: (number|undefined), 158 * columnNumber: (number|undefined), 159 * condition: (string|undefined), 160 * interstatementLocation: (boolean|undefined), 161 * }} 162 */ 163var BreakpointInfo; 164 165 166/** @interface */ 167function BreakPoint() {} 168 169/** @return {!BreakPoint|undefined} */ 170BreakPoint.prototype.script_break_point = function() {} 171 172/** @return {number} */ 173BreakPoint.prototype.number = function() {} 174 175 176/** @interface */ 177function CompileEvent() {} 178 179/** @return {!ScriptMirror} */ 180CompileEvent.prototype.script = function() {} 181 182 183/** @interface */ 184function BreakEvent() {} 185 186/** @return {!Array<!BreakPoint>|undefined} */ 187BreakEvent.prototype.breakPointsHit = function() {} 188 189 190/** @interface */ 191function ExecutionState() {} 192 193/** 194 * @param {string} source 195 * @param {boolean} disableBreak 196 * @param {*=} additionalContext 197 */ 198ExecutionState.prototype.evaluateGlobal = function(source, disableBreak, additionalContext) {} 199 200/** @return {number} */ 201ExecutionState.prototype.frameCount = function() {} 202 203/** 204 * @param {number} index 205 * @return {!FrameMirror} 206 */ 207ExecutionState.prototype.frame = function(index) {} 208 209/** @param {number} index */ 210ExecutionState.prototype.setSelectedFrame = function(index) {} 211 212/** @return {number} */ 213ExecutionState.prototype.selectedFrame = function() {} 214 215 216/** @enum */ 217var ScopeType = { Global: 0, 218 Local: 1, 219 With: 2, 220 Closure: 3, 221 Catch: 4, 222 Block: 5, 223 Script: 6 }; 224 225 226/** @typedef {{ 227 * script: number, 228 * position: number, 229 * line: number, 230 * column:number, 231 * start: number, 232 * end: number, 233 * }} 234 */ 235var SourceLocation; 236 237/** @typedef{{ 238 * id: number, 239 * context_data: (string|undefined), 240 * source_url: (string|undefined), 241 * source_mapping_url: (string|undefined), 242 * is_debugger_script: boolean, 243 * source: string, 244 * line_offset: number, 245 * column_offset: number, 246 * nameOrSourceURL: function():string, 247 * compilationType: function():!ScriptCompilationType, 248 * }} 249 */ 250var Script; 251 252/** @interface */ 253function ScopeDetails() {} 254 255/** @return {!Object} */ 256ScopeDetails.prototype.object = function() {} 257 258/** @return {string|undefined} */ 259ScopeDetails.prototype.name = function() {} 260 261/** @return {number} */ 262ScopeDetails.prototype.type = function() {} 263 264 265/** @interface */ 266function FrameDetails() {} 267 268/** @return {!Object} */ 269FrameDetails.prototype.receiver = function() {} 270 271/** @return {function()} */ 272FrameDetails.prototype.func = function() {} 273 274/** @return {!Object} */ 275FrameDetails.prototype.script = function() {} 276 277/** @return {boolean} */ 278FrameDetails.prototype.isAtReturn = function() {} 279 280/** @return {number} */ 281FrameDetails.prototype.sourcePosition = function() {} 282 283/** @return {*} */ 284FrameDetails.prototype.returnValue = function() {} 285 286/** @return {number} */ 287FrameDetails.prototype.scopeCount = function() {} 288 289 290/** @param {boolean} value */ 291function ToggleMirrorCache(value) {} 292 293/** 294 * @param {*} value 295 * @param {boolean=} transient 296 * @return {!Mirror} 297 */ 298function MakeMirror(value, transient) {} 299 300 301/** @interface */ 302function Mirror() {} 303 304/** @return {boolean} */ 305Mirror.prototype.isFunction = function() {} 306 307/** @return {boolean} */ 308Mirror.prototype.isGenerator = function() {} 309 310/** @return {boolean} */ 311Mirror.prototype.isMap = function() {} 312 313/** @return {boolean} */ 314Mirror.prototype.isSet = function() {} 315 316/** @return {boolean} */ 317Mirror.prototype.isIterator = function() {} 318 319 320/** 321 * @interface 322 * @extends {Mirror} 323 */ 324function ObjectMirror() {} 325 326/** @return {!Array<!PropertyMirror>} */ 327ObjectMirror.prototype.properties = function() {} 328 329 330/** 331 * @interface 332 * @extends {ObjectMirror} 333 */ 334function FunctionMirror () {} 335 336/** @return {number} */ 337FunctionMirror.prototype.scopeCount = function() {} 338 339/** 340 * @param {number} index 341 * @return {!ScopeMirror|undefined} 342 */ 343FunctionMirror.prototype.scope = function(index) {} 344 345/** @return {boolean} */ 346FunctionMirror.prototype.resolved = function() {} 347 348/** @return {function()} */ 349FunctionMirror.prototype.value = function() {} 350 351/** @return {string} */ 352FunctionMirror.prototype.debugName = function() {} 353 354/** @return {!ScriptMirror|undefined} */ 355FunctionMirror.prototype.script = function() {} 356 357/** @return {!SourceLocation|undefined} */ 358FunctionMirror.prototype.sourceLocation = function() {} 359 360/** @return {!ContextMirror|undefined} */ 361FunctionMirror.prototype.context = function() {} 362 363/** 364 * @constructor 365 * @param {*} value 366 */ 367function UnresolvedFunctionMirror(value) {} 368 369 370/** 371 * @interface 372 * @extends {ObjectMirror} 373 */ 374function MapMirror () {} 375 376/** 377 * @param {number=} limit 378 * @return {!Array<!{key: *, value: *}>} 379 */ 380MapMirror.prototype.entries = function(limit) {} 381 382 383/** 384 * @interface 385 * @extends {ObjectMirror} 386 */ 387function SetMirror () {} 388 389/** 390 * @param {number=} limit 391 * @return {!Array<*>} 392 */ 393SetMirror.prototype.values = function(limit) {} 394 395 396/** 397 * @interface 398 * @extends {ObjectMirror} 399 */ 400function IteratorMirror () {} 401 402/** 403 * @param {number=} limit 404 * @return {!Array<*>} 405 */ 406IteratorMirror.prototype.preview = function(limit) {} 407 408 409/** 410 * @interface 411 * @extends {ObjectMirror} 412 */ 413function GeneratorMirror () {} 414 415/** @return {string} */ 416GeneratorMirror.prototype.status = function() {} 417 418/** @return {!SourceLocation|undefined} */ 419GeneratorMirror.prototype.sourceLocation = function() {} 420 421/** @return {!FunctionMirror} */ 422GeneratorMirror.prototype.func = function() {} 423 424 425/** 426 * @interface 427 * @extends {Mirror} 428 */ 429function PropertyMirror() {} 430 431/** @return {!Mirror} */ 432PropertyMirror.prototype.value = function() {} 433 434/** @return {string} */ 435PropertyMirror.prototype.name = function() {} 436 437/** @type {*} */ 438PropertyMirror.prototype.value_; 439 440/** 441 * @interface 442 * @extends {Mirror} 443 */ 444function FrameMirror() {} 445 446/** 447 * @param {boolean=} ignoreNestedScopes 448 * @return {!Array<!ScopeMirror>} 449 */ 450FrameMirror.prototype.allScopes = function(ignoreNestedScopes) {} 451 452/** @return {!FrameDetails} */ 453FrameMirror.prototype.details = function() {} 454 455/** @return {!ScriptMirror} */ 456FrameMirror.prototype.script = function() {} 457 458/** 459 * @param {string} source 460 * @param {boolean} disableBreak 461 */ 462FrameMirror.prototype.evaluate = function(source, disableBreak) {} 463 464FrameMirror.prototype.restart = function() {} 465 466/** @param {number} index */ 467FrameMirror.prototype.scope = function(index) {} 468 469 470/** 471 * @interface 472 * @extends {Mirror} 473 */ 474function ScriptMirror() {} 475 476/** @return {!Script} */ 477ScriptMirror.prototype.value = function() {} 478 479/** @return {number} */ 480ScriptMirror.prototype.id = function() {} 481 482/** 483 * @param {number} position 484 * @param {boolean=} includeResourceOffset 485 */ 486ScriptMirror.prototype.locationFromPosition = function(position, includeResourceOffset) {} 487 488 489/** 490 * @interface 491 * @extends {Mirror} 492 */ 493function ScopeMirror() {} 494 495/** @return {!ScopeDetails} */ 496ScopeMirror.prototype.details = function() {} 497 498/** 499 * @param {string} name 500 * @param {*} newValue 501 */ 502ScopeMirror.prototype.setVariableValue = function(name, newValue) {} 503 504/** 505 * @interface 506 * @extends {Mirror} 507 */ 508function ContextMirror() {} 509 510/** @return {string|undefined} */ 511ContextMirror.prototype.data = function() {} 512