Open tab should show the hidden tabs first

This commit is contained in:
baku 2017-02-18 21:56:36 +01:00
parent d2604bfb07
commit fbdaeb3021
2 changed files with 17 additions and 13 deletions

View file

@ -624,7 +624,7 @@ const ContainerService = {
const source = ("source" in args) ? args.source : null;
// Only send telemetry for tabs opened by UI - i.e., not via showTabs
if (source) {
if (source && userContextId) {
this.sendTelemetryPayload({
"event": "open-tab",
"eventSource": source,
@ -633,10 +633,19 @@ const ContainerService = {
});
}
const tab = browserWin.gBrowser.addTab(args.url || DEFAULT_TAB, { userContextId });
browserWin.gBrowser.selectedTab = tab;
browserWin.focusAndSelectUrlBar();
return true;
let promise;
if (userContextId) {
promise = this.showTabs(args);
} else {
promise = Promise.resolve(null);
}
return promise.then(() => {
const tab = browserWin.gBrowser.addTab(args.url || DEFAULT_TAB, { userContextId });
browserWin.gBrowser.selectedTab = tab;
browserWin.focusAndSelectUrlBar();
return true;
});
}).catch(() => false);
},

View file

@ -247,14 +247,9 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
tr.addEventListener("click", e => {
if (e.target.matches(".open-newtab")) {
browser.runtime.sendMessage({
method: "showTabs",
userContextId: identity.userContextId
}).then(() => {
return browser.runtime.sendMessage({
method: "openTab",
userContextId: identity.userContextId,
source: "pop-up"
});
method: "openTab",
userContextId: identity.userContextId,
source: "pop-up"
}).then(() => {
window.close();
}).catch(() => {