for #117 open-tab event
This commit is contained in:
parent
3c6d276a36
commit
7edfd27586
2 changed files with 23 additions and 2 deletions
24
index.js
24
index.js
|
@ -193,6 +193,13 @@ const ContainerService = {
|
||||||
|
|
||||||
// utility methods
|
// utility methods
|
||||||
|
|
||||||
|
_containerTabCount(userContextId) {
|
||||||
|
let containerTabsCount = 0;
|
||||||
|
containerTabsCount += this._identitiesState[userContextId].openTabs;
|
||||||
|
containerTabsCount += this._identitiesState[userContextId].hiddenTabs.length;
|
||||||
|
return containerTabsCount;
|
||||||
|
},
|
||||||
|
|
||||||
_totalContainerTabsCount() {
|
_totalContainerTabsCount() {
|
||||||
let totalContainerTabsCount = 0;
|
let totalContainerTabsCount = 0;
|
||||||
for (const userContextId in this._identitiesState) {
|
for (const userContextId in this._identitiesState) {
|
||||||
|
@ -570,6 +577,13 @@ const ContainerService = {
|
||||||
userContextId = args.userContextId;
|
userContextId = args.userContextId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._sendTelemetryPayload({
|
||||||
|
"event": "open-tab",
|
||||||
|
"eventSource": args.source,
|
||||||
|
"userContextId": userContextId,
|
||||||
|
"clickedContainerTabCount": this._containerTabCount(userContextId)
|
||||||
|
});
|
||||||
|
|
||||||
const tab = browserWin.gBrowser.addTab(args.url || null, { userContextId });
|
const tab = browserWin.gBrowser.addTab(args.url || null, { userContextId });
|
||||||
browserWin.gBrowser.selectedTab = tab;
|
browserWin.gBrowser.selectedTab = tab;
|
||||||
browserWin.focusAndSelectUrlBar();
|
browserWin.focusAndSelectUrlBar();
|
||||||
|
@ -892,7 +906,10 @@ ContainerWindow.prototype = {
|
||||||
menuItemElement.setAttribute("data-identity-color", identity.color);
|
menuItemElement.setAttribute("data-identity-color", identity.color);
|
||||||
|
|
||||||
menuItemElement.addEventListener("command", (e) => {
|
menuItemElement.addEventListener("command", (e) => {
|
||||||
ContainerService.openTab({userContextId: identity.userContextId});
|
ContainerService.openTab({
|
||||||
|
userContextId: identity.userContextId,
|
||||||
|
source: "tab-bar"
|
||||||
|
});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -925,7 +942,10 @@ ContainerWindow.prototype = {
|
||||||
_configureFileMenu() {
|
_configureFileMenu() {
|
||||||
return this._configureMenu("menu_newUserContext", null, e => {
|
return this._configureMenu("menu_newUserContext", null, e => {
|
||||||
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
||||||
ContainerService.openTab({ userContextId });
|
ContainerService.openTab({
|
||||||
|
userContextId: userContextId,
|
||||||
|
source: "file-menu"
|
||||||
|
});
|
||||||
}, "_fileMenuElements");
|
}, "_fileMenuElements");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
return browser.runtime.sendMessage({
|
return browser.runtime.sendMessage({
|
||||||
method: "openTab",
|
method: "openTab",
|
||||||
userContextId: identity.userContextId,
|
userContextId: identity.userContextId,
|
||||||
|
source: "pop-up"
|
||||||
});
|
});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
window.close();
|
window.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue