blob: 5159bb360f9f357621652f411327e2d96f693c9a [file] [log] [blame]
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "debugger",
"description": "The <code>chrome.debugger</code> API serves as an alternate transport for Chrome's <a href='https://developer.chrome.com/devtools/docs/debugger-protocol'>remote debugging protocol</a>. Use <code>chrome.debugger</code> to attach to one or more tabs to instrument network interaction, debug JavaScript, mutate the DOM and CSS, etc. Use the Debuggee <code>tabId</code> to target tabs with sendCommand and route events by <code>tabId</code> from onEvent callbacks.",
"types": [
{
"id": "Debuggee",
"type": "object",
"description": "Debuggee identifier. Either tabId, extensionId or targetId must be specified",
"properties": {
"tabId": { "type": "integer", "optional": true, "description": "The id of the tab which you intend to debug." },
"extensionId": { "type": "string", "optional": true, "description": "The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the <code>--silent-debugger-extension-api</code> command-line switch is used." },
"targetId": { "type": "string", "optional": true, "description": "The opaque id of the debug target." }
}
},
{
"id": "DebuggerSession",
"type": "object",
"description": "Debugger session identifier. One of tabId, extensionId or targetId must be specified. Additionally, an optional sessionId can be provided. If sessionId is specified for arguments sent from $(ref:onEvent), it means the event is coming from a child protocol session within the root debuggee session. If sessionId is specified when passed to $(ref:sendCommand), it targets a child protocol session within the root debuggee session.",
"properties": {
"tabId": { "type": "integer", "optional": true, "description": "The id of the tab which you intend to debug." },
"extensionId": { "type": "string", "optional": true, "description": "The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the <code>--silent-debugger-extension-api</code> command-line switch is used." },
"targetId": { "type": "string", "optional": true, "description": "The opaque id of the debug target." },
"sessionId": { "type": "string", "optional": true, "description": "The opaque id of the Chrome DevTools Protocol session. Identifies a child session within the root session identified by tabId, extensionId or targetId." }
}
},
{
"id": "TargetInfoType",
"type": "string",
"description": "Target type.",
"enum" : ["page", "background_page", "worker", "other" ]
},
{
"id": "DetachReason",
"type": "string",
"description": "Connection termination reason.",
"enum": [ "target_closed", "canceled_by_user" ]
},
{
"id": "TargetInfo",
"type": "object",
"description": "Debug target information",
"properties": {
"type": {
"$ref": "TargetInfoType",
"description": "Target type."
},
"id": { "type": "string", "description": "Target id." },
"tabId": { "type": "integer", "optional": true, "description": "The tab id, defined if type == 'page'." },
"extensionId": { "type": "string", "optional": true, "description": "The extension id, defined if type = 'background_page'." },
"attached": { "type": "boolean", "description": "True if debugger is already attached." },
"title": { "type": "string", "description": "Target page title." },
"url": { "type": "string", "description": "Target URL." },
"faviconUrl": { "type": "string", "optional": true, "description": "Target favicon URL." }
}
}
],
"functions": [
{
"name": "attach",
"type": "function",
"description": "Attaches debugger to the given target.",
"parameters": [
{
"$ref": "Debuggee",
"name": "target",
"description": "Debugging target to which you want to attach."
},
{
"type": "string",
"name": "requiredVersion",
"description": "Required debugging protocol version (\"0.1\"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained <a href='https://developer.chrome.com/devtools/docs/debugger-protocol'>here</a>."
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [],
"description": "Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, $(ref:runtime.lastError) will be set to the error message."
}
},
{
"name": "detach",
"type": "function",
"description": "Detaches debugger from the given target.",
"parameters": [
{
"$ref": "Debuggee",
"name": "target",
"description": "Debugging target from which you want to detach."
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [],
"description": "Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, $(ref:runtime.lastError) will be set to the error message."
}
},
{
"name": "sendCommand",
"type": "function",
"description": "Sends given command to the debugging target.",
"parameters": [
{
"$ref": "DebuggerSession",
"name": "target",
"description": "Debugging target to which you want to send the command."
},
{
"type": "string",
"name": "method",
"description": "Method name. Should be one of the methods defined by the <a href='https://developer.chrome.com/devtools/docs/debugger-protocol'>remote debugging protocol</a>."
},
{
"type": "object",
"name": "commandParams",
"optional": true,
"additionalProperties": { "type": "any" },
"description": "JSON object with request parameters. This object must conform to the remote debugging params scheme for given method."
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"type": "object",
"name": "result",
"optional": true,
"additionalProperties": { "type": "any" },
"description": "JSON object with the response. Structure of the response varies depending on the method name and is defined by the 'returns' attribute of the command description in the remote debugging protocol."
}
],
"description": "Response body. If an error occurs while posting the message, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message."
}
},
{
"name": "getTargets",
"type": "function",
"description": "Returns the list of available debug targets.",
"parameters": [],
"returns_async": {
"name": "callback",
"parameters": [
{
"type": "array",
"name": "result",
"items": {"$ref": "TargetInfo"},
"description": "Array of TargetInfo objects corresponding to the available debug targets."
}
]
}
}
],
"events": [
{
"name": "onEvent",
"type": "function",
"description": "Fired whenever debugging target issues instrumentation event.",
"parameters": [
{
"$ref": "DebuggerSession",
"name": "source",
"description": "The debugger session that generated this event."
},
{
"type": "string",
"name": "method",
"description": "Method name. Should be one of the notifications defined by the <a href='https://developer.chrome.com/devtools/docs/debugger-protocol'>remote debugging protocol</a>."
},
{
"type": "object",
"name": "params",
"optional": true,
"additionalProperties": { "type": "any" },
"description": "JSON object with the parameters. Structure of the parameters varies depending on the method name and is defined by the 'parameters' attribute of the event description in the remote debugging protocol."
}
]
},
{
"name": "onDetach",
"type": "function",
"description": "Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab.",
"parameters": [
{
"$ref": "Debuggee",
"name": "source",
"description": "The debuggee that was detached."
},
{
"$ref": "DetachReason",
"name": "reason",
"description": "Connection termination reason."
}
]
}
]
}
]