File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/browser/extension/background Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,12 @@ function initPanel(msg, port) {
1616 if ( msg . tabId !== store . id ) return naMessage ;
1717}
1818
19+ function getId ( port ) {
20+ return port . sender . tab ? port . sender . tab . id : port . sender . id ;
21+ }
22+
1923function initInstance ( msg , port ) {
20- const id = port . sender . tab . id ;
24+ const id = getId ( port ) ;
2125 tabConnections [ id ] = port ;
2226 store . liftedStore . instances [ id ] = msg . instance ;
2327 store . id = id ;
@@ -26,8 +30,8 @@ function initInstance(msg, port) {
2630}
2731
2832function disconnect ( port ) {
29- if ( ! port . sender . tab ) return ;
30- const id = port . sender . tab . id ;
33+ if ( ! port . sender . tab && port . id === chrome . runtime . id ) return ;
34+ const id = getId ( port ) ;
3135 delete tabConnections [ id ] ;
3236 if ( panelConnections [ id ] ) panelConnections [ id ] . postMessage ( naMessage ) ;
3337 if ( window . store . liftedStore . instances [ id ] ) {
You can’t perform that action at this time.
0 commit comments