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