File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
browser/extension/devpanel Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ function panelDispatcher(bgConnection) {
77
88 return store => next => action => {
99 const result = next ( action ) ;
10- if ( ! autoselected && action . type === UPDATE_STATE ) {
10+ if ( ! autoselected && action . type === UPDATE_STATE && tabId ) {
1111 autoselected = true ;
1212 const connections = store . getState ( )
1313 . instances . connections [ tabId ] ;
@@ -18,7 +18,8 @@ function panelDispatcher(bgConnection) {
1818 if ( action . type === LIFTED_ACTION || action . type === 'TOGGLE_PERSIST' ) {
1919 const instances = store . getState ( ) . instances ;
2020 const instanceId = getActiveInstance ( instances ) ;
21- bgConnection . postMessage ( { ...action , instanceId, id : tabId } ) ;
21+ const id = instances . options [ instanceId ] . connectionId ;
22+ bgConnection . postMessage ( { ...action , instanceId, id } ) ;
2223 }
2324 return result ;
2425 } ;
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ function renderNA() {
6161
6262function init ( id ) {
6363 renderNA ( ) ;
64- bgConnection = chrome . runtime . connect ( { name : id . toString ( ) } ) ;
64+ bgConnection = chrome . runtime . connect ( { name : id ? id . toString ( ) : undefined } ) ;
6565 bgConnection . onMessage . addListener ( message => {
6666 if ( message . type === 'NA' ) {
6767 if ( message . id === id ) renderNA ( ) ;
@@ -73,12 +73,4 @@ function init(id) {
7373 } ) ;
7474}
7575
76- if ( chrome . devtools . inspectedWindow . tabId ) {
77- init ( chrome . devtools . inspectedWindow . tabId ) ;
78- } else {
79- // If there's no tabId it means we're inspecting an extension background script and will use its id
80- chrome . devtools . inspectedWindow . eval ( 'chrome.runtime.id' ,
81- function ( result , isException ) {
82- if ( ! isException && result ) init ( result ) ;
83- } ) ;
84- }
76+ init ( chrome . devtools . inspectedWindow . tabId ) ;
You can’t perform that action at this time.
0 commit comments