Skip to content

Commit 12d554e

Browse files
committed
Support inspecting chrome extensions and apps
1 parent de95032 commit 12d554e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/browser/extension/background/messaging.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
1923
function 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

2832
function 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]) {

0 commit comments

Comments
 (0)