Merge pull request #214 from bakulf/openTab

Open tab should show the hidden tabs first
This commit is contained in:
Andrea Marchesini 2017-02-19 18:47:00 +01:00 committed by GitHub
commit 81c8b2282d
2 changed files with 17 additions and 13 deletions

View file

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

View file

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