@samitouri / QOS-React-1 / commits / 3082604bdc

[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.

Sebastian Markbåge committed Jul 24, 2025 at 17:38 UTC 3082604bdc03cfd8cee35e54dbb10caef956937e
1 file changed +2 -2
packages/react-devtools-extensions/src/main/index.js
+2 -2
@@ -111,7 +111,7 @@ function createBridge() {
111 chrome.devtools.panels.elements.onSelectionChanged.removeListener(
112 onBrowserElementSelectionChanged,
113 );
114 - if (sourcesPanel) {
114 + if (sourcesPanel && sourcesPanel.onSelectionChanged) {
115 currentSelectedSource = null;
116 sourcesPanel.onSelectionChanged.removeListener(
117 onBrowserSourceSelectionChanged,
@@ -124,7 +124,7 @@ function createBridge() {
124 chrome.devtools.panels.elements.onSelectionChanged.addListener(
125 onBrowserElementSelectionChanged,
126 );
127 - if (sourcesPanel) {
127 + if (sourcesPanel && sourcesPanel.onSelectionChanged) {
128 sourcesPanel.onSelectionChanged.addListener(
129 onBrowserSourceSelectionChanged,
130 );