Chrome DevTools

1.0: Debugger

Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.

Commands

Debugger.canSetScriptSource

request: {
"id": <number>,
"method": "Debugger.canSetScriptSource"
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "result": <boolean>
}
}

Tells whether setScriptSource is supported.

Returns

result
( boolean )
True if setScriptSource is supported.

Debugger.continueToLocation

request: {
"id": <number>,
"method": "Debugger.continueToLocation",
"params": {
  "location": <Location>
}
}
response: {
"id": <number>,
"error": <object>
}

Continues execution until specific location is reached.

Parameters

location
( Location )
Location to continue to.

Debugger.disable

request: {
"id": <number>,
"method": "Debugger.disable"
}
response: {
"id": <number>,
"error": <object>
}

Disables debugger for given page.

Debugger.enable

request: {
"id": <number>,
"method": "Debugger.enable"
}
response: {
"id": <number>,
"error": <object>
}

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

request: {
"id": <number>,
"method": "Debugger.evaluateOnCallFrame",
"params": {
  "callFrameId": <CallFrameId>,
  "expression": <string>,
  "objectGroup": <string>,
  "returnByValue": <boolean>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "result": <Runtime.RemoteObject>,
  "wasThrown": <boolean>
}
}

Evaluates expression on a given call frame.

Parameters

callFrameId
Call frame identifier to evaluate on.
expression
( string )
Expression to evaluate.
objectGroup
( optional string )
String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).
returnByValue
( optional boolean )
Whether the result is expected to be a JSON object that should be sent by value.

Returns

result
Object wrapper for the evaluation result.
wasThrown
( optional boolean )
True if the result was thrown during the evaluation.

Debugger.getScriptSource

request: {
"id": <number>,
"method": "Debugger.getScriptSource",
"params": {
  "scriptId": <ScriptId>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "scriptSource": <string>
}
}

Returns source for the script with given id.

Parameters

scriptId
( ScriptId )
Id of the script to get source for.

Returns

scriptSource
( string )
Script source.

Debugger.pause

request: {
"id": <number>,
"method": "Debugger.pause"
}
response: {
"id": <number>,
"error": <object>
}

Stops on the next JavaScript statement.

Debugger.removeBreakpoint

request: {
"id": <number>,
"method": "Debugger.removeBreakpoint",
"params": {
  "breakpointId": <BreakpointId>
}
}
response: {
"id": <number>,
"error": <object>
}

Removes JavaScript breakpoint.

Parameters

breakpointId

Debugger.resume

request: {
"id": <number>,
"method": "Debugger.resume"
}
response: {
"id": <number>,
"error": <object>
}

Resumes JavaScript execution.

Debugger.searchInContent

request: {
"id": <number>,
"method": "Debugger.searchInContent",
"params": {
  "scriptId": <ScriptId>,
  "query": <string>,
  "caseSensitive": <boolean>,
  "isRegex": <boolean>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "result": <array of Page.SearchMatch>
}
}

Searches for given string in script content.

Parameters

scriptId
( ScriptId )
Id of the script to search in.
query
( string )
String to search for.
caseSensitive
( optional boolean )
If true, search is case sensitive.
isRegex
( optional boolean )
If true, treats string parameter as regex.

Returns

result
( array of Page.SearchMatch )
List of search matches.

Debugger.setBreakpoint

request: {
"id": <number>,
"method": "Debugger.setBreakpoint",
"params": {
  "location": <Location>,
  "condition": <string>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "breakpointId": <BreakpointId>,
  "actualLocation": <Location>
}
}

Sets JavaScript breakpoint at a given location.

Parameters

location
( Location )
Location to set breakpoint in.
condition
( optional string )
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.

Returns

breakpointId
Id of the created breakpoint for further reference.
actualLocation
( Location )
Location this breakpoint resolved into.

Debugger.setBreakpointByUrl

request: {
"id": <number>,
"method": "Debugger.setBreakpointByUrl",
"params": {
  "lineNumber": <integer>,
  "url": <string>,
  "urlRegex": <string>,
  "columnNumber": <integer>,
  "condition": <string>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "breakpointId": <BreakpointId>,
  "locations": <array of Location>
}
}

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 locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.

Parameters

lineNumber
( integer )
Line number to set breakpoint at.
url
( optional string )
URL of the resources to set breakpoint on.
urlRegex
( optional string )
Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.
columnNumber
( optional integer )
Offset in the line to set breakpoint at.
condition
( optional string )
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.

Returns

breakpointId
Id of the created breakpoint for further reference.
locations
( optional array of Location )
List of the locations this breakpoint resolved into upon addition.

Debugger.setBreakpointsActive

request: {
"id": <number>,
"method": "Debugger.setBreakpointsActive",
"params": {
  "active": <boolean>
}
}
response: {
"id": <number>,
"error": <object>
}

Activates / deactivates all breakpoints on the page.

Parameters

active
( boolean )
New value for breakpoints active state.

Debugger.setPauseOnExceptions

request: {
"id": <number>,
"method": "Debugger.setPauseOnExceptions",
"params": {
  "state": <string>
}
}
response: {
"id": <number>,
"error": <object>
}

Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none.

Parameters

state
( enumerated string [ "all" , "none" , "uncaught" ] )
Pause on exceptions mode.

Debugger.setScriptSource

request: {
"id": <number>,
"method": "Debugger.setScriptSource",
"params": {
  "scriptId": <ScriptId>,
  "scriptSource": <string>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "callFrames": <array of CallFrame>
}
}

Edits JavaScript source live.

Parameters

scriptId
( ScriptId )
Id of the script to edit.
scriptSource
( string )
New content of the script.

Returns

callFrames
( optional array of CallFrame )
New stack trace in case editing has happened while VM was stopped.

Debugger.stepInto

request: {
"id": <number>,
"method": "Debugger.stepInto"
}
response: {
"id": <number>,
"error": <object>
}

Steps into the function call.

Debugger.stepOut

request: {
"id": <number>,
"method": "Debugger.stepOut"
}
response: {
"id": <number>,
"error": <object>
}

Steps out of the function call.

Debugger.stepOver

request: {
"id": <number>,
"method": "Debugger.stepOver"
}
response: {
"id": <number>,
"error": <object>
}

Steps over the statement.

Notifications

Debugger.breakpointResolved

{
"method": "Debugger.breakpointResolved",
"params": {
  "breakpointId": <BreakpointId>,
  "location": <Location>
}
}

Fired when breakpoint is resolved to an actual script and location.

Parameters

breakpointId
Breakpoint unique identifier.
location
( Location )
Actual breakpoint location.

Debugger.globalObjectCleared

{
"method": "Debugger.globalObjectCleared"
}

Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload.

Debugger.paused

{
"method": "Debugger.paused",
"params": {
  "callFrames": <array of CallFrame>,
  "reason": <string>,
  "data": <object>
}
}

Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.

Parameters

callFrames
( array of CallFrame )
Call stack the virtual machine stopped on.
reason
( enumerated string [ "DOM" , "EventListener" , "XHR" , "exception" , "other" ] )
Pause reason.
data
( optional object )
Object containing break-specific auxiliary properties.

Debugger.resumed

{
"method": "Debugger.resumed"
}

Fired when the virtual machine resumed execution.

Debugger.scriptFailedToParse

{
"method": "Debugger.scriptFailedToParse",
"params": {
  "url": <string>,
  "scriptSource": <string>,
  "startLine": <integer>,
  "errorLine": <integer>,
  "errorMessage": <string>
}
}

Fired when virtual machine fails to parse the script.

Parameters

url
( string )
URL of the script that failed to parse.
scriptSource
( string )
Source text of the script that failed to parse.
startLine
( integer )
Line offset of the script within the resource.
errorLine
( integer )
Line with error.
errorMessage
( string )
Parse error message.

Debugger.scriptParsed

{
"method": "Debugger.scriptParsed",
"params": {
  "scriptId": <ScriptId>,
  "url": <string>,
  "startLine": <integer>,
  "startColumn": <integer>,
  "endLine": <integer>,
  "endColumn": <integer>,
  "isContentScript": <boolean>,
  "sourceMapURL": <string>
}
}

Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.

Parameters

scriptId
( 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.
isContentScript
( optional boolean )
Determines whether this script is a user extension script.
sourceMapURL
( optional string )
URL of source map associated with script (if any).

Types

BreakpointId: string

CallFrame: object

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.
location
( Location )
Location in the source code.
scopeChain
( array of Scope )
Scope chain for this call frame.
this
this object for this call frame.

CallFrameId: string

Location: object

columnNumber
( optional integer )
Column number in the script.
lineNumber
( integer )
Line number in the script.
scriptId
( ScriptId )
Script identifier as reported in the Debugger.scriptParsed.

Scope: object

object
Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
type
( enumerated string [ "catch" , "closure" , "global" , "local" , "with" ] )
Scope type.

ScriptId: string

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.