diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index 56afae69..accb1123 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -399,8 +399,8 @@ } }); port.onDisconnect.addListener(async () => { - const tab = await browser.tabs.get(tabId); - if (!chrome.runtime.lastError && tab.url === initialUrl) { + const tab = await browser.tabs.get(tabId).catch(() => ({})); + if (tab.url === initialUrl) { location.reload(); } else { closeCurrentTab();