#885 disables move tab to a new window when only one tab is opened

This commit is contained in:
shivangikakkar 2018-09-20 21:34:19 +05:30
parent 99db192792
commit dd57158ab5

View file

@ -212,6 +212,11 @@ const Logic = {
return false;
},
async noOfTabs() {
const activeTabs = await browser.tabs.query({windowId: browser.windows.WINDOW_ID_CURRENT});
return activeTabs.length;
},
async refreshIdentities() {
const [identities, state] = await Promise.all([
browser.contextualIdentities.query({}),
@ -716,6 +721,10 @@ Logic.registerPanel(P_CONTAINER_INFO, {
incompatEl.classList.add("container-info-tab-row");
moveTabsEl.parentNode.insertBefore(fragment, moveTabsEl.nextSibling);
} else {
Logic.noOfTabs().then(result => {
if (result === 1) {
moveTabsEl.classList.remove("clickable");
} else {
Logic.addEnterHandler(moveTabsEl, async function () {
await browser.runtime.sendMessage({
@ -726,6 +735,10 @@ Logic.registerPanel(P_CONTAINER_INFO, {
window.close();
});
}
}).catch(error => {
throw new Error(error);
});
}
} catch (e) {
throw new Error("Could not check for incompatible add-ons.");
}