Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created December 22, 2016 16:52
Show Gist options
  • Select an option

  • Save groovecoder/9c5435b6fa30589cad3d7f637f5f2202 to your computer and use it in GitHub Desktop.

Select an option

Save groovecoder/9c5435b6fa30589cad3d7f637f5f2202 to your computer and use it in GitHub Desktop.
document.querySelector('#sort-containers-link').addEventListener('click', ()=> {
const sortedTabsArray = [];
browser.contextualIdentities.query({}).then(identities=> {
identities.unshift({cookieStoreId: 'firefox-default'});
console.log('identities: ', identities);
const tabsArray = browser.tabs.query({}).then(tabsArray);
identities.forEach(identity=> {
tabsArray.forEach(tab=> {
if (tab.cookieStoreId === identity.cookieStoreId) {
sortedTabsArray.push(tab.id);
}
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment