Skip to content

Commit 3ce732f

Browse files
committed
Support for Vivaldi browser
Related to #116 (comment) omment-277890509
1 parent 01df58d commit 3ce732f

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/app/middlewares/panelSync.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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
};

src/browser/extension/devpanel/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function renderNA() {
6161

6262
function 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);

0 commit comments

Comments
 (0)