Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
fix(chrome-extension): silence stale tab errors when tab is closed during refresh
InstaZDLLefa84cc4d963
diff --git a/browser-extension/chrome/src/background.js b/browser-extension/chrome/src/background.jsindex d16c72ad..ca1e139b 100644--- a/browser-extension/chrome/src/background.js+++ b/browser-extension/chrome/src/background.js@@ -96,6 +96,7 @@ async function refreshTabAction(tabId, tab) {try {await actionFeedback.clearBadge(tabId);} catch (error) {+ if (isTabGoneError(error)) return;console.error("[OmniGet] Failed to clear badge:", error);}@@ -112,6 +113,7 @@ async function refreshTabAction(tabId, tab) {path: supported ? getIconPath(ACTIVE_ICON_PATHS) : getIconPath(INACTIVE_ICON_PATHS),});} catch (error) {+ if (isTabGoneError(error)) return;console.error("[OmniGet] Failed to set icon:", error);}@@ -121,6 +123,7 @@ async function refreshTabAction(tabId, tab) {title: resolveActionTitle(supported),});} catch (error) {+ if (isTabGoneError(error)) return;console.error("[OmniGet] Failed to set title:", error);}@@ -131,10 +134,16 @@ async function refreshTabAction(tabId, tab) {await chrome.action.disable(tabId);}} catch (error) {+ if (isTabGoneError(error)) return;console.error("[OmniGet] Failed to set enabled state:", error);}}+function isTabGoneError(error) {+ const msg = error instanceof Error ? error.message : String(error);+ return msg.includes("No tab with id");+}+function sendNativeMessage(message) {return new Promise((resolve, reject) => {chrome.runtime.sendNativeMessage(HOST_NAME, message, (response) => {