Debugger Domain
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
Methods
Events
Types
Methods
Debugger.continueToLocation #
Continues execution until specific location is reached.
parameters
- location
-
Location
Location to continue to.
Debugger.disable #
Disables debugger for given page.
Debugger.enable #
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
Debugger.evaluateOnCallFrame #
Evaluates expression on a given call frame.
parameters
- callFrameId
-
CallFrameId
Call frame identifier to evaluate on.
- expression
-
string
Expression to evaluate.
- objectGroup
-
string
String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>).
- includeCommandLineAPI
-
boolean
Specifies whether command line API should be available to the evaluated expression, defaults to false.
- silent
-
boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
- returnByValue
-
boolean
Whether the result is expected to be a JSON object that should be sent by value.
- generatePreview
-
boolean
Whether preview should be generated for the result.
Return Object
- result
-
Runtime.RemoteObject
Object wrapper for the evaluation result.
- exceptionDetails
-
Runtime.ExceptionDetails
Exception details.
Debugger.getScriptSource #
Returns source for the script with given id.
parameters
- scriptId
-
Runtime.ScriptId
Id of the script to get source for.
Return Object
- scriptSource
-
string
Script source.
Debugger.pause #
Stops on the next JavaScript statement.
Debugger.restartFrame #
Restarts particular call frame from the beginning.
parameters
- callFrameId
-
CallFrameId
Call frame identifier to evaluate on.
Return Object
- callFrames
-
array[ CallFrame ]
New stack trace.
- asyncStackTrace
-
Runtime.StackTrace
Async stack trace, if any.
Debugger.resume #
Resumes JavaScript execution.
Debugger.setAsyncCallStackDepth #
Enables or disables async call stacks tracking.
parameters
- maxDepth
-
integer
Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default).
Debugger.setBreakpoint #
Sets JavaScript breakpoint at a given location.
parameters
- location
-
Location
Location to set breakpoint in.
- condition
-
string
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
Return Object
- breakpointId
-
BreakpointId
Id of the created breakpoint for further reference.
- actualLocation
-
Location
Location this breakpoint resolved into.
Debugger.setBreakpointByUrl #
Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads.
parameters
- lineNumber
-
integer
Line number to set breakpoint at.
- url
-
string
URL of the resources to set breakpoint on.
- urlRegex
-
string
Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified.
- columnNumber
-
integer
Offset in the line to set breakpoint at.
- condition
-
string
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
Return Object
- breakpointId
-
BreakpointId
Id of the created breakpoint for further reference.
- locations
-
array[ Location ]
List of the locations this breakpoint resolved into upon addition.
Debugger.setBreakpointsActive #
Activates / deactivates all breakpoints on the page.
parameters
- active
-
boolean
New value for breakpoints active state.
Debugger.setPauseOnExceptions #
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is <code>none</code>.
parameters
- state
-
string
Pause on exceptions mode.
Allowed Values:none
,uncaught
,all
Debugger.setScriptSource #
Edits JavaScript source live.
parameters
- scriptId
-
Runtime.ScriptId
Id of the script to edit.
- scriptSource
-
string
New content of the script.
- dryRun
-
boolean
If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
Return Object
- callFrames
-
array[ CallFrame ]
New stack trace in case editing has happened while VM was stopped.
- stackChanged
-
boolean
Whether current call stack was modified after applying the changes.
- asyncStackTrace
-
Runtime.StackTrace
Async stack trace, if any.
- exceptionDetails
-
Runtime.ExceptionDetails
Exception details if any.
Debugger.setSkipAllPauses #
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
parameters
- skip
-
boolean
New value for skip pauses state.
Debugger.setVariableValue #
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
parameters
- scopeNumber
-
integer
0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
- variableName
-
string
Variable name.
- newValue
-
Runtime.CallArgument
New variable value.
- callFrameId
-
CallFrameId
Id of callframe that holds variable.
Debugger.stepInto #
Steps into the function call.
Debugger.stepOut #
Steps out of the function call.
Debugger.stepOver #
Steps over the statement.
Events
Debugger.breakpointResolved #
Fired when breakpoint is resolved to an actual script and location.
parameters
- breakpointId
-
BreakpointId
Breakpoint unique identifier.
- location
-
Location
Actual breakpoint location.
Debugger.paused #
Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
parameters
- callFrames
-
array[ CallFrame ]
Call stack the virtual machine stopped on.
- reason
-
string
Pause reason.
Allowed Values:XHR
,DOM
,EventListener
,exception
,assert
,debugCommand
,promiseRejection
,other
- data
-
object
Object containing break-specific auxiliary properties.
- hitBreakpoints
-
array[ string ]
Hit breakpoints IDs
- asyncStackTrace
-
Runtime.StackTrace
Async stack trace, if any.
Debugger.resumed #
Fired when the virtual machine resumed execution.
Debugger.scriptFailedToParse #
Fired when virtual machine fails to parse the script.
parameters
- scriptId
-
Runtime.ScriptId
Identifier of the script parsed.
- url
-
string
URL or name of the script parsed (if any).
- startLine
-
integer
Line offset of the script within the resource with given URL (for script tags).
- startColumn
-
integer
Column offset of the script within the resource with given URL.
- endLine
-
integer
Last line of the script.
- endColumn
-
integer
Length of the last line of the script.
- executionContextId
-
Runtime.ExecutionContextId
Specifies script creation context.
- hash
-
string
Content hash of the script.
- executionContextAuxData
-
object
Embedder-specific auxiliary data.
- sourceMapURL
-
string
URL of source map associated with script (if any).
- hasSourceURL
-
boolean
True, if this script has sourceURL.
Debugger.scriptParsed #
Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
parameters
- scriptId
-
Runtime.ScriptId
Identifier of the script parsed.
- url
-
string
URL or name of the script parsed (if any).
- startLine
-
integer
Line offset of the script within the resource with given URL (for script tags).
- startColumn
-
integer
Column offset of the script within the resource with given URL.
- endLine
-
integer
Last line of the script.
- endColumn
-
integer
Length of the last line of the script.
- executionContextId
-
Runtime.ExecutionContextId
Specifies script creation context.
- hash
-
string
Content hash of the script.
- executionContextAuxData
-
object
Embedder-specific auxiliary data.
- isLiveEdit
-
boolean
True, if this script is generated as a result of the live edit operation.
- sourceMapURL
-
string
URL of source map associated with script (if any).
- hasSourceURL
-
boolean
True, if this script has sourceURL.
Types
Debugger.CallFrame #
JavaScript call frame. Array of call frames form the call stack.
Type: object
properties
- callFrameId
-
CallFrameId
Call frame identifier. This identifier is only valid while the virtual machine is paused.
- functionName
-
string
Name of the JavaScript function called on this call frame.
- functionLocation
-
Location
Location in the source code.
- location
-
Location
Location in the source code.
- scopeChain
-
array[ Scope ]
Scope chain for this call frame.
- this
-
Runtime.RemoteObject
<code>this</code> object for this call frame.
- returnValue
-
Runtime.RemoteObject
The value being returned, if the function is at return point.
Debugger.Location #
Location in the source code.
Type: object
properties
- scriptId
-
Runtime.ScriptId
Script identifier as reported in the <code>Debugger.scriptParsed</code>.
- lineNumber
-
integer
Line number in the script (0-based).
- columnNumber
-
integer
Column number in the script (0-based).
Debugger.Scope #
Scope description.
Type: object
properties
- type
-
string
Scope type.
Allowed Values:global
,local
,with
,closure
,catch
,block
,script
- object
-
Runtime.RemoteObject
Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
- name
-
string
- startLocation
-
Location
Location in the source code where scope starts
- endLocation
-
Location
Location in the source code where scope ends