Skip to content

Commit df7d7f9

Browse files
Simplify new tab creation in the popup fixing issues. Fixes #781
1 parent 65be776 commit df7d7f9

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

webextension/js/background/backgroundLogic.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ const backgroundLogic = {
5050
});
5151
},
5252

53-
async openTab(options) {
54-
return this.openNewTab(options);
55-
},
56-
5753
async openNewTab(options) {
5854
let url = options.url || undefined;
5955
const userContextId = ("userContextId" in options) ? options.userContextId : 0;

webextension/js/background/messageHandler.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ const messageHandler = {
1717
case "createOrUpdateContainer":
1818
response = backgroundLogic.createOrUpdateContainer(m.message);
1919
break;
20-
case "openTab":
21-
// Same as open-tab for index.js
22-
response = backgroundLogic.openTab(m.message);
23-
break;
2420
case "neverAsk":
2521
assignManager._neverAsk(m);
2622
break;
@@ -83,18 +79,6 @@ const messageHandler = {
8379
});
8480
}
8581

86-
// Handles messages from sdk code
87-
const port = browser.runtime.connect();
88-
port.onMessage.addListener(m => {
89-
switch (m.type) {
90-
case "open-tab":
91-
backgroundLogic.openTab(m.message);
92-
break;
93-
default:
94-
throw new Error(`Unhandled message type: ${m.message}`);
95-
}
96-
});
97-
9882
browser.tabs.onActivated.addListener((info) => {
9983
assignManager.removeContextMenu();
10084
browser.tabs.get(info.tabId).then((tab) => {

webextension/js/popup.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,8 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
602602
|| e.target.parentNode.matches(".open-newtab")
603603
|| e.type === "keydown") {
604604
try {
605-
await browser.runtime.sendMessage({
606-
method: "openTab",
607-
message: {
608-
userContextId: Logic.userContextId(identity.cookieStoreId),
609-
source: "pop-up"
610-
}
605+
browser.tabs.create({
606+
cookieStoreId: identity.cookieStoreId
611607
});
612608
window.close();
613609
} catch (e) {

0 commit comments

Comments
 (0)