Merge pull request #784 from jonathanKingston/fix-new-tab

Simplify new tab creation in the popup fixing issues. Fixes #781
This commit is contained in:
luke crouch 2017-09-05 13:30:34 -05:00 committed by GitHub
commit 385c585888
3 changed files with 2 additions and 26 deletions

View file

@ -50,10 +50,6 @@ const backgroundLogic = {
});
},
async openTab(options) {
return this.openNewTab(options);
},
async openNewTab(options) {
let url = options.url || undefined;
const userContextId = ("userContextId" in options) ? options.userContextId : 0;

View file

@ -17,10 +17,6 @@ const messageHandler = {
case "createOrUpdateContainer":
response = backgroundLogic.createOrUpdateContainer(m.message);
break;
case "openTab":
// Same as open-tab for index.js
response = backgroundLogic.openTab(m.message);
break;
case "neverAsk":
assignManager._neverAsk(m);
break;
@ -83,18 +79,6 @@ const messageHandler = {
});
}
// Handles messages from sdk code
const port = browser.runtime.connect();
port.onMessage.addListener(m => {
switch (m.type) {
case "open-tab":
backgroundLogic.openTab(m.message);
break;
default:
throw new Error(`Unhandled message type: ${m.message}`);
}
});
browser.tabs.onActivated.addListener((info) => {
assignManager.removeContextMenu();
browser.tabs.get(info.tabId).then((tab) => {

View file

@ -602,12 +602,8 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|| e.target.parentNode.matches(".open-newtab")
|| e.type === "keydown") {
try {
await browser.runtime.sendMessage({
method: "openTab",
message: {
userContextId: Logic.userContextId(identity.cookieStoreId),
source: "pop-up"
}
browser.tabs.create({
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {