[DevTools] Feature detect sources panel (#33987)

I broke Firefox DevTools extension in #33968.

It turns out the Firefox has a placeholder object for the sources panel
which is empty. We need to detect the actual event handler.
This commit is contained in:
Sebastian Markbåge
2025-07-24 17:38:12 -04:00
committed by GitHub
parent 4f34cc4a2e
commit 3082604bdc

View File

@@ -111,7 +111,7 @@ function createBridge() {
chrome.devtools.panels.elements.onSelectionChanged.removeListener(
onBrowserElementSelectionChanged,
);
if (sourcesPanel) {
if (sourcesPanel && sourcesPanel.onSelectionChanged) {
currentSelectedSource = null;
sourcesPanel.onSelectionChanged.removeListener(
onBrowserSourceSelectionChanged,
@@ -124,7 +124,7 @@ function createBridge() {
chrome.devtools.panels.elements.onSelectionChanged.addListener(
onBrowserElementSelectionChanged,
);
if (sourcesPanel) {
if (sourcesPanel && sourcesPanel.onSelectionChanged) {
sourcesPanel.onSelectionChanged.addListener(
onBrowserSourceSelectionChanged,
);