Explorar o código

check chrome.runtime.lastError when retrieving tab info

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
4851c586cb
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      extension/core/scripts/bg/bg.js

+ 5 - 1
extension/core/scripts/bg/bg.js

@@ -24,7 +24,11 @@
 
 	const CHROME_STORE_URL = "https://chrome.google.com";
 
-	chrome.tabs.onActivated.addListener(activeInfo => chrome.tabs.get(activeInfo.tabId, tab => singlefile.ui.notifyTabActive(tab.id, isAllowedURL(tab.url))));
+	chrome.tabs.onActivated.addListener(activeInfo => chrome.tabs.get(activeInfo.tabId, tab => {
+		if (!chrome.runtime.lastError) {
+			singlefile.ui.notifyTabActive(tab.id, isAllowedURL(tab.url));
+		}
+	}));
 	chrome.tabs.onCreated.addListener(tab => singlefile.ui.notifyTabActive(tab.id, isAllowedURL(tab.url)));
 	chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => singlefile.ui.notifyTabActive(tab.id, isAllowedURL(tab.url)));
 	chrome.tabs.onRemoved.addListener(tabId => singlefile.ui.notifyTabRemoved(tabId));