Reduce needless API call

This commit is contained in:
YUKI "Piro" Hiroshi 2019-04-18 15:55:59 +09:00
parent c60ad4f969
commit 0383836188

View file

@ -238,7 +238,7 @@ const backgroundLogic = {
}, },
async sortTabs() { async sortTabs() {
const windows = await browser.windows.getAll(); const windows = await browser.windows.getAll({ populate: true });
for (let windowObj of windows) { // eslint-disable-line prefer-const for (let windowObj of windows) { // eslint-disable-line prefer-const
// First the pinned tabs, then the normal ones. // First the pinned tabs, then the normal ones.
await this._sortTabsInternal(windowObj, true); await this._sortTabsInternal(windowObj, true);
@ -247,7 +247,7 @@ const backgroundLogic = {
}, },
async _sortTabsInternal(windowObj, pinnedTabs) { async _sortTabsInternal(windowObj, pinnedTabs) {
const tabs = await browser.tabs.query({windowId: windowObj.id}); const tabs = windowObj.tabs;
let pos = 0; let pos = 0;
// Let's collect UCIs/tabs for this window. // Let's collect UCIs/tabs for this window.