New issue
Advanced search Search tips

Issue 768159 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

chrome.devtools.panels.create callback receives an unexpected second parameter

Project Member Reported by rob@robwu.nl, Sep 23 2017

Issue description

chrome.devtools.panels.create is documented to receive only one parameter:
https://developer.chrome.com/extensions/devtools_panels#method-create
https://chromium.googlesource.com/chromium/src/+/082850a5cb3946bb595bb6aca588a1c227d2a66e/chrome/common/extensions/api/devtools/panels.json#329

However, it receives two parameters:
// From a devtools extension:
chrome.devtools.panels.create('manifest.json', '', '', function(...args){console.log(JSON.stringify(args, null, 4))});
// result:
[
    {
        "onShown": {},
        "onHidden": {},
        "onSearch": {}
    },
    {
        "code": "OK",
        "description": "OK",
        "details": []
    }
]
// The object with onShown,onHidden,onSearch is expected, the object with code,description,details is not expected and leaks an internal implementation detail.


This is caused by https://chromium.googlesource.com/chromium/src/+/082850a5cb3946bb595bb6aca588a1c227d2a66e/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js#256

extensionServer.sendRequest(request, callback && callback.bind(this, new ExtensionPanel(id)));

should be

extensionServer.sendRequest(request, callback && () => { callback.call(this, new ExtensionPanel(id)); });

or, if you don't care about "this" (which is identical to chrome.devtools.panels, but not documented to have that value):


extensionServer.sendRequest(request, callback && () => { callback(new ExtensionPanel(id)); });
 
Owner: dgozman@chromium.org
Status: Assigned (was: Untriaged)
To dgozman@ for devtools triage.
Owner: caseq@chromium.org

Sign in to add a comment