Same code behaves differently in primary panel and inspector sidebar pane
Categories
(DevTools :: Inspector, defect)
Tracking
(Not tracked)
People
(Reporter: zhennan, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Steps to reproduce:
I have two panels created in my Add-on, one is created as a primary panel:
chrome.devtools.panels.create("DAP", "", "devtoolsPanel.html",
function(_sidebar) {
}
);
the second one is created as page inspector’s sidebar pane:
chrome.devtools.panels.elements.createSidebarPane("DAP",
function(sidebar) {
sidebar.setPage("devtoolsPanel.html");
}
);
both panels are created without issue.
In these two panels, I use the same code to handle a click event which intend to highlight the corresponding node in the Inspector:
rowClick(rowId: any) {
let clicked = this.state.report[rowId];
var script =
`var nodes = document.evaluate("${clicked.path.dom}", document, null, XPathResult.ANY_TYPE, null);
var node = nodes.iterateNext();
if (node) {
inspect(node);
true;
}`
chrome.devtools.inspectedWindow.eval(script, function(result, isException) {
if (isException) {
console.error( isException);
}
if (!result) {
console.log('Could not select element, it may have moved');
}
});
This code behaves differently in the primary panel and sidebar panel. When I do a clicking in the primary panel, the correct node is selected in the inspector, but if I do a clicking in the inspector’s sidebar pane, instead of selecting a node in the inspector, a console is opened at the bottom of the devtool, the node element is printed out, but the node in the inspector is not selected.
My question: why does the same code behave differently in primary panel and in Inspector’s sidebar panel?
Expected results:
Two panels, primary panel and sub-panel of Inspector should behave same for this save code
Comment 1•6 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Additional note: The inspect also works as expected in Chrome from a subpanel. We only see this behavior when we inspect from a Firefox subpanel (currently using FF 72.0.2).
Comment 3•6 years ago
|
||
I'm fairly certain this is a duplicate of bug 1609345, so I'll close it as such now. Please could you test in Firefox Nightly (74) and confirm it is fixed there?
Description
•