From 40fe819220aa741a713cd74949ea7ea053747ba8 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Sun, 20 Jun 2021 16:44:42 +1000 Subject: [PATCH] Fix stuck cache --- src/drivers/webextension/js/driver.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 37f6b10e2..8d0bc6f5b 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -76,8 +76,12 @@ const Driver = { chrome.tabs.onRemoved.addListener((id) => delete Driver.cache.tabs[id]) - chrome.tabs.onUpdated.addListener(async (id, { url }) => { - if (url) { + chrome.tabs.onUpdated.addListener(async (id, { status }) => { + delete Driver.cache.tabs[id] + + if (status === 'complete') { + const { url } = await promisify(chrome.tabs, 'get', id) + const { hostname } = new URL(url) const cache = Driver.cache.hostnames[hostname]