A new feature has been introduced called the openResource
API:
chrome.devtools.panels.openResource(string url, integer lineNumber, function callback)
This functionality is outlined in the chrome.devtools
documentation.
When using this API, you provide the absolute URL of the file to be examined, along with an optional line number and a callback function. It's important to note that the line numbering is 0-based within the API but 1-based in the user interface. For example, if you wish to view line 10
in the UI, you must pass 9
as the line number in the function call.
As of now, there is an error in the documentation regarding the callback function: it is triggered on both success and failure and accepts a single argument. This argument is an object containing information about the outcome.
If the operation is successful, you will receive the following response:
{
code: "OK",
description: "OK",
details: []
}
In case of an error, you will receive the following (among other potential error scenarios):
{
code: "E_NOTFOUND",
description: "Object not found: %s",
details: [
"http://localhost/foo.js"
],
isError: true
}