From 978b64669b75b82135f2d5d1d77af5d117b333bc Mon Sep 17 00:00:00 2001 From: Cimbali Date: Thu, 3 Aug 2023 14:48:28 +0100 Subject: [PATCH] Apply sorting in page action menu too --- src/js/pageAction.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/pageAction.js b/src/js/pageAction.js index 8aa51e47..785f5ed5 100644 --- a/src/js/pageAction.js +++ b/src/js/pageAction.js @@ -1,6 +1,14 @@ async function init() { const fragment = document.createDocumentFragment(); - const identities = await browser.contextualIdentities.query({}); + const [identities, containerOrderStorage] = await Promise.all([ + browser.contextualIdentities.query({}), + browser.storage.local.get([CONTAINER_ORDER_STORAGE_KEY]) + ]); + + if (containerOrderStorage && containerOrderStorage[CONTAINER_ORDER_STORAGE_KEY]) { + const order = containerOrderStorage[CONTAINER_ORDER_STORAGE_KEY]; + identities.sort((id1, id2) => order[id1.cookieStoreId] - order[id2.cookieStoreId]); + } for (const identity of identities) { const tr = document.createElement("tr");