Query() moved to the parent process

This commit is contained in:
baku
2017-01-06 18:52:35 +01:00
parent 0b03b67f65
commit 404ee3304e
2 changed files with 55 additions and 3 deletions
+9 -3
View File
@@ -7,7 +7,10 @@ function hideContainerTabs(containerId) {
const tabUrlsToSave = [];
const hideorshowIcon = document.querySelector(`#${containerId}-hideorshow-icon`);
browser.tabs.query({cookieStoreId: containerId}).then(tabs=> {
browser.runtime.sendMessage({
method: 'queryTabs',
cookieStoreId: containerId
}).then(tabs=> {
tabs.forEach(tab=> {
tabIdsToRemove.push(tab.id);
tabUrlsToSave.push(tab.url);
@@ -17,7 +20,10 @@ function hideContainerTabs(containerId) {
cookieStoreId: containerId,
tabUrlsToSave: tabUrlsToSave
}).then(()=> {
browser.tabs.remove(tabIdsToRemove);
browser.runtime.sendMessage({
method: 'removeTabs',
tabIds: tabIdsToRemove
});
hideorshowIcon.src = CONTAINER_UNHIDE_SRC;
});
});
@@ -148,7 +154,7 @@ document.querySelector('#sort-containers-link').addEventListener('click', ()=> {
browser.runtime.sendMessage({method: 'queryIdentities'}).then(identities=> {
identities.unshift({cookieStoreId: 'firefox-default'});
browser.tabs.query({}).then(tabsArray=> {
browser.runtime.sendMessage({method: 'queryTabs'}).then(tabsArray=> {
const sortedTabsArray = [];
identities.forEach(identity=> {