chrome.experimental.debugger
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
Notes
Debugger API exposes Google Chrome debugging interface to the extensions.
Debugging messages that are being sent and received are all JSON objects
with the structure defined by the Developer Tools / Web Inspector Protocol.
We are currently drafting this protocol, it is by no means ready and stable,
but we can already expose the way to attach to a given tab and instrument it.
Although not finalized, this API is feature rich. There is a proof of concept
implementation of the Chrome Developer Tools front-end running as an extension
using the debugger API.
Note that attaching to the page by means of the debugger API and using embedded
Chrome Developer Tools with it are mutually exclusive. If extension is attached
to the page and user invokes Developer Tools, debugging session is being
terminated. Extension can then re-establish it via attaching to a tab later.
API reference: chrome.experimental.debugger
Properties
getLastError
chrome.extensionlastError
Methods
attach
void
chrome.experimental.debugger.attach(, integer
tabId, function
callback)
Undocumented.
Attaches debugger to the tab with given id.
Parameters
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab to which you want to attach.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- If an error occurs while attaching to the tab, the callback will be called with no arguments and chrome.extension.lastError will be set to the error message.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function() {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
detach
void
chrome.experimental.debugger.detach(, integer
tabId, function
callback)
Undocumented.
Detaches debugger from a tab with given id.
Parameters
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab from which you want to detach.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- If an error occurs while detaching from the tab, the callback will be called with no arguments and chrome.extension.lastError will be set to the error message.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function() {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
sendRequest
void
chrome.experimental.debugger.sendRequest(, integer
tabId, string
method, object
params, function
callback)
Undocumented.
Send given request to the debugger.
Parameters
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab to which you want to send debugging request.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
method
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- Method name.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
params
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
- JSON object matching Developer Tools / Web Inspector Protocol scheme.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- Request response body. If an error occurs while posting the message, the callback will be called with no arguments and chrome.extension.lastError will be set to the error message.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(object result) {...};
-
result
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
- JSON object with the request response.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
Events
onDetach
chrome.experimental.debugger.onDetach.addListener(function(integer tabId) {...});
Undocumented.
Fired when browser terminates debugging session for the tab.
Parameters
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab that was detached.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
onEvent
chrome.experimental.debugger.onEvent.addListener(function(integer tabId, string method, object params) {...});
Undocumented.
Fired whenever debugger issues instrumentation event.
Parameters
-
tabId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the tab that generated debug evet.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
method
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- Method name.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
params
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
- JSON object matching Developer Tools / Web Inspector Protocol event data scheme.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-