Browse Source

ignore errors

Gildas 3 years ago
parent
commit
d1f8eb6df1
1 changed files with 18 additions and 14 deletions
  1. 18 14
      src/extension/ui/bg/ui-button.js

+ 18 - 14
src/extension/ui/bg/ui-button.js

@@ -228,22 +228,26 @@ async function refreshTab(tab) {
 }
 
 async function refresh(tabId, state) {
-	const allTabsData = tabsData.getTemporary(tabId);
-	if (state) {
-		if (!allTabsData[tabId].button) {
-			allTabsData[tabId].button = { lastState: null };
-		}
-		const lastState = allTabsData[tabId].button.lastState || {};
-		const newState = {};
-		Object.keys(state).forEach(property => {
-			if (state[property] !== undefined && (JSON.stringify(lastState[property]) != JSON.stringify(state[property]))) {
-				newState[property] = state[property];
+	try {
+		const allTabsData = tabsData.getTemporary(tabId);
+		if (state) {
+			if (!allTabsData[tabId].button) {
+				allTabsData[tabId].button = { lastState: null };
+			}
+			const lastState = allTabsData[tabId].button.lastState || {};
+			const newState = {};
+			Object.keys(state).forEach(property => {
+				if (state[property] !== undefined && (JSON.stringify(lastState[property]) != JSON.stringify(state[property]))) {
+					newState[property] = state[property];
+				}
+			});
+			if (Object.keys(newState).length) {
+				allTabsData[tabId].button.lastState = state;
+				await refreshAsync(tabId, newState);
 			}
-		});
-		if (Object.keys(newState).length) {
-			allTabsData[tabId].button.lastState = state;
-			await refreshAsync(tabId, newState);
 		}
+	} catch (error) {
+		// ignored
 	}
 }