From 306489f9e8a23b482235d7e78fa8788ee5244cd1 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Wed, 22 Feb 2023 21:23:02 +0100 Subject: Reset tabs if config changed --- background.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 4d94e69..1f0225c 100644 --- a/background.js +++ b/background.js @@ -79,10 +79,16 @@ function updateCerts() { const getting = browser.storage.sync.get("certs"); getting.then(saved => { certs = saved.certs; - console.log("certs=" + certs) + // Reset all tab data + browser.tabs.query({}).then(tabs => { + for (let tab of tabs) { + browser.browserAction.setIcon({ tabId: tab.id }); + browser.browserAction.setBadgeText({ text: "", tabId: tab.id }); + } + }, console.error); }, console.error) } // Listen to config change for certs list -browser.storage.local.onChanged.addListener(() => updateCerts()); +browser.storage.sync.onChanged.addListener(() => updateCerts()); // Initial config fetch updateCerts(); \ No newline at end of file -- cgit